Chas. Owens wrote:
> On Fri, Aug 14, 2009 at 00:21, Uri Guttman<u...@stemsystems.com> wrote:
> snip
>> i started with punch cards. print was all you had besides thorough and
>> deep analysis of your code. that is a talent lost on too many coders
>> today. and even today proper use of print is better than any debug
>> tool. but it is still a skill to learn, where and what to print and how
>> to analyze the results. i have seen many good coders not get that and
>> they stick with debuggers. i find the simplicity of print and my total
>> control of what gets printed, etc better than learning more commands,
>> having to repeat a set of debug commands (yes, you can macro and preset
>> them but that is still more work), etc. print is always there in any
>> programs (and debuggers have issues with complex sets of processes, and
>> daemons and such).
> snip
> 
> I have seen the opposite: too many coders sticking with print instead
> of picking up a debugger when the situation called for one.  I tend to
> debug with a combination of looking at the code, logs, and print
> statements, but a good visual debugger can be a godsend.  

To anyone using Perl, I also highly recommend the debugger.

I was shown by people "who know who they are" on this list several
interesting things that I didn't know.

Most importantly, I was taught that I could 'watch' one or more certain
variables while stepping or breaking, so you can see what happens
live-time. This was/is invaluable to me to get an understanding of what
is really happening. I found watching changes critical to solidifying my
understanding of operator precedence:

# perl -d ./types.pl

  DB<1> w $type
  DB<2> c
Watchpoint 0:   $type changed:
    old value:  ''
    new value:  'user_info'

Much of the Perl debugger can be learnt here:

http://perldoc.perl.org/perldebtut.html
http://perldoc.perl.org/perldebug.html

Inserting a breakpoint is very easy. You can put it right in your code,
and unless you run your program with "-d", the debug code may as well be
a comment (ie, there are no visual queues that it exists). Insert a
breakpoint (breakpoint == a place where you can tell the debugger to
stop) like this:

$DB::single=2;

Then, when you run your program with -d as noted above, you can just
type 'c' in the debugger to jump right to that line of code!

...fancier things can be found by searching the archives, some of which
would probably coincide with my name in the search box (such as comments
related to the 'watch' command).

Steve

ps. just to play, I did this:

http://ipv6canada.com/age.debug

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to