Sabermetrics/Team.pm

filter: Statementstmt 50.0% 19 / 38 Branchbran 25.0% 1 / 4 Conditioncond 5.5% 1 / 18 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 8 totaltotal 29.5% 26 / 88 CC 12 SCAR 18.3
CC
12
Cov
35%
left_handed_pitchers
12.0
right_handed_pitchers
12.0
pitchers
6.0
CRAP 6.2
« Sabermetrics/abstract.pm ↑ Summary Sabermetrics/Player.pm »
1 package Baseball::Sabermetrics::Team;
2 2 ▶use Baseball::Sabermetrics::abstract;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our @ISA = qw/ Baseball::Sabermetrics::abstract /;
6  
7 sub players
8 5 ▶{
Subroutine players: called CC=3 SCAR=14.2
Pod undocumented
9 5 my ($self, $name) = @_;
10 5 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) 0 5 5
11 0 ▶ die "Player not found: $name\n" unless exists $self->{players}->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"players"}{$name} 0 0 0
12 0 return $self->{players}->{$name};
13 }
14 5 return values %{$self->{players}};
15 }
16  
17 sub pitchers
18 0 ▶{
Subroutine pitchers: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $self = shift;
20 0 ▶ return grep { exists $_->{np} and $_->{np} > 0 } $self->players;
Condition0%0/3
exists $_->{'np'} && $_->{'np'} > 0
!ll&&!rl&&r
000
MC/DC0%0/2
exists $_->{'np'} && $_->{'np'} > 0
exists $_->{'np'} $_->{'np'} > 0
Truth table0%0/3
A && B
A= exists $_->{'np'}B= $_->{'np'} > 0
ABresult
0X0
100
111
21 }
22  
23 sub batters
24 1 ▶{
Subroutine batters: called CC=2 SCAR=7.6
Pod undocumented
25 1 my $self = shift;
26 1 ▶ return grep { exists $_->{pa} and $_->{pa} > 0 } $self->players;
Condition33%1/3
exists $_->{'pa'} && $_->{'pa'} > 0
!ll&&!rl&&r
005
MC/DC0%0/2
exists $_->{'pa'} && $_->{'pa'} > 0
exists $_->{'pa'} $_->{'pa'} > 0
Truth table33%1/3
A && B
A= exists $_->{'pa'}B= $_->{'pa'} > 0
ABresult
0X0
100
111
27 }
28  
29 sub left_handed_pitchers
30 0 ▶{
Subroutine left_handed_pitchers: not called CC=3 SCAR=24.8
Pod undocumented
31 0 my $self = shift;
32 0 ▶ return grep { exists $_->{np} and $_->{np} > 0 and $_->{bio}->{throws} eq 'left' } $self->players;
Condition0%0/6
exists $_->{'np'} && $_->{'np'} > 0 && $_->{'bio'}{'throws'} eq 'left'
!ll&&!rl&&r
000
exists $_->{"np"} and $_->{"np"} > 0
!ll&&!rl&&r
000
MC/DC0%0/3
exists $_->{'np'} && $_->{'np'} > 0 && $_->{'bio'}{'throws'} eq 'left'
exists $_->{"np"} $_->{"np"} > 0 $_->{'bio'}{'throws'} eq 'left'
Truth table0%0/4
A and B && C
A= exists $_->{"np"}B= $_->{"np"} > 0C= $_->{'bio'}{'throws'} eq 'left'
ABCresult
0XX0
10X0
1100
1111
33 }
34  
35 sub right_handed_pitchers
36 0 ▶{
Subroutine right_handed_pitchers: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my $self = shift;
38 0 ▶ return grep { exists $_->{np} and $_->{np} > 0 and $_->{bio}->{throws} eq 'right' } $self->players;
Condition0%0/6
exists $_->{'np'} && $_->{'np'} > 0 && $_->{'bio'}{'throws'} eq 'right'
!ll&&!rl&&r
000
exists $_->{"np"} and $_->{"np"} > 0
!ll&&!rl&&r
000
MC/DC0%0/3
exists $_->{'np'} && $_->{'np'} > 0 && $_->{'bio'}{'throws'} eq 'right'
exists $_->{"np"} $_->{"np"} > 0 $_->{'bio'}{'throws'} eq 'right'
Truth table0%0/4
A and B && C
A= exists $_->{"np"}B= $_->{"np"} > 0C= $_->{'bio'}{'throws'} eq 'right'
ABCresult
0XX0
10X0
1100
1111
39 }
40  
41 sub report
42 0 ▶{
Subroutine report: not called CC=2 SCAR=17.9
Pod undocumented
43 0 my ($self, @cols) = @_;
44 0 print join("\t", @cols), "\n";
45 0 for ($self->players) {
46 0 $_->print(@cols);
47 }
48 }
49  
50 sub report_pitchers
51 0 ▶{
Subroutine report_pitchers: not called CC=2 SCAR=17.9
Pod undocumented
52 0 my ($self, @cols) = @_;
53 0 print join("\t", @cols), "\n";
54 0 for ($self->pitchers) {
55 0 $_->print(@cols);
56 }
57 }
58  
59 sub report_batters
60 1 ▶{
Subroutine report_batters: called CC=2 SCAR=6.9
Pod undocumented
61 1 my ($self, @cols) = @_;
62 1 print join("\t", @cols), "\n";
63 1 for ($self->batters) {
64 5 $_->print(@cols);
65 }
66 }
67  
68 2 1;
« Sabermetrics/abstract.pm ↑ Summary Sabermetrics/Player.pm »