File Coverage

blib/lib/Class/MakeMethods/Emulator/Singleton.pm
Criterion Covered Total %
statement 10 11 90.9
branch 3 4 75.0
condition 6 12 50.0
subroutine 3 3 100.0
pod n/a
total 22 30 73.3


line stmt bran cond sub pod time code
1             package Class::MakeMethods::Emulator::Singleton;
2              
3 2     2   3963 use strict;
  2         5  
  2         913  
4             require Class::MakeMethods::Emulator;
5              
6             my $emulation_target = 'Class::Singleton';
7              
8             sub import {
9 2     2   17 my $mm_class = shift;
10 2 100 66     25 if ( scalar @_ and $_[0] =~ /^-take_namespace/ and shift) {
    50 66        
      33        
      33        
11 1         4 Class::MakeMethods::Emulator::namespace_capture(__PACKAGE__, $emulation_target);
12             } elsif ( scalar @_ and $_[0] =~ /^-release_namespace/ and shift) {
13 0         0 Class::MakeMethods::Emulator::namespace_release(__PACKAGE__, $emulation_target);
14             }
15             # The fallback should really be to NEXT::import.
16 2         5286 $mm_class->SUPER::import( @_ );
17             }
18              
19             ########################################################################
20              
21             use Class::MakeMethods (
22 2         26 'Template::Hash:new --with_values' => '_new_instance',
23             'Template::ClassVar:instance --get_init' => [ 'instance',
24             {new_method=>'_new_instance', variable=>'_instance'} ]
25 2     2   4766 );
  2         6  
26              
27             ########################################################################
28              
29             1;
30              
31             __END__