X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=scripts%2Fprint.pl;h=701447eb197b09c593b69229f619c49d8d05dffb;hb=ed944d253a48a840fc899c25a3625739ba0158fc;hp=2336bba6a4e5f66eed6d99babed670df5e31ed78;hpb=6326f4b9c01e7a25a9d98a0d2e0e3b803f27f3d4;p=Biblio-RFID.git diff --git a/scripts/print.pl b/scripts/print.pl index 2336bba..701447e 100755 --- a/scripts/print.pl +++ b/scripts/print.pl @@ -82,10 +82,19 @@ sub iso_date { } sub print_card; +sub render_card; my $log_path = "$log_print/" . iso_date . ".txt"; die "$log_path exists" if -e $log_path; -open(my $log, '>', $log_path) || die "$log_path: $!"; + +sub write_log { + my ( $tag, $number ) = @_; + open(my $log, '>', $log_path) || die "$log_path: $!"; + my $date = iso_date; + print $log "$date,$tag,$number\n"; + close($log); + print "LOG $date $tag $number\n"; +} while ( $rfid->tags ) { print "ERROR: remove all tags from output printer tray\n"; @@ -116,7 +125,7 @@ do { sleep 1; } - print $log iso_date, ",$tag,$number\n"; + write_log $tag => $number; $programmed->{$tag} = $number; render_card; # pre-render next one @@ -157,7 +166,6 @@ sub print_card { if ( ! @queue ) { print "QUEUE EMPTY - printing finished\n"; - close($log); print "$log_path ", -s $log_path, " bytes created\n"; exit; }