Archived
1
0

Display important warnings on process return

This commit is contained in:
Mercier Pierre-Olivier 2013-11-13 01:12:05 +01:00
parent 4e35cabf62
commit c5a1bf8917

View File

@ -62,9 +62,9 @@ sub do_work ($$$@)
my $sax_handler = ProcessHandler->new($args); my $sax_handler = ProcessHandler->new($args);
my $parser = XML::SAX::ParserFactory->parser( Handler => $sax_handler ); my $parser = XML::SAX::ParserFactory->parser( Handler => $sax_handler );
my $ret; my @retW;
eval { eval {
$SIG{'__WARN__'} = sub { log WARN, $_[0]; $ret .= ">>> ".$_[0]."\n"; }; $SIG{'__WARN__'} = sub { log WARN, $_[0]; push @retW, $_[0]; };
$parser->parse_string(${ $_[0]{argref} }); $parser->parse_string(${ $_[0]{argref} });
}; };
@ -74,14 +74,17 @@ sub do_work ($$$@)
return $err; return $err;
} }
my $ret;
eval { eval {
$ret = $subref->($given_args, $args); $ret = $subref->($given_args, $args);
}; };
if ($@) { if ($@) {
my $err = $@; my $err = $@;
log ERROR, $err; log ERROR, $err;
return $err; $ret = $err;
} }
$ret .= ">>> ".$_."\n" foreach (@retW);
return $ret; return $ret;
} }