File Coverage

blib/lib/Class/MakeMethods/Emulator/mcoder.pm
Criterion Covered Total %
statement 21 21 100.0
branch 5 6 83.3
condition n/a
subroutine 14 14 100.0
pod 0 10 0.0
total 40 51 78.4


line stmt bran cond sub pod time code
1             package Class::MakeMethods::Emulator::mcoder;
2              
3             $VERSION = '0.05';
4              
5 3     3   70256 use Class::MakeMethods::Emulator '-isasubclass';
  3         27  
  3         20  
6 3     3   2456 use Class::MakeMethods::Template '-isasubclass';
  3         9  
  3         40  
7              
8             ########################################################################
9              
10             sub import {
11 7     7   86 my $class = shift;
12 7         31 ( my $target = $class ) =~ s/^Class::MakeMethods::Emulator:://;
13 7 100       52 $class->_handle_namespace( $target, $_[0] ) and shift;
14 7 100       5933 $class->make( @_ ) if ( scalar @_ );
15             }
16              
17              
18 3     3 0 11 sub new { 'Template::Hash::new --with_values' }
19 2     2 0 9 sub proxy { 'Template::Universal:forward_methods -target' }
20 2     2 0 11 sub generic { { '-import' => { 'Template::Hash:scalar' => '*' } } }
21 2     2 0 13 sub get { { interface => { default => { '*' =>'get' } } } }
22 2     2 0 14 sub set { { interface => { default => { 'set_*' =>'set' } } } }
23 1     1 0 6 sub undef { { interface => { default => { 'undef_*' =>'clear' } } } }
24 1     1 0 7 sub delete { { interface => { default => { 'delete_*'=>'hash_delete' } } } }
25 1     1 0 9 sub bool_set { { interface => { default => { 'set_*' =>'set_value' } },
26             '-import' => { 'Template::Hash:boolean' => '*' } } }
27 1     1 0 7 sub bool_unset { { interface => { default => { 'unset_*' =>'clear' } } } }
28 1     1 0 8 sub calculated { { interface => { default => { '*' =>'get_init' } },
29             params => { init_method=>'_calculate_*' } } }
30              
31             ########################################################################
32              
33             foreach my $type ( qw( new get set proxy calculated ) ) {
34             $INC{"Class/MakeMethods/Emulator/mcoder/$type.pm"} =
35             $INC{"mcoder/$type.pm"} = __FILE__;
36             *{__PACKAGE__ . "::${type}::import"} = sub {
37 3 50   3   66 (shift) and (__PACKAGE__)->make( $type => [ @_ ] )
38             };
39             }
40              
41             ########################################################################
42              
43             1;
44              
45             __END__