Archived
1
0

Fix warning order in process return

This commit is contained in:
Mercier Pierre-Olivier 2013-11-13 01:29:53 +01:00
parent bdef5a3c69
commit 4a66e85060

View File

@ -62,10 +62,7 @@ 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 @retW;
eval { eval {
$SIG{'__WARN__'} = sub { log WARN, $_[0]; push @retW, $_[0]; };
$parser->parse_string(${ $_[0]{argref} }); $parser->parse_string(${ $_[0]{argref} });
}; };
if ($@) { if ($@) {
@ -74,17 +71,18 @@ sub do_work ($$$@)
return $err; return $err;
} }
my $ret; my $ret = "";
eval { eval {
$ret = $subref->($given_args, $args); $SIG{'__WARN__'} = sub { log WARN, $_[0]; $ret .= ">>> ".$_[0 ]; };
$ret .= $subref->($given_args, $args);
}; };
if ($@) { if ($@) {
my $err = $@; my $err = $@;
log ERROR, $err; log ERROR, $err;
$ret = $err; $ret .= $err;
} }
$ret .= ">>> ".$_."\n" foreach (@retW);
return $ret; return $ret;
} }