Using a debugger for Perl or Php
I'm curious. I've seen people mention that they use a debugger for Perl. I saw a guy start a perl script in a debugger and he was a smart guy (had once worked at the JPL and he had just published a book) but I left the company before I ever asked him about it. I've never used a debugger. I do Perl and PHP. I cannot imagine the use of a debugger for either of those languages. I wonder if I'm missing something that could make my life easier. Is it useful for code you have not written (the guy above was using it in this situation) ... for me I just do a syntax check for errors. Thanks.
son of parnas
PHPedit comes w/ a debugger. It's usually easier to use print statements, but once in a while its a lifesaver.
What I don't understand is what a debugger would give someone for Perl or PHP. 99.9% of the time if your script passes a syntax check it will run. Anything that is then "wrong" with it is something that I reckon you need to read the code in relation to the requirements. I wonder if I have a script which includes other files as in OO or just modular then perhaps the debugger will load those ... but how does it spark events? And even then ... what can I really give me that I would not get from reading the code?
Well, part of me agrees with you. If you have absolute confidence in your understanding of a language (any language), why would you ever need a debugger? Just dry-running the code by eye should show you where the mistake is.
While acknowledging that one *shouldn't* need a debugger for PHP, I've used one and quite liked it. As a previous poster said, occasionally it's a life saver. Not just for syntax that won't compile -- the error messages that PHP spits out are usually sufficient for that -- but once in awhile to track down why some value isn't getting stuffed where you think it is. I don't have a lot of experience with "traditional," compiled languages, but I would imagine the same argument could be made -- you can get by without a debugger, but heck, if it's there it ain't going to hurt.
Um, I've been writing Perl code for years now and I've *never* used the Perl debugger. How on earth does it help you?
Apparently you've never had to deal with less-than-perfect code written by others. The debugger is a godsend here.
Even if you're the perfect runtime engine for a particular language debuggers are useful for running them v-e-r-y s-l-o-w-l-y.
> How on earth does it help you?
son of parnas
Wow, discussions like this make me think there really are two kinds of programmers -- those that think they never make mistakes, and those that think they do occasionally make mistakes.
For the record i make plenty of mistakes. The
son of parnas
Hey, I never said I don't make mistakes! I just don't see what on earth a debugger could offer you over print(), especially since Perl usually gives you nice, descriptive error messages, and with a few debugging print()s sprinkled about, it's not hard to find most bugs.
Fog Creek Home