Database: | /homepages/12/d93966548/htdocs/www/projects/develcover/cover_db |
file | stmt | bran | cond | sub | time | total |
---|---|---|---|---|---|---|
Acme/Santa.pm | 72.4 | 50.0 | 40.0 | 66.7 | 100.0 | 65.2 |
Total | 72.4 | 50.0 | 40.0 | 66.7 | 100.0 | 65.2 |
File: | Acme/Santa.pm |
Coverage: | 50.0% |
line | % | coverage | branch | |
---|---|---|---|---|
28 | 50 | T | F | unless ($self->_is_naughty_or_nice($who) == 1) |
37 | 50 | T | F | if ($who =~ /\bevil\b/i or $who =~ /\bsatan\b/i) { } |
50 | T | F | elsif ($who =~ /\bgrinch\b/i) { } |
File: | Acme/Santa.pm |
Coverage: | 40.0% |
line | % | coverage | condition | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19 | 50 |
| $$self{'_list'}{$k} ||= [] | ||||||||||||
37 | 33 |
| $who =~ /\bevil\b/i or $who =~ /\bsatan\b/i |
File: | Acme/Santa.pm |
Coverage: | 66.7% |
line | subroutine |
---|---|
9 | new |
14 | make_a_list |
26 | check_it_twice |
35 | _is_naughty_or_nice |
46 | make_toys |
47 | fly_reindeer |
File: | Acme/Santa.pm |
Coverage: | 65.2% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
1 | package Acme::Santa; | |||||
2 | use strict; | |||||
3 | use warnings; | |||||
4 | ||||||
5 | use constant NAUGHTY => 0; | |||||
6 | use constant NICE => 1; | |||||
7 | ||||||
8 | sub new { | |||||
9 | 1 | 6 | my $self = shift; | |||
10 | 1 | 9 | bless { _list=>{} }, $self; | |||
11 | } | |||||
12 | ||||||
13 | sub make_a_list { | |||||
14 | 1 | 4 | my $self = shift; | |||
15 | 1 | 5 | my %list = @_; | |||
16 | 1 | 5 | my $ct = 0; | |||
17 | 1 1 | 16 6 | while( my ($k, $v) = each %list ){ | |||
18 | 1 | 6 | $ct += @$v; | |||
19 | 1 | 11 | $self->{_list}->{$k} ||= []; | |||
20 | 1 1 | 4 10 | push @{$self->{_list}->{$k}}, @$v; | |||
21 | } | |||||
22 | 1 | 6 | return $ct; | |||
23 | } | |||||
24 | ||||||
25 | sub check_it_twice { | |||||
26 | 1 | 4 | my $self = shift; | |||
27 | 1 2 1 | 4 21 4 | while( my ($who, $list) = each %{$self->{_list}} ){ | |||
28 | 1 | 8 | unless ( $self->_is_naughty_or_nice($who) == NICE ){ | |||
29 | 0 0 0 | 0 0 0 | $_ = 'coal' for @$list; | |||
30 | } | |||||
31 | } | |||||
32 | } | |||||
33 | ||||||
34 | sub _is_naughty_or_nice { | |||||
35 | 1 | 4 | my $self = shift; | |||
36 | 1 | 5 | my $who = shift; | |||
37 | 1 | 24 | if( $who =~ /\bevil\b/i || $who =~ /\bsatan\b/i){ | |||
38 | 0 | 0 | return NAUGHTY; | |||
39 | }elsif( $who =~ /\bgrinch\b/i ){ | |||||
40 | 0 | 0 | sleep 1; | |||
41 | 0 | 0 | return NAUGHTY; | |||
42 | } | |||||
43 | 1 | 10 | return NICE; | |||
44 | } | |||||
45 | ||||||
46 | 0 | sub make_toys { my $self = shift; } | ||||
47 | 0 | sub fly_reindeer { my $self = shift; } | ||||
48 | ||||||
49 | 1; |