The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl -w
use strict;
use lib './lib';
use base 'LEOCHARRE::CLI';
use LEOCHARRE::PMSubs 'subs_defined';
our $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)/g;

my $o = gopts('pP');
$o->{p} ||=0;

my $files = argv_aspaths() or warn('missing argument list') and exit;


for (@$files){
   showone($_);
}

exit;


sub showone {
   my $abs = shift;
   
   if (scalar @$files > 1){
      print "# [$abs]\n";
   }

   my $subs = subs_defined($abs,$o->{p});
   
 


   if ( $o->{P} ){
   
      my $pod;
      map{ $pod.="=head2 $_()\n\n" } @$subs;

      print "\n@$subs\n\n\n$pod\n";
   }
   else {
   
      printf "%s\n", join("\n", @$subs);
   }
  

}




=pod

=head1 NAME

pmsubs

=head1 DESCRIPTION

prints to screen all subs defined in a perl code file

=head1 OPTION FLAGS

   -p show only public methods/subs, dont show subs starting with an underscore.
   -d debug on
   -v print version and exit
   -h help
   -P list all on one line, prep pod
   
=head1 EXAMPLE USAGE

   pmsubs ./script.pl
   pmsubs ./lib/Module.pm
   pmsubs -p ./lib/Module.pm
   pmsubs -p ./lib/*pm
   

=head1 AUTHOR

Leo Charre leocharre at cpan dot org

=head1 SEE ALSO

LEOCHARRE::Dev

=cut