| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Enbld::Target::AttributeCollector; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 20 |  |  | 20 |  | 15535 | use strict; | 
|  | 20 |  |  |  |  | 41 |  | 
|  | 20 |  |  |  |  | 822 |  | 
| 4 | 20 |  |  | 20 |  | 215 | use warnings; | 
|  | 20 |  |  |  |  | 38 |  | 
|  | 20 |  |  |  |  | 619 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 20 |  |  | 20 |  | 122 | use Carp; | 
|  | 20 |  |  |  |  | 36 |  | 
|  | 20 |  |  |  |  | 9158 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub new { | 
| 9 | 176 |  |  | 176 | 0 | 87670 | my $class = shift; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 176 |  |  |  |  | 860 | return bless {}, $class; | 
| 12 |  |  |  |  |  |  | } | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub add { | 
| 15 | 1403 |  |  | 1403 | 0 | 3719 | my ( $self, $name, $param ) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1403 | 100 |  |  |  | 3522 | if ( $self->{$name} ) { | 
| 18 | 1 |  |  |  |  | 5 | require Enbld::Exception; | 
| 19 | 1 |  |  |  |  | 5 | croak( Enbld::Exception->new( $name . " is already added" ) ); | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 1402 |  |  |  |  | 19855 | require Enbld::Target::Attribute; | 
| 23 | 1402 |  |  |  |  | 5522 | $self->{$name} = Enbld::Target::Attribute->new( $name, $param ); | 
| 24 | 1384 |  |  |  |  | 9194 | $self->{$name}->link_to_collector( $self ); | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 1384 |  |  |  |  | 3437 | return $self; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub AUTOLOAD { | 
| 30 | 1510 |  |  | 1510 |  | 7539 | my $self = shift; | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 1510 |  |  |  |  | 3726 | my $method = our $AUTOLOAD; | 
| 33 | 1510 |  |  |  |  | 9535 | $method =~ s/.*:://; | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 1510 | 100 |  |  |  | 13586 | return $self->{$method}->to_value if ( exists $self->{$method} ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 1 |  |  |  |  | 542 | require Enbld::Exception; | 
| 38 | 1 |  |  |  |  | 6 | croak( Enbld::Exception->new( "'$method' is invalid method" ) ); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 0 |  |  | 0 |  |  | sub DESTROY { | 
| 42 |  |  |  |  |  |  | # do nothing | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | 1; |