Archived
1
0

Display warnings on process return

This commit is contained in:
Mercier Pierre-Olivier 2013-11-13 01:01:04 +01:00
parent 0e92592d17
commit 4e35cabf62
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -215,7 +215,7 @@ sub grades_new_bonus
if (-e "$basedir/$year/$project_id/traces/bonus/$login.xml") { if (-e "$basedir/$year/$project_id/traces/bonus/$login.xml") {
open my $xml, "<", "$basedir/$year/$project_id/traces/bonus/$login.xml" or die $!; open my $xml, "<", "$basedir/$year/$project_id/traces/bonus/$login.xml" or die $!;
binmode $xml; binmode $xml;
$trace = Trace->new($xml); $trace = Trace->new(join '', <$xml>);
close $xml; close $xml;
} }
elsif ($delete) { elsif ($delete) {
@ -242,7 +242,7 @@ sub grades_new_bonus
close $xml; close $xml;
} }
else { else {
log WARN, "Invalid login $line, line skiped"; warn "Invalid login $line, line skiped";
} }
} }
} }