File Coverage

/tmp/fYXIQj1tqP.mite.pm
Criterion Covered Total %
statement 35 94 37.2
branch 0 36 0.0
condition 0 27 0.0
subroutine 8 23 34.7
pod n/a
total 43 180 23.8


line stmt bran cond sub pod time code
1             {
2             use strict;
3 1     1   15 use warnings;
  1         9  
  1         64  
4 1     1   6 no warnings qw( once void );
  1         6  
  1         89  
5 1     1   11  
  1         3  
  1         246  
6             our $USES_MITE = "Mite::Class";
7             our $MITE_SHIM = "Mite::Shim";
8             our $MITE_VERSION = "0.010008";
9             # Mite keywords
10             BEGIN {
11             my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTestAll" );
12 1     1   4 ( *after, *around, *before, *extends, *field, *has, *param, *signature_for, *with ) = do {
13 1         67 no warnings 'redefine';
14             (
15 1     1   11 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  1         6  
  1         265  
16             sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
17 0     0   0 sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
18 0     0   0 sub {},
19 0     0   0 sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
20       0     sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
21 0     0   0 sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
22 0     0   0 sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
23 0     0   0 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
24 0     0   0 );
25 0     0   0 };
26 1         254  
27             # Mite imports
28             BEGIN {
29             require Scalar::Util;
30             *STRICT = \&Mite::Shim::STRICT;
31             *bare = \&Mite::Shim::bare;
32 1     1   7 *blessed = \&Scalar::Util::blessed;
33 1         8 *carp = \&Mite::Shim::carp;
34 1         3 *confess = \&Mite::Shim::confess;
35 1         33 *croak = \&Mite::Shim::croak;
36 1         5 *false = \&Mite::Shim::false;
37 1         2 *guard = \&Mite::Shim::guard;
38 1         3 *lazy = \&Mite::Shim::lazy;
39 1         1 *ro = \&Mite::Shim::ro;
40 1         7 *rw = \&Mite::Shim::rw;
41 1         7 *rwp = \&Mite::Shim::rwp;
42 1         3 *true = \&Mite::Shim::true;
43 1         1 };
44 1         2  
45 1         38 # Gather metadata for constructor and destructor
46             no strict 'refs';
47             my $class = shift; $class = ref($class) || $class;
48             my $linear_isa = mro::get_linear_isa( $class );
49             return {
50 1     1   6 BUILD => [
  1         2  
  1         647  
51 0   0 0     map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  0            
52 0           map { "$_\::BUILD" } reverse @$linear_isa
53             ],
54             DEMOLISH => [
55 0 0         map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  0            
  0            
56 0           map { "$_\::DEMOLISH" } @$linear_isa
57             ],
58             HAS_BUILDARGS => $class->can('BUILDARGS'),
59 0 0         HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
  0            
  0            
60 0           };
  0            
61             }
62              
63              
64             # Standard Moose/Moo-style constructor
65             my $class = ref($_[0]) ? ref(shift) : shift;
66             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
67             my $self = bless {}, $class;
68             my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
69             my $no_build = delete $args->{__no_BUILD__};
70 0 0   0      
71 0   0        
72 0            
73 0 0         # Call BUILD methods
  0 0          
74 0           $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
75              
76             # Unrecognized parameters
77              
78             return $self;
79 0 0 0       }
  0 0          
80              
81             # Used by constructor to call BUILD methods
82 0 0         my $class = ref( $_[0] );
  0 0          
  0 0          
  0            
  0            
83             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
84 0           $_->( @_ ) for @{ $meta->{BUILD} || [] };
85             }
86              
87             # Destructor should call DEMOLISH methods
88             my $self = shift;
89 0     0     my $class = ref( $self ) || $self;
90 0   0       my $meta = ( $Mite::META{$class} ||= $class->__META__ );
91 0 0         my $in_global_destruction = defined ${^GLOBAL_PHASE}
  0            
92             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
93             : Devel::GlobalDestruction::in_global_destruction();
94             for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
95             my $e = do {
96 0     0     local ( $?, $@ );
97 0   0       eval { $demolisher->( $self, $in_global_destruction ) };
98 0   0       $@;
99 0 0         };
100             no warnings 'misc'; # avoid (in cleanup) warnings
101             die $e if $e; # rethrow
102 0 0         }
  0            
103 0           return;
104 0           }
105 0            
  0            
106 0            
107             # See UNIVERSAL
108 1     1   12 my ( $self, $role ) = @_;
  1         2  
  1         226  
109 0 0         our %DOES;
110             return $DOES{$role} if exists $DOES{$role};
111 0           return 1 if $role eq __PACKAGE__;
112             if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
113             $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
114             }
115             return $self->SUPER::DOES( $role );
116             }
117 0     0      
118 0           # Alias for Moose/Moo-compatibility
119 0 0         shift->DOES( @_ );
120 0 0         }
121 0 0 0        
      0        
122 0 0 0       1;