NAME

LEOCHARRE::PMSubs - find out what subroutines and or methods are defined in perl code

SYNOPSIS

use LEOCHARRE::PMSubs 'subs_defined';

my $codefile = './lib/Module.pm';
my $subs = subs_defined($codefile);

map { print STDERR "$codefile : $_\n" } @$subs;   

DESCRIPTION

This works via regexes and is not perfect, but quick. This is useful for devel purposes.

API

subs_defined()

argument is abs path to perl code file returns array ref of subs defined in file optional argument is boolean, if to include only public methods, methods that do not begin with underscore. default is 0, all subs/methods.

if no file argument, throws exception if file does not exist, warns and returns []

_subs_defined()

argument is code text returns array ref

optional argument is boolean, if to include only public methods, methods that do not begin with underscore.

if no code, warns and returns [].

_subs_used()

argument is code text for curiosity returns hash ref with subs used and count of times

CAVEAT: needs to be worked out for kinks

subs_used()

argument is abs path to code file returns hash ref with subs used and count of times

CLI

See bin/pmsubs included in this distro.

AUTHOR

Leo Charre leocharre at cpan dot org

SEE ALSO

LEOCHARRE::PMUsed LEOCHARRE::Dev