Created
September 13, 2012 16:04
-
-
Save gonter/3715363 to your computer and use it in GitHub Desktop.
convert list of perl package declarations into wiki table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# convert list of perl package declarations into wiki table | |
# the input should be the result of a something like | |
# fgrep -n 'package' <my-large-list-of-perl-scripts-and-modules> | |
# | |
use strict; | |
print "| *package_name* | *usage* | *file_name* |\n"; | |
while (<>) | |
{ | |
chop; | |
my ($fnm, $lnr, $pkg)= split (':', $_, 3); | |
my ($pkg_name, $pkg_name_wiki); | |
$pkg_name_wiki= $pkg_name= $1 if ($pkg =~ m#package\s+(\S+)\s*;#); | |
next unless (defined ($pkg_name)); | |
$pkg_name_wiki=~ s/:/_/g; | |
$fnm=~ s#^\.\/##; | |
printf "| [[package $pkg_name_wiki|$pkg_name]] | | source:/trunk/$fnm\@L$lnr |\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment