[Israel.pm] Bug in debugger?

Gabor Szabo szabgab at gmail.com
Fri Jun 12 01:25:53 PDT 2009


On Fri, Jun 12, 2009 at 9:38 AM, Peter Gordon<peter at pg-consultants.com> wrote:
> Running Perl 5.10 on Linux I get different errors depending on whether
> I am using the debugger or not. Why is the debugger giving
> incorrect/useless errors?
>
>
> Program:
> #! /usr/bin/perl
>
> use strict ;
> use warnings ;
>
> open($f,"aaa") ;
>
> Run without debugger
> perl  /tmp/a.pl
> Global symbol "$f" requires explicit package name at /tmp/a.pl line 6.
> Execution of /tmp/a.pl aborted due to compilation errors.
>
>
> Run with debugger:
> perl  -d /tmp/a.pl
>
> Loading DB routines from perl5db.pl version 1.3
> Editor support available.
>
> Enter h or `h h' for help, or `man perldebug' for more help.
>
> BEGIN not safe after errors--compilation aborted
> at /usr/lib/perl5/5.10.0/Carp/Heavy.pm line 11.
> Compilation failed in require at /usr/lib/perl5/5.10.0/Carp.pm line 33.
> Debugged program terminated.  Use q to quit or R to restart,
>  use o inhibit_exit to avoid stopping after program termination,
>  h q, h R or h o to get additional info.
>  DB<1>


In most of the languages and environments the debugger is running your code.
In Perl your code is running the debugger.

So if your code has a compile time error - such as yours - the debugger
cannot really start.

Many people who live in their IDEs tend to mash together the part that they
are trying to locate syntax errors that prevent compilation and run time
errors which is a totally different activity of debugging.
In Perl you cannot use the debugger for the former.

Still I agree that the error message that is displayed when ran with the
debugger is a confusing.

Gabor



-- 
Gabor Szabo                     http://szabgab.com/blog.html
Perl Training in Israel         http://www.pti.co.il/
Test Automation Tips        http://szabgab.com/test_automation_tips.html
Perl 6 Tricks and Treats  http://szabgab.com/perl6_tricks_and_treats.html

"He who can, does. He who cannot, teaches." - George Bernard Shaw


More information about the Perl mailing list