Coverage Summary

Database:/homepages/12/d93966548/htdocs/www/projects/develcover/cover_db

filestmtbrancondsubtimetotal
Acme/Santa.pm72.450.040.066.7100.065.2
Total72.450.040.066.7100.065.2

Branch Coverage

File:Acme/Santa.pm
Coverage:50.0%

line%coveragebranch
2850TFunless ($self->_is_naughty_or_nice($who) == 1)
3750TFif ($who =~ /\bevil\b/i or $who =~ /\bsatan\b/i) { }
50TFelsif ($who =~ /\bgrinch\b/i) { }

Condition Coverage

File:Acme/Santa.pm
Coverage:40.0%

line%coveragecondition
1950
Adec
00
11
$$self{'_list'}{$k} ||= []
3733
ABdec
000
011
1X1
$who =~ /\bevil\b/i or $who =~ /\bsatan\b/i

Subroutine Coverage

File:Acme/Santa.pm
Coverage:66.7%

linesubroutine
9
new
14
make_a_list
26
check_it_twice
35
_is_naughty_or_nice
46
make_toys
47
fly_reindeer

File Coverage

File:Acme/Santa.pm
Coverage:65.2%

linestmtbrancondsubtimecode
1package Acme::Santa;
2use strict;
3use warnings;
4
5use constant NAUGHTY => 0;
6use constant NICE => 1;
7
8sub new {
9
1
6
  my $self = shift;
10
1
9
  bless { _list=>{} }, $self;
11}
12
13sub 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
25sub 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
34sub _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
491;