File Coverage

blib/lib/App/TimeClock/Weekly/ConsolePrinter.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 30 30 100.0


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