From: Aran Deltac Date: Tue, 4 Apr 2006 18:12:45 +0000 (+0000) Subject: New inheritance_pod.pl tool for createing POD showing inherited methods. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cdb372c3ccded405d8ff43e07e6f11ce0db0c8ad;p=dbsrgits%2FDBIx-Class-Historic.git New inheritance_pod.pl tool for createing POD showing inherited methods. --- diff --git a/maint/inheritance_pod.pl b/maint/inheritance_pod.pl new file mode 100755 index 0000000..72ba0ea --- /dev/null +++ b/maint/inheritance_pod.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl +use strict; +use warnings; +use lib qw(lib t/lib); + +# USAGE: +# maint/inheritance_pod.pl Some::Module + +my $module = $ARGV[0]; +eval(" require $module; "); + +my @modules = Class::C3::calculateMRO($module); +shift( @modules ); + +print "=head1 INHERITED METHODS\n\n"; + +foreach my $module (@modules) { + print "=head2 $module\n\n"; + print "=over 4\n\n"; + my $file = $module; + $file =~ s/::/\//g; + $file .= '.pm'; + foreach my $path (@INC){ + if (-e "$path/$file") { + open(MODULE,"<$path/$file"); + while (my $line = ) { + if ($line=~/^\s*sub ([a-z][a-z_]+) \{/) { + my $method = $1; + print "=item *\n\n"; + print "L<$method|$module/$method>\n\n"; + } + } + close(MODULE); + last; + } + } + print "=back\n\n"; +} + +1;