File Coverage

blib/lib/Biblio/COUNTER/Report/Release2/DatabaseReport1.pm
Criterion Covered Total %
statement 9 27 33.3
branch 0 4 0.0
condition n/a
subroutine 3 9 33.3
pod 0 6 0.0
total 12 46 26.0


line stmt bran cond sub pod time code
1             package Biblio::COUNTER::Report::Release2::DatabaseReport1;
2              
3 1     1   11390 use strict;
  1         2  
  1         44  
4 1     1   5 use warnings;
  1         2  
  1         39  
5              
6 1     1   7 use Biblio::COUNTER::Report qw(REQUESTS SEARCHES SESSIONS MAY_BE_BLANK NOT_BLANK EXACT_MATCH);
  1         2  
  1         676  
7              
8             @Biblio::COUNTER::Report::Release2::DatabaseReport1::ISA = qw(Biblio::COUNTER::Report);
9              
10 0     0 0   sub canonical_report_name { 'Database Report 1 (R2)' }
11 0     0 0   sub canonical_report_description { 'Total Searches and Sessions by Month and Database' }
12 0     0 0   sub canonical_report_code { 'DB1' }
13 0     0 0   sub release_number { 2 }
14              
15             sub process_header_rows {
16 0     0 0   my ($self) = @_;
17            
18             # Report name and title
19 0           $self->begin_row
20             ->check_report_name
21             ->check_report_description
22             ->end_row;
23            
24             # Report criteria
25 0           $self->begin_row
26             ->check_report_criteria
27             ->end_row;
28            
29             # Date run label
30 0           $self->begin_row
31             ->check_label('Date run:')
32             ->end_row;
33            
34             # Date run
35 0           $self->begin_row
36             ->check_date_run
37             ->end_row;
38            
39             # Data column labels
40 0           $self->begin_row
41             ->check_blank
42             ->check_label('Publisher', qr/^(?i)pub/)
43             ->check_label('Platform', qr/^(?i)plat/)
44             ->check_blank
45             ->check_period_labels
46             ->check_label('YTD Total')
47             ->end_row;
48             }
49              
50             sub process_record {
51 0     0 0   my ($self) = @_;
52            
53             # First row -- searches run
54 0           $self->begin_row;
55 0 0         return if $self->_eof;
56 0           $self->check_title(NOT_BLANK)
57             ->check_publisher(MAY_BE_BLANK)
58             ->check_platform(NOT_BLANK)
59             ->check_label('Searches run')
60             ->check_count_by_periods(SEARCHES)
61             ->check_ytd_total
62             ->end_row;
63            
64             # Fields that must be the same in the second row as in the first
65 0           my $record = $self->{'record'};
66 0           my ($title, $publisher, $platform) = @$record{qw(title publisher platform)};
67            
68             # Second row -- sessions
69 0           $self->begin_row
70             ->check_title(EXACT_MATCH, $title)
71             ->check_publisher(EXACT_MATCH, $publisher)
72             ->check_platform(EXACT_MATCH, $platform)
73             ->check_label('Sessions')
74             ->check_count_by_periods(SESSIONS)
75             ->check_ytd_total
76             ->end_row;
77            
78 0 0         $self->blank_row unless $self->_eof;
79             }
80              
81             1;
82              
83             =pod
84              
85             =head1 NAME
86              
87             Biblio::COUNTER::Report::Release2::DatabaseReport1 - a DB1 (R2) COUNTER report
88              
89             =head1 SYNOPSIS
90              
91             $report = Biblio::COUNTER::Report::Release2::DatabaseReport1->new(
92             'file' => $file,
93             );
94             $report->process;
95              
96             =cut