Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Module for Printing Line Numbers in Debug?

by LanX (Canon)
on Jan 21, 2013 at 12:36 UTC ( #1014435=note: print w/ replies, xml ) Need Help??


in reply to Module for Printing Line Numbers in Debug?

Did you consider using the debugger?

It has some nifty trace options!

EDIT:

Also have a look into Carp.

Cheers Rolf


Comment on Re: Module for Printing Line Numbers in Debug?
Re^2: Module for Printing Line Numbers in Debug?
by QM (Vicar) on Jan 21, 2013 at 13:23 UTC
    perldebug might work, but I can't figure out how to run a script non-interactively to do a trace with line numbers.

    I forgot to mention that this is running on a remote system, using a custom script to tar up everything needed, copy it over, run it, and pipe the output back to the originating terminal. It's a PITA to do this manually.

    It's also a requirement to run on the remote system, as custom devices and other hardware are there (these are formal test scripts).

    I'm quite familiar with the interactive use of the debugger, and would prefer to do that, but it's much easier to s/// the code and print line numbers. (OP updated).

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      I googled trace perl and found perl option to trace execution.

      Devel::Trace seems to be what you are looking for.

      EDIT: It's not clear for me if you wanna trace all lines or just some. In the latter case why not defining a function log() which carps what you want only if DEBUG is set?

      Cheers Rolf

        Devel::Trace might do it, but it's not installed on the system. Might be problematic to get it on there. (Ubuntu apt-get name?)

        I don't need to trace all the lines, but if that's necessary, I can live with it.

        I can already put a function or statement wherever I want, so a log() function would do the same, but would be a lot shorter than the literal statement. A good idea, I was hoping for something even cleaner, that won't show up in production code by mistake.

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-18 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls