File Coverage

blib/lib/Class/MakeMethods/Emulator/accessors.pm
Criterion Covered Total %
statement 17 17 100.0
branch 4 4 100.0
condition 6 6 100.0
subroutine 9 9 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1             package Class::MakeMethods::Emulator::accessors;
2              
3             $VERSION = '0.02';
4              
5 4     4   140464 use Class::MakeMethods::Emulator '-isasubclass';
  4         11  
  4         25  
6 4     4   2509 use Class::MakeMethods::Template::Hash '-isasubclass';
  4         10  
  4         62  
7              
8 11     11   81 sub _emulator_target { 'accessors' }
9 7     7   62 sub _accessor_type { 'scalar --get_set_chain' }
10              
11             sub import {
12 15     15   23015 my $class = shift;
13            
14 15 100       62 $class->_handle_namespace( $class->_emulator_target, $_[0] ) and shift;
15            
16 15         47 foreach ( @_ ) {
17 10 100 100     138 die "invalid accessor - $_" unless ( /\A[a-z]\w+\z/i and
      100        
18             $_ ne 'DESTROY' and $_ ne 'AUTOLOAD' )
19             }
20            
21 11         41 $class->make($class->_accessor_type => [@_]);
22             }
23              
24             ########################################################################
25              
26             package Class::MakeMethods::Emulator::accessors::chained;
27             @ISA = 'Class::MakeMethods::Emulator::accessors';
28             $INC{'Class/MakeMethods/Emulator/accessors/chained.pm'} =
29             $INC{'Class/MakeMethods/Emulator/accessors.pm'};
30              
31 2     2   13 sub _emulator_target { 'accessors::chained' }
32 2     2   19 sub _accessor_type { 'scalar --get_set_chain' }
33              
34             ########################################################################
35              
36             package Class::MakeMethods::Emulator::accessors::classic;
37             @ISA = 'Class::MakeMethods::Emulator::accessors';
38             $INC{'Class/MakeMethods/Emulator/accessors/classic.pm'} =
39             $INC{'Class/MakeMethods/Emulator/accessors.pm'};
40              
41 2     2   19 sub _emulator_target { 'accessors::classic' }
42 2     2   23 sub _accessor_type { 'scalar' }
43              
44             ########################################################################
45              
46             1;
47              
48             __END__