summaryrefslogtreecommitdiff
path: root/pod/splitpod
blob: fd327d80da5f0371b9ae431c044d5ea6358413c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl

use PerlDoc::Functions;

local $/ = '';

$cur = '';
while (<>) {

    next unless /^=(?!cut)/ .. /^=cut/;

    if (s/=item (\S+)/$1/) {
	#$cur = "POSIX::" . $1;
	$cur = $1;
	$syn{$cur} .= $_;
	next;
    } else { 
	#s,L</,L<POSIX/,g;
	s,L</,L<perlfunc/,g;
	$pod{$cur} .= $_ if $cur;
    }
} 

for $f ( keys %syn ) {
    $type = $Type{$f} || next;
    $flavor = $Flavor{$f};
    $orig = $f;
    ($name = $f) =~ s/\W//g;
    open (POD, "> $name.pod") || die "can't open $name.pod: $!";
    print POD <<EOF;
=head1 NAME

$orig - $flavor

=head1 SYNOPSIS

$syn{$orig}

=head1 DESCRIPTION

$pod{$orig}

EOF

    close POD;

}