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