Enbld/Target/AttributeCollector.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 92.3% 36 / 39 SCAR 11.0
CC
3
Cov
100%
add
2.0
AUTOLOAD
2.0
BEGIN
1.0
CRAP 3.0
« Enbld/Exception.pm ↑ Summary Enbld/Target/Attribute/DownloadSite.pm »
1 package Enbld::Target::AttributeCollector;
2  
3 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 20 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new {
9 176 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10  
11 176 return bless {}, $class;
12 }
13  
14 sub add {
15 1403 ▶ my ( $self, $name, $param ) = @_;
Subroutine add: called CC=2 SCAR=6.9
Pod undocumented
16  
17 1403 ▶ if ( $self->{$name} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{$name}) 1 1402 1403
18 1 require Enbld::Exception;
19 1 croak( Enbld::Exception->new( $name . " is already added" ) );
20 }
21  
22 1402 require Enbld::Target::Attribute;
23 1402 $self->{$name} = Enbld::Target::Attribute->new( $name, $param );
24 1384 $self->{$name}->link_to_collector( $self );
25  
26 1384 return $self;
27 }
28  
29 sub AUTOLOAD {
30 1510 ▶ my $self = shift;
Subroutine AUTOLOAD: called CC=2 SCAR=6.9
31  
32 1510 my $method = our $AUTOLOAD;
33 1510 $method =~ s/.*:://;
34  
35 1510 ▶ return $self->{$method}->to_value if ( exists $self->{$method} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{$method} 1509 1 1510
36  
37 1 require Enbld::Exception;
38 1 croak( Enbld::Exception->new( "'$method' is invalid method" ) );
39 }
40  
41 ▶sub DESTROY {
Subroutine DESTROY: not called CC=1 SCAR=0.0
42 # do nothing
43 }
44  
45 20 1;
« Enbld/Exception.pm ↑ Summary Enbld/Target/Attribute/DownloadSite.pm »