TLB/Dummy.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 4 / 4 totaltotal 100% 30 / 30 CC 2 SCAR 2.5
CC
2
Cov
100%
oneFail
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« TLB.pm ↑ Summary
1 package Class::TLB::Dummy ;
2  
3 2 ▶use strict ;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings ;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Class::TLB::Dummy - A dummy resource for test purpose.
9  
10 =cut
11  
12 =head2 new
13  
14 Returns a new instance of this.
15  
16 =cut
17  
18 3 ▶sub new{
Subroutine new: called CC=1 SCAR=0.0
Pod documented
19 3 my ( $class , $id ) = @_ ;
20 3 my $self = {'id' => $id } ;
21 3 return bless $self , $class ;
22 }
23  
24 =head2 doSomething
25  
26 Do something and return a string for display.
27  
28 =cut
29  
30 3 ▶sub doSomething{
Subroutine doSomething: called CC=1 SCAR=0.0
Pod documented
31 3 my ( $self ) = @_ ;
32 3 return "I (".$self->{'id'}.") did something";
33 }
34  
35  
36 =head2 oneFail
37  
38 Fails only if id is 1
39  
40 =cut
41  
42 1001 ▶sub oneFail{
Subroutine oneFail: called CC=2 SCAR=6.9
Pod documented
43 1001 my ( $self ) = @_ ;
44 1001 ▶ if ( $self->{'id'} == 1 ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"id"} == 1) 1 1000 1001
45 1 die "I am 1 and I fail" ;
46 }
47 #select(undef,undef,undef, 0.01);
48 1000 return "I am ".$self->{'id'} ;
49 }
50  
51 =head2 doFail
52  
53 This fails each time
54  
55 =cut
56  
57 3 ▶sub doFail{
Subroutine doFail: called CC=1 SCAR=0.0
Pod documented
58 3 my ( $self ) = @_ ;
59 3 die "Arghhh" ;
60 }
61  
62  
63 2 1;
« TLB.pm ↑ Summary