develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [perl #57016] debugger: o warn=0 die=0 ignored

Thread Previous | Thread Next
From:
Bram
Date:
August 2, 2008 10:46
Subject:
Re: [perl #57016] debugger: o warn=0 die=0 ignored
Message ID:
20080802194555.8pq63r57i8wkcs0s@horde.wizbit.be
Citeren Tye McQueen <tye.mcqueen@gmail.com>:

> On Sat, Jul 26, 2008 at 11:30 AM, Bram via RT   
> <perlbug-followup@perl.org>wrote:
>
>> Thanks for the bug report/patch.
>>
>> Can you also provide an example of where it doesn't behave as you
>> expected?
>>
>
> Um, just start the debugger, type "o warn=0 die=0" and then use warn or die
> and notice that lots of extraneous stack trace is still displayed.
>
> If you are unable to notice the difference, then just simulate what it
> should do via:
>
> $SIG{__WARN__}= $SIG{__DIE__}= 0
>
> and then try warn/die and see how unadorned the output is.

I see.

A small note tho: o warnLevel 0  is not intended to simulate  
$SIG{__WARN__} = 0.

What it is supposed to do is restore the previously set warning handler.

Currently if no previously handler is set then  o warnLevel 0  is a NUL op.

I also feel that this is not very useful (but I don't use -d very  
often) and that your patch should be applied.


>
> Note that I've verified that this is broken in standard 5.8.7, 5.8.8, and
> 5.10.  However, Strawberry Perl 5.8.8 appears to have patched this to fix it
> and also to set the default warnLevel to 0 instead of to 1, as shown below.
> Does it really take this long for patches to arrive from Strawberry or just
> for them to get applied?

Note that you can set the default options via an rc file. (look at  
perldoc perl5db for more information).

> Oh, the Strawberry Perl fix is simpler than the fix I proposed, just replace
> the "elsif"s with plain "else"s:
>
> sub warnLevel {
>     if (@_) {
>         $prevwarn = $SIG{__WARN__} unless $warnLevel;
>         $warnLevel = shift;
>         if ($warnLevel) {
>             $SIG{__WARN__} = \&DB::dbwarn;
>         }
>         else {
>             $SIG{__WARN__} = $prevwarn;
>         }
>     } ## end if (@_)
>     $warnLevel;
> } ## end sub warnLevel

May I ask at what Strawberry Perl you are looking?

I just downloaded Strawberry Perl 5.10.0.1 and Strawberry Perl 5.8.8.1  
and both have:

sub warnLevel {
     if (@_) {
         $prevwarn = $SIG{__WARN__} unless $warnLevel;
         $warnLevel = shift;
         if ($warnLevel) {
             $SIG{__WARN__} = \&DB::dbwarn;
         }
         elsif ($prevwarn) {
             $SIG{__WARN__} = $prevwarn;
         }
     } ## end if (@_)
     $warnLevel;
} ## end sub warnLevel



Kind regards,

Bram



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About