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