File Coverage

lib/Biblio/RFID/Reader/API.pm
Criterion Covered Total %
statement 10 10 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 15 16 93.7


line stmt bran cond sub pod time code
1             package Biblio::RFID::Reader::API;
2              
3 2     2   1168 use warnings;
  2         5  
  2         57  
4 2     2   10 use strict;
  2         3  
  2         198  
5              
6             =head1 NAME
7              
8             Biblio::RFID::Reader::API - low-level RFID reader documentation
9              
10             =cut
11              
12             =head1 MANDATORY METHODS
13              
14             Each reader must implement following hooks as sub-classes.
15              
16             =head2 init
17              
18             $self->init;
19              
20             =head2 inventory
21              
22             my @tags = $self->invetory;
23              
24             =head2 read_blocks
25              
26             my $hash = $self->read_blocks( $tag );
27              
28             All blocks are under key which is tag UID with array of blocks returned from reader
29              
30             $hash = { 'E000000123456789' => [ 'blk1', 'blk2', ... ] };
31              
32             L sends tag UID with data payload, so we might expect
33             to receive response from other tags from protocol specification,
34              
35             =head2 write_blocks
36              
37             $self->write_blocks( $tag => $bytes );
38              
39             $self->write_blocks( $tag => [ 'blk1', 'blk2', ... ] );
40              
41             =head2 read_afi
42              
43             my $afi = $self->read_afi( $tag );
44              
45             =head2 write_afi
46              
47             $self->write_afi( $tag => $afi );
48              
49              
50             =head1 METHODS
51              
52             =head2 new
53              
54             Just calls C in reader implementation so this class
55             can be used as simple stub base class like
56             L does
57              
58             =cut
59              
60             sub new {
61 1     1 1 15 my $class = shift;
62 1         4 my $self = {@_};
63 1         4 bless $self, $class;
64 1 50       6 $self->init && return $self;
65             }
66              
67             1;