2dbe62c83ee9184032ce415bbc9213d4e6f890ad
[Biblio-RFID.git] / lib / RFID / Biblio / librfid.pm
1 package RFID::Biblio::librfid;
2
3 use warnings;
4 use strict;
5
6 use base 'RFID::Biblio';
7 use RFID::Biblio;
8
9 =head1 NAME
10
11 RFID::Biblio::librfid - execute librfid-tool
12
13 =head2 DESCRIPTION
14
15 This is wrapper around C<librfid-tool> from
16
17 L<http://openmrtd.org/projects/librfid/>
18
19 =cut
20
21 sub serial_settings {} # don't open serial
22
23 our $tool = '/rest/cvs/librfid/utils/librfid-tool';
24
25 sub init {
26         warn "# no $tool found\n" if ! -e $tool;
27 }
28
29 sub inventory {
30
31         my @tags; 
32
33         open(my $s, '-|', "$tool --scan") || die $!;
34         while(<$s>) {
35                 chomp;
36                 warn "## $_\n";
37                 if ( m/success.+:\s+(.+)/ ) {
38                         push @tags, $1;
39                 }
40         }
41
42         return @tags;
43 }
44
45
46 1