File Coverage

/tmp/m6wxE4KPH1.mite.pm
Criterion Covered Total %
statement 72 88 81.8
branch 18 40 45.0
condition 9 27 33.3
subroutine 15 15 100.0
pod n/a
total 114 170 67.0


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