perl 5.002gamma: [patch introduction and re-organisations]
[p5sagit/p5-mst-13.2.git] / pod / splitpod
CommitLineData
cb1a09d0 1#!/usr/bin/perl
2
3use PerlDoc::Functions;
4
5local $/ = '';
6
7$cur = '';
8while (<>) {
9
10 next unless /^=(?!cut)/ .. /^=cut/;
11
12 if (s/=item (\S+)/$1/) {
13 #$cur = "POSIX::" . $1;
14 $cur = $1;
15 $syn{$cur} .= $_;
16 next;
17 } else {
18 #s,L</,L<POSIX/,g;
19 s,L</,L<perlfunc/,g;
20 $pod{$cur} .= $_ if $cur;
21 }
22}
23
24for $f ( keys %syn ) {
25 $type = $Type{$f} || next;
26 $flavor = $Flavor{$f};
27 $orig = $f;
28 ($name = $f) =~ s/\W//g;
29 open (POD, "> $name.pod") || die "can't open $name.pod: $!";
30 print POD <<EOF;
31=head1 NAME
32
33$orig - $flavor
34
35=head1 SYNOPSIS
36
37$syn{$orig}
38
39=head1 DESCRIPTION
40
41$pod{$orig}
42
43EOF
44
45 close POD;
46
47}