Commit | Line | Data |
cdb372c3 |
1 | #!/usr/bin/perl |
2 | use strict; |
3 | use warnings; |
4 | use lib qw(lib t/lib); |
5 | |
6 | # USAGE: |
7 | # maint/inheritance_pod.pl Some::Module |
8 | |
9 | my $module = $ARGV[0]; |
10 | eval(" require $module; "); |
11 | |
12 | my @modules = Class::C3::calculateMRO($module); |
13 | shift( @modules ); |
14 | |
15 | print "=head1 INHERITED METHODS\n\n"; |
16 | |
17 | foreach my $module (@modules) { |
18 | print "=head2 $module\n\n"; |
19 | print "=over 4\n\n"; |
20 | my $file = $module; |
21 | $file =~ s/::/\//g; |
22 | $file .= '.pm'; |
23 | foreach my $path (@INC){ |
24 | if (-e "$path/$file") { |
25 | open(MODULE,"<$path/$file"); |
26 | while (my $line = <MODULE>) { |
27 | if ($line=~/^\s*sub ([a-z][a-z_]+) \{/) { |
28 | my $method = $1; |
29 | print "=item *\n\n"; |
30 | print "L<$method|$module/$method>\n\n"; |
31 | } |
32 | } |
33 | close(MODULE); |
34 | last; |
35 | } |
36 | } |
37 | print "=back\n\n"; |
38 | } |
39 | |
40 | 1; |