Running perl -d on code with eval turns off debugger? 
Author Message
 Running perl -d on code with eval turns off debugger?

I've been testing a module by using perl -d and stepping through the code.
In several places, I use the eval / die technique to catch exceptions in
functions I've written.  Usually, I just intercept the die() in the function
and die with another, perhaps more informative, message like this:

    eval { read_data() };

Occasionally, though, I want to continue running after catching the
exception, instead of die()ing:

    eval { read_data() };

    # continue running

If I step across the read_data() function in the first example, the de{*filter*}
stops on the second line (the die() command).  However, if I step across the
read_data() in the second example, the de{*filter*} keeps running past the
print() statement to the end of the script, as though the de{*filter*} was
turned off.  Is this the way the de{*filter*} is supposed to work on eval, or am
I doing something wrong?

Thanks,

Brett Denner



Tue, 24 Jul 2001 03:00:00 GMT  
 Running perl -d on code with eval turns off debugger?
[A complimentary Cc of this posting was sent to Brett Denner


Quote:
>     eval { read_data() };

>     # continue running

> If I step across the

Step across???

Quote:
> read_data() in the second example, the de{*filter*} keeps running past the
> print() statement to the end of the script, as though the de{*filter*} was
> turned off.  Is this the way the de{*filter*} is supposed to work on eval, or am
> I doing something wrong?

De{*filter*} is supposed to work fine.  Having an short example we can may
help you a lot.

Ilya



Tue, 24 Jul 2001 03:00:00 GMT  
 Running perl -d on code with eval turns off debugger?

Quote:

>I've been testing a module by using perl -d and stepping through the code.
>In several places, I use the eval / die technique to catch exceptions in
>functions I've written.  Usually, I just intercept the die() in the function
>and die with another, perhaps more informative, message like this:

>    eval { read_data() };

>Occasionally, though, I want to continue running after catching the
>exception, instead of die()ing:

>    eval { read_data() };

>    # continue running

>If I step across the read_data() function in the first example, the de{*filter*}
>stops on the second line (the die() command).  However, if I step across the
>read_data() in the second example, the de{*filter*} keeps running past the
>print() statement to the end of the script, as though the de{*filter*} was
>turned off.  Is this the way the de{*filter*} is supposed to work on eval, or am
>I doing something wrong?

I see the same behaviour in both cases  -  it doesn't stop on either the
die() or on the print.    In both cases, you can stop it by using an
explicit breakpoint.

If you put a print statement

     print "Single $DB::single\n";

immediately after the eval{}, it shows that the single step flag is
getting reset, so it runs on to the end of the program.    This happens
when stepping with "n".    Stepping with "s" works OK.

And it doesn't fail if the subroutine call in the eval{} is replaced
by a print.

Clearly a bug in the de{*filter*}.

Mike Guy



Tue, 24 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Turning debugger tracing on/off under program control

2. turning on Tk running option in the command line debugger

3. Turn off tear-off menu's?

4. turning off echo (password) os/2 perl / oraperl

5. Turning off cashing from Perl???

6. How to turn off cashing in perl???

7. how to turn off cashing in perl.???

8. how to turn off cashing in perl???

9. Turning off echoing under NT

10. Turning off DBM caching

11. Turning off autosplitting

12. How to turn off autocommit

 

 
Powered by phpBB® Forum Software