Coverage Summary

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

filestmtbrancondsubtimetotal
Acme/Santa.pm100.0100.0100.0100.0100.0100.0
Total100.0100.0100.0100.0100.0100.0

Branch Coverage

File:Acme/Santa.pm
Coverage:100.0%

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

Condition Coverage

File:Acme/Santa.pm
Coverage:100.0%

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

Subroutine Coverage

File:Acme/Santa.pm
Coverage:100.0%

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:100.0%

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