in reply to capturing STDERR within a script
The solution is, as has been pointd out, to redefine the WARN signal handler.
To redirect warnings for the command
I simply created a subroutine:my $allofit = buildData(\%Edina::SSR::Common::everything);
and called it with:sub makeData { my @warns = (); local $SIG{__WARN__} = sub { push @warns, @_; }; my $allofit = buildData(\%Edina::SSR::Common::everything); return ($allofit, \@warns); }
then the value of $error->... can be tested for any warningsmy ($allofit, $error) = makeData();
|
|---|