SPUG: die from BEGIN; how suppress ugly message?
Tim Maher/CONSULTIX
tim at consultix-inc.com
Wed Jan 26 18:16:33 CST 2000
On Wed, Jan 26, 2000 at 02:59:39PM -0800, Charles DeRykus wrote:
> > open STDERR, ">/dev/null"
>
> If I catch your meaning, could you simply wrap
> the BEGIN innards in an eval... ?
>
> BEGIN { eval { print "foo\n"; die "bar" }; }
>
> Any fatals will be trapped and available in $@
> when the BEGIN block terminates.
- Been there, tried that (before posting)
As I said, if you have -n/-p turned on, you can't test
$@ to decide what to do about the trapped exception
until after you get a line of input!
And you *really need* BEGIN when using -n/-p, otherwise
everything is in the implicit input-reading loop!
Hence my desire for another solution to suppressing
errors within BEGIN, and I'm happy with the
redirection to /dev/null idea.
Thanks,
-Tim
>
> Hope this helps,
> --
> Charles DeRykus
--
*========================================================================*
| Tim Maher, PhD Consultix & (206) 781-UNIX/8649 |
| Pacific Software Gurus, Inc Email: tim at consultix-inc.com |
| UNIX/Linux & Perl Training http://www.consultix-inc.com |
| 2/22: UNIX 2/28: Perl Modules 2/29: Int. Perl 3/3: Pattern Matching |
*========================================================================*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list