DBomb/Generator.pm

filter: Statementstmt 75.0% 21 / 28 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 1 totaltotal 50.0% 27 / 54 CC 6 SCAR 22.6
CC
6
Cov
51%
gen_accessor
21.4
__ANON__
6.0
BEGIN
1.0
CRAP 9.6
« DBomb/Meta/HasMany.pm ↑ Summary DBomb/Tie/PrimaryKeyList.pm »
1 package DBomb::Generator;
2  
3 =head1 NAME
4  
5 DBomb::Generator - Provides routines any generator might need.
6  
7 =head1 SYNOPSIS
8  
9 =cut
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 our $VERSION = '$Revision: 1.4 $';
14  
15 1 ▶use Carp::Assert;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 use Class::MethodMaker
18 1 ▶ 'new_with_init' => 'new';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 1 our @EXPORT_OK = qw(gen_accessor);
22  
23 ## subroutine -- not a method!
24 ## gen_accessor($pkg, $sub_name)
25 ## gen_accessor($pkg, $sub_name, $attr_name)
26 sub gen_accessor
27 0 ▶{
Subroutine gen_accessor: not called CC=5 SCAR=30.7
Pod undocumented
28 0 my ($pkg, $sub_name, $attr_name) = @_;
29 0 ▶ assert(2 <= @_ && @_ <= 3 && defined($pkg) && defined($sub_name), 'valid parameters');
Condition0%0/9
2 <= @_ && @_ <= 3 && defined $pkg && defined $sub_name
!ll&&!rl&&r
000
2 <= @_ and @_ <= 3 and defined $pkg
!ll&&!rl&&r
000
2 <= @_ and @_ <= 3
!ll&&!rl&&r
000
MC/DC0%0/4
2 <= @_ && @_ <= 3 && defined $pkg && defined $sub_name
2 <= @_ @_ <= 3 defined $pkg defined $sub_name
Truth table0%0/5
A and B and C && D
A= 2 <= @_B= @_ <= 3C= defined $pkgD= defined $sub_name
ABCDresult
0XXX0
10XX0
110X0
11100
11111
30 0 ▶ $attr_name = $sub_name if not defined $attr_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attr_name 0 0 0
31  
32 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
33 0 ▶ *{$pkg . "::" . $sub_name} = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
34 0 ▶ $_[0]->{$attr_name} = $_[1] if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 0 0
35 0 $_[0]->{$attr_name}
36 0 };
37 }
38  
39  
40 1 1;
41 __END__
« DBomb/Meta/HasMany.pm ↑ Summary DBomb/Tie/PrimaryKeyList.pm »