|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /installd/perl588installer/perl-5.8.8/pod/ |
Upload File : |
#!/usr/bin/perl
use lib '../lib'; # If you haven't installed perl yet.
use Pod::Functions;
local $/ = '';
$level = 0;
$cur = '';
while (<>) {
next unless /^=(?!cut)/ .. /^=cut/;
++$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;
$cur = $item;
$syn{$cur} .= $_;
next;
} else {
s,L</,L<perlfunc/,g;
push @{$pod{$cur}}, $_ if $cur;
}
}
for $f ( keys %syn ) {
next unless $Type{$f};
$flavor = $Flavor{$f};
$orig = $f;
($name = $f) =~ s/\W//g;
# deal with several functions sharing a description
$func = $orig;
$func = $next{$func} until $pod{$func};
my $body = join "", @{$pod{$func}};
# deal with unbalanced =over and =back cause by the split
my $has_over = $body =~ /^=over/;
my $has_back = $body =~ /^=back/;
$body =~ s/^=over\s*//m if $has_over and !$has_back;
$body =~ s/^=back\s*//m if $has_back and !$has_over;
open (POD, "> $name.pod") || die "can't open $name.pod: $!";
print POD <<EOF;
=head1 NAME
$orig - $flavor
=head1 SYNOPSIS
$syn{$orig}
=head1 DESCRIPTION
$body
EOF
close POD;
}