What I need to do is capture those error(s), print a copy to stdout (which along with stderr is re-directed to my logfile) and save a copy in a variable that I can then use elsewhere.
Right. I think I'd choose grep for that one. Replace my last line above with these:
my @errors = grep { defined && length } $trap->die, $trap->stderr, $tr +ap->stdout; print "Error: $_\n" for @errors; # any and all error(s) are now left in @errors
Update: Oh, and "logfile"? Is this for production, not just testing? Then I'd definitely get Test::Trap version 0.1.0 — it fixes, among other things, a bug that in this case might slowly fill up your /tmp partition. Oops.
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
In reply to Re^3: Trap the error msg from Mime::Lite
by Sidhekin
in thread Trap the error msg from Mime::Lite
by chrism01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |