> From: Steve Bertrand [mailto:st...@ibctech.ca] > Hi everyone, > > I'm curious to know if there is an easy way to scan a list of module > files and identify how many subs are calling a different specific sub. > > I've got a method that must be called once by each and every > sub within > the module. I want to ensure I haven't forgot to include its call > without having to manually read the code. > > Is this possible? > > Steve
you might want to have a look at the profiling module Devel::NYTProf It's capable of switching between line / block / sub profiling you can use it with the -d parameter perl -d:NYTProf script.pl the Shebang line #!/usr/bin/perl -d:NYTProf or set the PERL5DB ENV variable to PERL5DB='use Devel::NYTProf' it will produce output in CSV or HTNL format. there are 2 coming with the module: nytprofcsv and nytprofhtml e.g. to convert the profiling data to CSV use: nytprofcsv -f nytprof.out it shows you - "Calls": how often a subroutine was called - "P": from which places in the code the subroutine was called - "F": out of which files the subroutine was called - "Exclusive Time": time the subroutine needed, exclusive subroutine calls from within it - "Inclusive Time": time, the subroutine needen, inclusive subroutine calls from within it example script.pl #!/usr/bin/perl use strict; use warnings; use B (); test(); B::walkoptree( B::main_root(), 'debug'); sub test { my $a = 3; } sub UNIVERSAL::debug { print $_[0]->name,"\n"; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/