File Coverage

blib/lib/MooseX/Clone/Meta/Attribute/Trait/Clone/Std.pm
Criterion Covered Total %
statement 11 12 91.6
branch 3 4 75.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 17 20 85.0


line stmt bran cond sub pod time code
1             package MooseX::Clone::Meta::Attribute::Trait::Clone::Std;
2              
3             our $VERSION = '0.06';
4              
5 2     2   1570 use Moose::Role;
  2         5  
  2         17  
6 2     2   9436 use namespace::autoclean;
  2         4  
  2         15  
7              
8             with qw(MooseX::Clone::Meta::Attribute::Trait::Clone::Base);
9              
10             requires qw(clone_value_data);
11              
12             sub clone_value {
13 5     5 0 14 my ( $self, $target, $proto, %args ) = @_;
14              
15 5 50       17 if ( exists $args{init_arg} ) {
16 0         0 $self->set_value( $target, $args{init_arg} );
17             } else {
18 5 100       18 return unless $self->has_value($proto);
19              
20 1         28 my $clone = $self->clone_value_data( scalar($self->get_value($proto)), %args );
21              
22 1         18 $self->set_value( $target, $clone );
23             }
24             }
25              
26             __PACKAGE__
27              
28             __END__