This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[inseparable changes from patch from perl5.003_18 to perl5.003_19]
[perl5.git] / pod / splitpod
1 #!/usr/bin/perl
2
3 use lib '../lib';  # If you haven't installed perl yet.
4 use Pod::Functions;
5
6 local $/ = '';
7
8 $cur = '';
9 while (<>) {
10
11     next unless /^=(?!cut)/ .. /^=cut/;
12
13     if (s/=item (\S+)/$1/) {
14         #$cur = "POSIX::" . $1;
15         $cur = $1;
16         $syn{$cur} .= $_;
17         next;
18     } else { 
19         #s,L</,L<POSIX/,g;
20         s,L</,L<perlfunc/,g;
21         $pod{$cur} .= $_ if $cur;
22     }
23
24
25 for $f ( keys %syn ) {
26     $type = $Type{$f} || next;
27     $flavor = $Flavor{$f};
28     $orig = $f;
29     ($name = $f) =~ s/\W//g;
30     open (POD, "> $name.pod") || die "can't open $name.pod: $!";
31     print POD <<EOF;
32 =head1 NAME
33
34 $orig - $flavor
35
36 =head1 SYNOPSIS
37
38 $syn{$orig}
39
40 =head1 DESCRIPTION
41
42 $pod{$orig}
43
44 EOF
45
46     close POD;
47
48