X-Git-Url: http://git.shiar.net/perl/schtarr.git/blobdiff_plain/805e43e4a719b58c3bda97381fa022f2e6a41239..3e6134cf2cdf211443c23df28b4e310202875875:/pvpgnreport diff --git a/pvpgnreport b/pvpgnreport index 6d601f6..049ffb2 100755 --- a/pvpgnreport +++ b/pvpgnreport @@ -62,8 +62,9 @@ sub reportplayers { return \@player; } -my $name = $ARGV[0] or die "Usage: $0 FILE\n"; -open my $reportfile, '<', "$name.txt" or die "No report file: $!\n"; +my $path = $ARGV[0] or die "Usage: $0 FILE\n"; +my ($name) = $path =~ m{([^/]+)$}; +open my $reportfile, '<', "$path.txt" or die "No report file: $!\n"; my $report = reporthead($reportfile); print Dumper $report if $DBG; @@ -105,7 +106,9 @@ $Db->insert("game", { start => time2str('%Y-%m-%d %X', $start), duration => sprintf('%d seconds', $end - $start), })->rows or die "Game insert failed: ".$Db->error."\n"; -my $gameid = $Db->last_insert_id((undef) x 4, {sequence => "game_id_seq"}); +my $gameid = $Db->last_insert_id((undef) x 4, {sequence => "game_id_seq"}) + or die "Couldn't find our game insertion: ".$Db->error."\n"; +print "Game inserted as # $gameid\n"; $Db->insert("play", { game => $gameid,