in reply to BEGIN and die(), an ugly combination

Kinda kludgy, but you could print to STDERR and use POSIX::_exit to bail immediately rather than using die.

Update: Yes, the point of POSIX::_exit was that it works all the way back to 5.005_03.

$ /usr/bin/perl5.00503 -MPOSIX=_exit -e 'BEGIN { print STDERR "Floobl +e!\n"; _exit( 1 ); } print "zorch\n"' Flooble! $

Replies are listed 'Best First'.
Re: Re: BEGIN and die(), an ugly combination
by samtregar (Abbot) on Feb 06, 2004 at 17:59 UTC
    That's a good idea. You're suggesting POSIX::_exit() because exit() will also produce the BEGIN failure error, right?

    -sam

      When I try it, exit() doesn't give the extra BEGIN failed messages, so using warn/exit will probably do what you want (unless multithreading).