home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / pod / splitpod < prev   
Text File  |  1995-12-28  |  638b  |  48 lines

  1. #!/usr/bin/perl
  2.  
  3. use PerlDoc::Functions;
  4.  
  5. local $/ = '';
  6.  
  7. $cur = '';
  8. while (<>) {
  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. for $f ( keys %syn ) {
  24.     $type = $Type{$f} || next;
  25.     $flavor = $Flavor{$f};
  26.     $orig = $f;
  27.     ($name = $f) =~ s/\W//g;
  28.     open (POD, "> $name.pod") || die "can't open $name.pod: $!";
  29.     print POD <<EOF;
  30. =head1 NAME
  31.  
  32. $orig - $flavor
  33.  
  34. =head1 SYNOPSIS
  35.  
  36. $syn{$orig}
  37.  
  38. =head1 DESCRIPTION
  39.  
  40. $pod{$orig}
  41.  
  42. EOF
  43.  
  44.     close POD;
  45.  
  46.