On 5 Mar 2003 06:02:33 -0000, perlbug-followup@perl.org wrote: >On Mon, Feb 10, 2003 at 08:44:08PM -0000, Yitzchak Scott-Thoennes wrote: >> BEGIN { local $@; die 'foo' } seems to bail out of the BEGIN, but doesn't >> actually die, as if the BEGIN was an eval. > >The code in Perl_call_list checks for the length of ERRGV ( aka $@ ), >and if this is zero, thinks all is OK and continues running the >script. >(see perl.c:3958). I will take a look when I get a chance. >There is no other way to catch an exception than checking if ERRGV isn't >clear. Localizing it makes, of course, any exception un-catchable. Not sure what you mean by catch/un-catchable here. Maybe it will be clear when I look at the code. >Are there any documentation that suggests that > BEGIN { local $@; die ' ... ' } >should die silently or something like that ? Not that I can find. >I ask it because many core modules seems to assume it and it actually >_never_ worked like that. That assumption seems to cause lots of >problems. AFAICT from the documentation, the local should have *no* effect on the die, and the die should end the program (unless the BEGIN block is in a string eval, of course.)Thread Previous | Thread Next