The following code catches all print operations on the STDERR file handle.
package ErrorTrapper;
sub TIEHANDLE{
my ($class, $file) = @_;
bless [] , $class;
}
sub PRINT{
my ($self, @msg) = @_;
die "@msg\n";
}
package main;
tie *STDERR, "ErrorTrapper";
print "Testing...\n\n";
print STDERR "Something went wrong!\n";
print "Shouldn't see this";
Cheers,John
In reply to Re: Catch messages to STDERR
by raptnor2
in thread Catch messages to STDERR
by Räuber Hotzenplotz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |