line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::TimeClock::Weekly::PrinterInterface; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
46611
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
4
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
816
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
App::TimeClock::Weekly::PrinterInterface |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Interface class. All printer objects given to |
13
|
|
|
|
|
|
|
L constructor must be derived from |
14
|
|
|
|
|
|
|
PrinterInterface. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package App::TimeClock::Weekly::MyPrinter; |
19
|
|
|
|
|
|
|
our @ISA = qw(App::TimeClock::Weekly::PrinterInterface); |
20
|
|
|
|
|
|
|
... |
21
|
|
|
|
|
|
|
sub print_header { |
22
|
|
|
|
|
|
|
... |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
sub print_day { |
25
|
|
|
|
|
|
|
... |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
sub print_footer { |
28
|
|
|
|
|
|
|
... |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=over |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item new() |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Creates a new object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
sub new { |
43
|
3
|
|
|
3
|
1
|
53
|
bless { }, shift; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item _print() |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Private print method that uses handle specified by L<_set_ouput_fh> or stdout by default. |
49
|
|
|
|
|
|
|
All implementing classes should use _print to print instead of print. |
50
|
|
|
|
|
|
|
This makes testing much easier. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
sub _print { |
54
|
5
|
|
|
5
|
|
5
|
my $self = shift; |
55
|
5
|
|
|
|
|
9
|
my $fh = $self->_get_output_fh; |
56
|
5
|
|
|
|
|
5
|
print { $fh } @_; |
|
5
|
|
|
|
|
23
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item _get_output_fh() |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Get the file handle used by L<_print>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
sub _get_output_fh { |
65
|
|
|
|
|
|
|
# When testing _output will always be set, i.e. skip coverage check of right condition |
66
|
|
|
|
|
|
|
# uncoverable condition right |
67
|
5
|
|
50
|
5
|
|
9
|
return $_[0]->{_output} || \*STDOUT; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item _set_ouput_fh() |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Set the file handle used by L<_print>. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
1
|
|
|
1
|
|
635
|
sub _set_output_fh { $_[0]->{_output} = $_[1] } |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item print_header() |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Called once at the start of a report. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
1
|
|
|
1
|
1
|
32
|
sub print_header { shift->_must_implement; }; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item print_week() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Called for each week in the report. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
1
|
|
|
1
|
1
|
19
|
sub print_week { shift->_must_implement; }; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item print_footer() |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Called once at the end of a report. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
1
|
|
|
1
|
1
|
18
|
sub print_footer { shift->_must_implement; }; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _must_implement { |
99
|
3
|
|
|
3
|
|
27
|
(my $name = (caller(1))[3]) =~ s/^.*:://; |
100
|
3
|
|
|
|
|
10
|
my ($filename, $line) = (caller(0))[1..2]; |
101
|
3
|
|
|
|
|
29
|
die "You must implement $name() method at $filename line $line"; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=for text |
108
|
|
|
|
|
|
|
=encoding utf-8 |
109
|
|
|
|
|
|
|
=end |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Søren Lund, C<< >> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SEE ALSO |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 COPYRIGHT |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright (C) 2012-2014 Søren Lund |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This file is part of App::TimeClock. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
App::TimeClock is free software: you can redistribute it and/or modify |
126
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
127
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
128
|
|
|
|
|
|
|
(at your option) any later version. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
App::TimeClock is distributed in the hope that it will be useful, |
131
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
132
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
133
|
|
|
|
|
|
|
GNU General Public License for more details. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
136
|
|
|
|
|
|
|
along with App::TimeClock. If not, see . |