Thank for your post, when I understand it correctly I would recommend the use of eval in a destructor as not so good practice. But the handler in general are not the problem. The code runs without a exception and no handler is called. What I dislike is the warning. I found a way to reproduce the warning (a
local $@), but I have no idea where this happend in the program.
Here is a longer code snippet which reproduces the warnings:
use warnings;use strict;
package What::Ever;
$@=undef;
$SIG{'__DIE__'} = sub { die "My global die: $@" }
; sub divide {
local $SIG{'__DIE__'} = sub { die $@ };
eval {
print STDERR 1/$_[0] , "\n";
}
}
; { local $@;
print STDERR "No exception:\n";
divide(1);
print STDERR "Throw...\n";
divide(0);
};
warn $@; # with this the warnings are shown // without none
but this produces the warning in 5.8 too. So I do not really know what introduces the real problem.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.