File Coverage

blib/lib/App/TimeClock/Weekly/ConsolePrinter.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 3 3 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package App::TimeClock::Weekly::ConsolePrinter;
2              
3             our @ISA = qw(App::TimeClock::Weekly::PrinterInterface);
4              
5 2     2   1091 use POSIX qw(strftime);
  2         4197  
  2         7  
6              
7 2     2   1776 use utf8;
  2         20  
  2         9  
8             binmode STDOUT, ':utf8';
9              
10             our $hrline = '+' . ('-' x 62) . '+' . ('-' x 7) . '+';
11              
12             =head1 NAME
13              
14             App::TimeClock::Weekly::ConsolePrinter
15              
16             =head1 DESCRIPTION
17              
18             Implements the L. Will print a simple ASCII
19             format. Suitable for using in a console/terminal.
20              
21             =head1 METHODS
22              
23             =over
24              
25             =cut
26              
27             =item print_header()
28              
29             Prints a header including todays date. The header is indented to be
30             centered above the tables printed by L. Example:
31              
32             ======================================
33             Weekly Report Mon Mar 19 13:39:06 2012
34             ======================================
35              
36             =cut
37             sub print_header {
38 1     1 1 1 my $self = shift;
39 1         2 my $ident = ' ' x 17;
40 1         5 $self->_print("\n");
41 1         3 $self->_print("${ident}======================================\n");
42 1         29 $self->_print("${ident}Weekly Report " . localtime() . "\n");
43 1         5 $self->_print("${ident}======================================\n\n");
44             };
45              
46             =item print_week()
47              
48             Prints all activities for a week including totals. Is printed in a ACSII
49             table. Example:
50              
51             * Week 11 (2012/03/12 - 2013/03/18) *
52            
53             +------+------+------+------+------+------+------+-------+
54             | Mo12 | Tu13 | We14 | Th15 | Fr16 | Sa17 | Su18 | TOTAL |
55             +------+------+------+------+------+------+------+-------+
56             | 0.57 | 0.50 | 0.45 | 0.50 | 0.30 | | | 2.32 | Lunch
57             +------+------+------+------+------+------+------+-------+
58             | 2.90 | 3.00 | 7.00 | 7.00 | 6.00 | | | 25.90 | MyProject:Estimation
59             +------+------+------+------+------+------+------+-------+
60             | 4.26 | | | | | | | 4.26 | AnotherProject:Bug...
61             -------+------+------+------+------+------+------+-------+
62             | 7.73 | | | | | | | 32.48 |
63             +------+------+------+------+------+------+------+-------+
64              
65             =cut
66       1 1   sub print_week {
67             };
68              
69             =item print_footer()
70              
71             Prints the total number of hours worked and the weekly
72             average. Example:
73              
74             TOTAL = 232.50 hours
75             PERIOD = 30 days
76             AVERAGE = 38.75 hours/week
77              
78             =cut
79             sub print_footer {
80 1     1 1 2 my $self = shift;
81 1         2 $self->_print("Weekly reporting is *not* implemented yet!");
82             };
83             1;
84              
85             =back
86              
87             =for text
88             =encoding utf-8
89             =end
90              
91             =head1 AUTHOR
92              
93             Søren Lund, C<< >>
94              
95             =head1 SEE ALSO
96              
97             L
98              
99             =head1 COPYRIGHT
100              
101             Copyright (C) 2012-2014 Søren Lund
102              
103             This file is part of App::TimeClock.
104              
105             App::TimeClock is free software: you can redistribute it and/or modify
106             it under the terms of the GNU General Public License as published by
107             the Free Software Foundation, either version 3 of the License, or
108             (at your option) any later version.
109              
110             App::TimeClock is distributed in the hope that it will be useful,
111             but WITHOUT ANY WARRANTY; without even the implied warranty of
112             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113             GNU General Public License for more details.
114              
115             You should have received a copy of the GNU General Public License
116             along with App::TimeClock. If not, see .