File Coverage

blib/lib/Class/MakeMethods/Emulator/Inheritable.pm
Criterion Covered Total %
statement 17 19 89.4
branch 4 6 66.6
condition 6 12 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 32 43 74.4


line stmt bran cond sub pod time code
1             package Class::MakeMethods::Emulator::Inheritable;
2              
3 2     2   1739 use strict;
  2         3  
  2         72  
4              
5 2     2   1270 use Class::MakeMethods::Template::ClassInherit;
  2         6  
  2         23  
6 2     2   1575 use Class::MakeMethods::Emulator qw( namespace_capture namespace_release );
  2         6  
  2         14  
7              
8             my $emulation_target = 'Class::Data::Inheritable';
9              
10             sub import {
11 2     2   16 my $mm_class = shift;
12 2 100 66     41 if ( scalar @_ and $_[0] =~ /^-take_namespace/ and shift) {
    50 66        
      33        
      33        
13 1         3 namespace_capture(__PACKAGE__, $emulation_target);
14             } elsif ( scalar @_ and $_[0] =~ /^-release_namespace/ and shift) {
15 0         0 namespace_release(__PACKAGE__, $emulation_target);
16             }
17             # The fallback should really be to NEXT::import.
18 2         415 $mm_class->SUPER::import( @_ );
19             }
20              
21             ########################################################################
22              
23             sub mk_classdata {
24 2     2 0 3082 my $declaredclass = shift;
25 2         4 my $attribute = shift;
26 2         57 Class::MakeMethods::Template::ClassInherit->make(
27             -TargetClass => $declaredclass,
28             'scalar' => [ -interface => { '*'=>'get_set', '_*_accessor'=>'get_set' },
29             $attribute ],
30             );
31 2 50       16 if ( scalar @_ ) {
32 0           $declaredclass->$attribute( @_ );
33             }
34             }
35              
36             ########################################################################
37              
38             1;
39              
40             __END__