| 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
| |||||||||||
| 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
| |||||||||||
| 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; | |||||||||