Hi jandrew,
I tried with IO::Callback, this din't work again. try this code use IO::Callback;
# Here's the coderef
my $code = sub {
my $str = shift;
print STDERR "This is really bad: $str";
};
# Turn it into a filehandle opened in write mode
my $fh = IO::Callback->new('>', $code);
# Select that filehandle (makes it the default for print, say, etc).
select($fh);
# Print something - it gets passed to the coderef!
print "Hello World\n";
system("date");
date output doesn't get default error meta text.
Also this has been mentioned in Bugs section
I already have a large number of pre-written scripts and trying to capture print STDERR from them, not the system generated error signals alone. So I would like to perform similar callback function for STDERR as well.
Thanks |