File Coverage

blib/lib/CCfnX/DynamicValue.pm
Criterion Covered Total %
statement 9 11 81.8
branch 2 2 100.0
condition 3 3 100.0
subroutine 2 3 66.6
pod 0 2 0.0
total 16 21 76.1


line stmt bran cond sub pod time code
1             package CCfnX::DynamicValue {
2 14     14   89 use Moose;
  14         31  
  14         86  
3             extends 'Cfn::Value';
4             has '+Value' => (isa => 'CodeRef');
5              
6             sub to_value {
7 0     0 0 0 my $self = shift;
8 0         0 return Moose::Util::TypeConstraints::find_type_constraint('Cfn::Value')->coerce($self->resolve_value(@_));
9             #Cfn::Value->new(Value => $self->resolve_value(@_));
10             }
11              
12             sub resolve_value {
13 26     26 0 39 my $self = shift;
14 26         48 my @args = reverse @_;
15 26         613 my (@ret) = ($self->Value->(@args));
16 26 100 100     2495 @ret = map { (not ref($_) or ref($_) eq 'HASH')?$_:$_->as_hashref(@args) } @ret;
  28         796  
17 26         322 return (@ret);
18             }
19              
20             override as_hashref => sub {
21             my $self = shift;
22             return $self->resolve_value(@_);
23             };
24             }
25              
26             1;