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

It is possible simply to warn() and exit() - this will avoid additional messages for perl-5.6.0 and later:

zen% /opt/perl5.005_03/bin/perl -wle 'BEGIN { warn "foo\n"; exit 1; }'
foo
Callback called exit at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
zen% /opt/perl-5.6.0/bin/perl -wle 'BEGIN { warn "foo\n"; exit 1; }'
foo
zen% 

Hugo

  • Comment on Re: BEGIN and die(), an ugly combination

Replies are listed 'Best First'.
Re: Re: BEGIN and die(), an ugly combination
by samtregar (Abbot) on Feb 06, 2004 at 18:32 UTC
    *ding ding ding* We have a winner. Not quite as concise as die(), but much better than print STDERR and POSIX!

    Thanks! -sam