Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've been a professional Perl hacker for the past five years, and a very amateurish amateur before that. Over the years my skills have improved tremendously (when I started my first fulltime job, I didn't know how to use references, for example.) I have proceeded from simple utility scripts to large OO systems, mod_perl, giant database frontends, daemons, simulators, GUI applications and all manner of miscellany, but I can't recall ever using the Perl debugger. In fact, I know almost nothing about it. It has been my attitude that print is the most useful debugging tool, especially when coupled with Data::Dumper. If something goes wrong, I sprinke some prints here and there and watch the program flow. I spit out variables and instance data to make sure they are what I think they should be. If it's a daemon or background process, I log the debugging messages somewhere where I can look at them later. If it's a web-app, I like to send a <pre> tag with some Dumper output so I can view the data right there in the rendered template.

I think there's perhaps two possible explanations for my not using the debugger.

  1. Perl is just so damn easy, and when you're running with strict and warnings, and avoiding common pitfalls, it's difficult to run into a problem so horrendous that the above methods can't solve it.

  2. I am simply not working on challenging enough projects, and the things I do are at such a rudimentary level that debugger-worthy problems simply don't arise.

Naturally the second possibility causes me some concern. I want to continue learning as much as possible, and if I have stagnated I haven't even realized it until I started this meditation.

So I'm interested in hearing the experiences of other Monks vis a vis Perl debugging techniques. Are there instances when the Perl debugger is invaluable, and mere printing or logging will not suffice? Are there times when you must step through a program, instead of narrowing down the problem to a few lines of code and spitting out the potentially broken variables? Or have you found that while my methods may work fine, using the debugger is easier or more efficient?

Eagerly awaiting your replies,

friedo


In reply to I never use the debugger. by friedo

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: (2)
As of 2024-04-26 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found