BTW, one should generally also local'ize $@ in any code, at least like in:

sub DESTROY {
  ...
  local $@;
  eval {
    ...
  };
  if ($@) ....

}

eval in destructors is particularly nasty, since those without 'local' wipe out $@ without giving you any chance to look at the error (short of abusing $SIG{__DIE__}):

 sub Foo::DESTROY {
    eval { }
 }

 eval {
   my $a= bless {},"Foo";
   die "Hell is loose";
   print "Heaven\n";
 };
 if ($@) {
   print "Heaven not achieved: [EMAIL PROTECTED]";
 }

will print nothing at all.

=> always, always (*) localize $@ before entering eval, or alternatively localize it in all destructors that use eval directly or might use it indirectly.

Christian.

(* at least theoretically)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to