6 use Data::Dump qw(dump);
9 use Biblio::RFID::Reader;
10 use Biblio::RFID::RFID501;
19 'reader=s', => \$reader,
22 'set=i' => \$hash->{set},
23 'total=i', => \$hash->{total},
24 'type=i', => \$hash->{type},
25 'branch=i', => \$hash->{branch},
26 'library=i' => \$hash->{library},
27 '3mblank' => \$blank->{blank_3m},
28 'blank' => \$blank->{blank},
31 my ( $sid, $content ) = @ARGV;
32 die "usage: $0 [--reader regex_filter] [--afi 214] [--type 1] E0_RFID_SID [barcode]\n" unless $sid && ( $content || $afi || $blank );
34 $hash->{content} = $content if defined $content;
36 my $rfid = Biblio::RFID::Reader->new( $reader );
37 $Biblio::RFID::debug = $debug;
39 foreach my $tag ( $rfid->tags, $sid ) {
40 warn "visible $tag\n";
41 # next unless $tag eq $sid;
42 if ( grep { defined $_ } values %$blank ) {
43 my $type = ( grep { $blank->{$_} } keys %$blank )[0];
44 warn "BLANK $type $tag\n";
45 $rfid->write_blocks( $tag => Biblio::RFID::RFID501->$type );
46 } elsif ( $content ) {
47 warn "PROGRAM $tag with $content\n";
48 $rfid->write_blocks( $tag => Biblio::RFID::RFID501->from_hash($hash) );
51 warn "AFI $tag with $afi\n";
52 $rfid->write_afi( $tag => chr($afi) );