in reply to 5.10 shows uninitialized $@ warning
Like Burak and like I already said, I can't replicate your behaviour.
However, it is possible for $@ to get cleared. For example, if you have an object that gets destroyed in the eval and it uses eval in its destructor, $@ would get cleared. That's why you shouldn't rely on $@ being set to detect an exception.
my $result; if (!eval { ... $result = ...; 1; }) { die("Unable to ...: $@\n"); }
That said, I'd like to present a better solution to your initial problem. I propose there's a bug in your global __DIE__ handler. It should check $^S just rethrow the exception if it's true.
local $SIG{'__DIE__'} = sub { die($@) if $^S; ... };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 5.10 shows uninitialized $@ warning
by pmSwim (Acolyte) on May 16, 2008 at 16:00 UTC | |
by starbolin (Hermit) on May 16, 2008 at 17:14 UTC | |
by pmSwim (Acolyte) on May 16, 2008 at 17:59 UTC | |
by ikegami (Patriarch) on May 16, 2008 at 18:52 UTC |