Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Printing source code while running

by jkao (Beadle)
on Jul 21, 2005 at 08:13 UTC ( #476744=perlquestion: print w/replies, xml ) Need Help??

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

As a lazy programmer, I want to debug without using the debugger or having to add print statements. In particular, it would be really nice if there was a way to have Perl print each line of the source code (in the package being debugged) as it runs, possibly along with the values of any variables used in that line. Something like stepping through code in the Perl debugger, except without having to step through code. Is such a thing possible?

Replies are listed 'Best First'.
Re: Printing source code while running
by davido (Cardinal) on Jul 21, 2005 at 08:18 UTC

    Something like Devel::Trace?

    It's there. You just have to look.

    The module's brief description is: "Print out each line before it is executed (like sh -x)".


    Dave

Re: Printing source code while running
by tomhukins (Curate) on Jul 21, 2005 at 09:26 UTC
    Although I like the Devel::Trace module that others have suggested, I sometimes find it too verbose. Last week I used Sub::WrapPackages to log subroutine calls within certain packages, as well as their input and output. You could also use Aspect's before and after hooks to provide similar functionality.
Re: Printing source code while running
by (anonymized user) (Curate) on Jul 21, 2005 at 08:31 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://476744]
Front-paged by polettix
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2019-10-16 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?