File Coverage

blib/lib/WWW/Scraper/ISBN/Record.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 9 9 100.0
pod 6 6 100.0
total 45 46 97.8


line stmt bran cond sub pod time code
1             package WWW::Scraper::ISBN::Record;
2              
3 7     7   68082 use strict;
  7         23  
  7         196  
4 7     7   34 use warnings;
  7         14  
  7         2001  
5              
6             our $VERSION = '1.05';
7              
8             #----------------------------------------------------------------------------
9             # Public API
10              
11             sub new {
12 5     5 1 699 my $proto = shift;
13 5   66     24 my $class = ref($proto) || $proto;
14 5         23 my $self = {
15             ISBN => undef,
16             FOUND => 0,
17             FOUND_IN => undef,
18             BOOK => undef,
19             ERROR => '',
20             };
21              
22 5         11 bless ($self, $class);
23 5         15 return $self;
24             }
25              
26 8     8 1 362 sub isbn { my $self = shift; return $self->_accessor('ISBN',@_) }
  8         20  
27 6     6 1 3331 sub found { my $self = shift; return $self->_accessor('FOUND',@_) }
  6         19  
28 3     3 1 540 sub found_in { my $self = shift; return $self->_accessor('FOUND_IN',@_) }
  3         13  
29 6     6 1 573 sub book { my $self = shift; return $self->_accessor('BOOK',@_) }
  6         14  
30 6     6 1 541 sub error { my $self = shift; return $self->_accessor('ERROR',@_) }
  6         15  
31              
32             sub _accessor {
33 29     29   44 my $self = shift;
34 29         46 my $accessor = shift;
35 29 100       64 if (@_) { $self->{$accessor} = shift };
  12         25  
36 29         124 return $self->{$accessor};
37             }
38              
39             1;
40              
41             __END__