Reputation: 4253
In some project ( Mason ) there is a lot of perl modules (> 200). Really used only 5-10% from this code. How i can look, which subroutines is used (or unused)?
Upvotes: 4
Views: 655
Reputation: 126
Consider to start using Perl::Critic
from the command line:
perlcritic --single-policy=UnusedPrivateSubroutines --verbose 2 ./*.pl
You will get a list of the unused subroutines. To list unused variables:
perlcritic --single-policy=UnusedVariables --verbose 2 /root/*.pl
To audit your whole "mason" project for unused subroutines, something like
cat *.pl > all-perl-files.pl
and using again percritic
on the all-perl-files.pl
may give you an initial list. That's because if the same subroutine's name is declared in more than one file and got used somewhere in your project, it may get masked out of your unused list.
Upvotes: 4
Reputation: 27588
In addition to choroba's link, you can use a profiler to show what subroutines are called (how many times and how long they took):
Upvotes: 4