OurCal/Todo.pm

filter: Statementstmt 18.1% 4 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 14.2% 1 / 7 Podpod 100% 5 / 5 totaltotal 27.7% 10 / 36 CC 2 SCAR 10.6
CC
2
Cov
17%
full_description
6.0
new
2.0
id
2.0
CRAP 2.9
« OurCal/Event.pm ↑ Summary OurCal/Month.pm »
1 package OurCal::Todo;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 OurCal::Todo - a TODO class for OurCal
8  
9 =head1 METHODS
10  
11  
12 =cut
13  
14  
15 =head2 new
16  
17 Requires a description param and optionally a for and an id param.
18
19 =cut
20  
21  
22 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
23 0 my ($class, %todo) = @_;
24  
25 0 return bless \%todo, $class;
26 }
27  
28 =head2 id
29  
30 The id of the TODO
31  
32 =cut
33  
34 0 ▶sub id {
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = shift;
36 0 return $self->{id};
37 }
38  
39 =head2 description
40  
41 The description of the TODO
42  
43 =cut
44
45 0 ▶sub description {
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
46 0 my $self = shift;
47 0 return $self->_trim($self->{description});
48 }
49
50 =head2 for
51  
52 Who the TODO is for
53  
54 =cut
55
56 0 ▶sub for {
Subroutine for: not called CC=1 SCAR=6.9
Pod documented
57 0 my $self = shift;
58 0 return $self->{for};
59
60 }
61
62 =head2 full_description
63  
64 The Description plus the for if it's present
65  
66 =cut
67
68 0 ▶sub full_description {
Subroutine full_description: not called CC=2 SCAR=17.9
Pod documented
69 0 my ($self) = @_;
70 0 my $for = $self->{for};
71  
72 0 my $description;
73 0 ▶ if (defined $for) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $for) { } 0 0 0
74 0 $description = sprintf "(%s) %s", $for, $self->description;
75 } else {
76 0 $description = sprintf "%s", $self->description;
77 }
78 0 return $description;
79 }
80  
81 0 ▶sub _trim {
Subroutine _trim: not called CC=1 SCAR=6.9
82 0 my($self, $text) = @_;
83  
84 0 $text =~ s/^\s*(.+=?)\$/$1/;
85  
86 0 return $text;
87 }
88  
89  
90 2 1;
91  
« OurCal/Event.pm ↑ Summary OurCal/Month.pm »