X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fsplitpod;h=10fd6afb1112e922eabd4ab19315658752a0e5b2;hb=be5387481edebd42425976c372ac3dbafe134bde;hp=ff60ddc085c4c1eb0905d1b6692e237da44cf8e8;hpb=279b5f1a612874b608bbd09f6635e256c67090a7;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/splitpod b/pod/splitpod index ff60ddc..10fd6af 100755 --- a/pod/splitpod +++ b/pod/splitpod @@ -1,16 +1,23 @@ #!/usr/bin/perl -use lib '../lib'; # If you haven't installed perl yet. +BEGIN { push @INC, '../lib' } # If you haven't installed perl yet. use Pod::Functions; local $/ = ''; +$level = 0; + $cur = ''; while (<>) { next unless /^=(?!cut)/ .. /^=cut/; - if (/=item (\S+)/ and $1 ne '*') { + ++$level if /^=over/; + --$level if /^=back/; + + # Ignore items that are nested within other items, e.g. don't split on the + # items nested within the pack() and sprintf() items in perlfunc.pod. + if (/=item (\S+)/ and $level == 1) { my $item = $1; s/=item //; $next{$cur} = $item; @@ -41,15 +48,15 @@ for $f ( keys %syn ) { $body =~ s/^=back\s*//m if $has_back and !$has_over; open (POD, "> $name.pod") || die "can't open $name.pod: $!"; print POD <