edwardt_tril has asked for the wisdom of the Perl Monks concerning the following question:
commonRoutine.pmuse B; sub LogMe{ #calling other subroutines and do a lot of stuff print "logme is called\n"; B->new; B->_func2; };
EntryPoint.pl:package commonRoutine; sub new { my ($class, $cacheFileName) = @_; my $this = bless({}, ref($class) || $class); # Initialize member variables. $this->{initialized} = 1; $this->{lastFlushTime} = time(); return $this; } ## # Destructor. Clean up object. # sub DESTROY { my $this = shift; $this->_func2(); } sub _func3{ print "me\n"; } 1
A.pm:use A; use commonRoutine; do ('LogMe.pl'); sub enter{ A->new; commonRoutine->new; }
B.pmpackage A; use strict; use B; use commonRoutine; do ('LogMe.pl'); ## # Constructor. Initialize instance of object. # # @param $cacheFileName [in] Name of cache file. # # @return Instance of object or undef if failure. # sub new { print "A->new()\n"; my ($class, $cacheFileName) = @_; my $this = bless({}, ref($class) || $class); # Initialize member variables. $this->{initialized} = 1; $this->{lastFlushTime} = time(); $this->_func1(); return $this; } ## # Destructor. Clean up object. # sub DESTROY { my $this = shift; } sub _func1{ LogMe(); print "me\n"; } 1
package B sub new { my ($class, $cacheFileName) = @_; my $this = bless({}, ref($class) || $class); # Initialize member variables. $this->{initialized} = 1; $this->{lastFlushTime} = time(); $this->_func2(); return $this; } ## # Destructor. Clean up object. # sub DESTROY { my $this = shift; $this->_func2(); } sub _func2{ print "me\n"; } 1
Edit: g0n - readmore tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: profiling a subset of subroutines inside multiple perl scripts through 1 entry point script
by salva (Canon) on Feb 09, 2006 at 09:44 UTC |