X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=scripts%2Fprogram.pl;fp=scripts%2Fprogram.pl;h=d7d5629cdf0ca04654385f8f0509668736dac7f8;hb=8722c748f1fe0386819b8bda89dbefcea6e332ab;hp=f15dfa836b939eb5e73d37d043e256678061316a;hpb=d40a3f466cf74dd63810d6f1b198ba72fbbc0107;p=Biblio-RFID.git diff --git a/scripts/program.pl b/scripts/program.pl index f15dfa8..d7d5629 100755 --- a/scripts/program.pl +++ b/scripts/program.pl @@ -9,23 +9,23 @@ use lib 'lib'; use RFID::Biblio::Readers; use RFID::Biblio::RFID501; -my $only; +my $reader; GetOptions( - 'only=s', => \$only, + 'reader=s', => \$reader, ) || die $!; my ( $sid, $content ) = @ARGV; -die "usage: $0 E0_RFID_SID content\n" unless $sid && $content; +die "usage: $0 [--reader regex_filter] [--afi 214] E0_RFID_SID [barcode]\n" unless $sid && ( $content | $afi ); -my @rfid = RFID::Biblio::Readers->available( $only ); +my @rfid = RFID::Biblio::Readers->available( $reader ); foreach my $rfid ( @rfid ) { my $visible = $rfid->scan; foreach my $tag ( keys %$visible ) { next unless $tag eq $sid; warn "PROGRAM $tag with $content\n"; - $rfid->write_blocks( $tag, RFID::Biblio::RFID501->from_hash({ content => $content }) ); + $rfid->write_blocks( $tag => RFID::Biblio::RFID501->from_hash({ content => $content }) ); } }