Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Logging functions as they are called

by Anonymous Monk
on Sep 21, 2006 at 18:47 UTC ( [id://574224]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've got a CGI webapp that is starting to grow

Right now it has some elementary debugging support--
sub x{ my ($self)= @_; DEBUG_FUNCTION_NAME && MyDebugger::log_function_name( $self ); }
MyDebugger::log_function_name does all the necessary operations on caller(1) to get me the info I need.
I know some of the CPAN developer packagers have figured out ways to hook into a function as it is called. unfortunately, I haven't been able to reverse engineer how to do it
Does anyone know if its possible for me to do this in perl itself (without using xs ) : to have a specific function called per sub call ?

Replies are listed 'Best First'.
Re: Logging functions as they are called
by dave0 (Friar) on Sep 21, 2006 at 18:52 UTC
    Take a look at Devel::CallTrace -- it's probably the simplest of the call-tracing modules.
Re: Logging functions as they are called
by dtr (Scribe) on Sep 21, 2006 at 18:52 UTC

    Have a look at Sub::WrapPackages, or Hook::LexWrap. These should both help with what you're trying to do.

    Also, if you're getting into logging, you could do much worse than looking at Log::Log4perl too.

Re: Logging functions as they are called
by traveler (Parson) on Sep 21, 2006 at 21:28 UTC
    Try Aspect::Trace. It sounds like exactly what you are looking for.
Re: Logging functions as they are called
by eff_i_g (Curate) on Sep 21, 2006 at 21:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://574224]
Approved by chargrill
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-10-03 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (42 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.