The original reason I wrote this module is because I was creating a very large multi-module application, and wanted a quick way to search through all functions/methods to see what needed tending to. I'd always be consistent like #bug 135 or #FIXME: blah. This method of use of the module will print out all sub names that contain a particular search term.
Here's an example of that and some sample output. I ran it something like this:
$ ./des.pl search_term
Output:
business-isp/lib/Business/ISP/Ledger.pm:
invoice_number
_gledger_write_legacy
business-isp/lib/Business/ISP/User.pm:
add_notes
business-isp/lib/Business/ISP/Conversion.pm:
plans_inf_to_db
business-isp/lib/Business/ISP/Reports.pm:
renewal_notices
business-isp/lib/Business/ISP/GUI/Accounting.pm:
home
process_purchase
perform_find
show_plan
setup
confirm_purchase
Code:
#!/usr/bin/perl
use warnings;
use strict;
use 5.18.0;
use Devel::Examine::Subs;
use File::Find;
my $des = Devel::Examine::Subs->new();
my $search = $ARGV[0];
find({ wanted => \&check_subs, no_chdir => 1 },
'business-isp/lib/Business/ISP'
);
sub check_subs {
if (! -f or ! /(?:\.pm|\.pl)$/){
return;
}
my $file = "$File::Find::name";
my @has = $des->has({file => $file, search => $search});
return if ! @has;
say "\n$file:" ;
say "\t$_" for @has;
}
-stevieb |