Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I came from a C/Fortran/Pascal background too. During the first week I was learning Perl, (in 1999) a colleague told me to use perl -d for debugging and to then type h for a list of commands. So I learnt to use the debugger before I even knew what a hash was. I just can't imagine life without it. The "burning" features I use the most are:

- setting breakpoints to be able to go to the (sometimes complex) problem line and sit there examining all the pieces of the expression until I find the culprit.

- setting watchpoints so that when you don't know where the problem line is where you would be putting a printf, you can get the debugger to stop just before it is about to modify something, wherever that might be and print out the before and after values, giving you control back to look further.

- assigning values at different points to force the path of execution to get to where you need it rather than waiting for the program to follow its "natural" course, which could be hours or days in extreme cases.

- using CPAN and core modules, it is not always practical to put in print statements - the debugger is a lot easier than having to make modifications to code, it might also be dangerous to change published code you don't understand - and it can often be rather geeky!!

Update: I once had to work in an environment where no predecessor had ever used the debugger. Their heavy-handed but functionally useful logging routines made it impossible to use the debugger. This meant they had to spend a lot of time in the early life of the system resetting the situation at both ends of the system and re-running with logging calls, where the debugger could have reduced it to a single run.

-M

Free your mind


In reply to Re: Using the Perl Debugger (-d) by Moron
in thread Using the Perl Debugger (-d) by Melly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-06-24 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    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.