File Coverage

/tmp/eVTsxXaC8k.mite.pm
Criterion Covered Total %
statement 89 128 69.5
branch 20 64 31.2
condition 7 42 16.6
subroutine 21 23 91.3
pod n/a
total 137 257 53.3


line stmt bran cond sub pod time code
1             {
2             package MyTest;
3 1     1   17 use strict;
  1         8  
  1         87  
4 1     1   7 use warnings;
  1         9  
  1         130  
5 1     1   7 no warnings qw( once void );
  1         2  
  1         240  
6              
7             our $USES_MITE = "Mite::Class";
8             our $MITE_SHIM = "Mite::Shim";
9             our $MITE_VERSION = "0.012000";
10             # Mite keywords
11             BEGIN {
12 1     1   10 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest" );
13 1         9 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
14             package Mite::Shim;
15 1     1   10 no warnings 'redefine';
  1         4  
  1         364  
16             (
17 0         0 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
18 0         0 sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
19 0         0 sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
20             sub {},
21 2         14 sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
22 0         0 sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
23 0         0 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
24 1         90 );
25             };
26             };
27              
28              
29             BEGIN {
30            
31            
32 1     1   56 use mro 'c3';
  1         4  
  1         26  
33 1     1   71 our @ISA;
34 1         1198 push @ISA, "MyTest::Parent";
35             }
36              
37             # Standard Moose/Moo-style constructor
38             sub new {
39 1 50   1   144 my $class = ref($_[0]) ? ref(shift) : shift;
40 1   33     11 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
41 1         4 my $self = bless {}, $class;
42 1 50       5 my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
  0 50       0  
43 1         2 my $no_build = delete $args->{__no_BUILD__};
44              
45             # Attribute first
46             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 17
47 1 50       5 $self->{"first"} = ( exists( $args->{"first"} ) ? $args->{"first"} : $MyTest::Parent::__first_DEFAULT__->( $self ) );
48              
49             # Attribute second
50             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 20
51 1 50       4 $self->{"second"} = ( exists( $args->{"second"} ) ? $args->{"second"} : $MyTest::Parent::__second_DEFAULT__->( $self ) );
52              
53             # Attribute third
54             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 8
55 1 50       4 $self->{"third"} = ( exists( $args->{"third"} ) ? $args->{"third"} : $MyTest::__third_DEFAULT__->( $self ) );
56              
57             # Attribute fourth
58             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 11
59 1 50       3 $self->{"fourth"} = ( exists( $args->{"fourth"} ) ? $args->{"fourth"} : $MyTest::__fourth_DEFAULT__->( $self ) );
60              
61              
62             # Call BUILD methods
63 1 50 33     5 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
  1 50       6  
64              
65             # Unrecognized parameters
66 1 50       1 my @unknown = grep not( /\A(?:f(?:irst|ourth)|second|third)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
  1         3  
  1         3  
67              
68 1         4 return $self;
69             }
70              
71             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
72              
73             # Accessors for fourth
74             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 11
75             if ( $__XS ) {
76             Class::XSAccessor->import(
77             chained => 1,
78             "getters" => { "fourth" => "fourth" },
79             );
80             }
81             else {
82             *fourth = sub { @_ == 1 or Mite::Shim::croak( 'Reader "fourth" usage: $self->fourth()' ); $_[0]{"fourth"} };
83             }
84              
85             # Accessors for third
86             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 8
87             if ( $__XS ) {
88             Class::XSAccessor->import(
89             chained => 1,
90             "getters" => { "third" => "third" },
91             );
92             }
93             else {
94             *third = sub { @_ == 1 or Mite::Shim::croak( 'Reader "third" usage: $self->third()' ); $_[0]{"third"} };
95             }
96              
97              
98             # See UNIVERSAL
99             sub DOES {
100 7     7   10 my ( $self, $role ) = @_;
101 7         8 our %DOES;
102 7 50       14 return $DOES{$role} if exists $DOES{$role};
103 7 50       10 return 1 if $role eq __PACKAGE__;
104 7 50 0     13 if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
      33        
105 0 0 0     0 $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
106             }
107 7         25 return $self->SUPER::DOES( $role );
108             }
109              
110             # Alias for Moose/Moo-compatibility
111             sub does {
112 7     7   652 shift->DOES( @_ );
113             }
114              
115             1;
116             }{
117             package MyTest::Parent;
118 1     1   44 use strict;
  1         9  
  1         35  
119 1     1   7 use warnings;
  1         7  
  1         41  
120 1     1   6 no warnings qw( once void );
  1         13  
  1         160  
121              
122             our $USES_MITE = "Mite::Class";
123             our $MITE_SHIM = "Mite::Shim";
124             our $MITE_VERSION = "0.012000";
125             # Mite keywords
126             BEGIN {
127 1     1   5 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest::Parent" );
128 1         2 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
129             package Mite::Shim;
130 1     1   15 no warnings 'redefine';
  1         3  
  1         220  
131             (
132 0         0 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
133 0         0 sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
134 0         0 sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
135             sub {},
136 2         6 sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
137 0         0 sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
138 0         0 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
139 1         69 );
140             };
141             };
142              
143             # Gather metadata for constructor and destructor
144             sub __META__ {
145 1     1   7 no strict 'refs';
  1         2  
  1         830  
146 1   33 1   2 my $class = shift; $class = ref($class) || $class;
  1         4  
147 1         4 my $linear_isa = mro::get_linear_isa( $class );
148             return {
149             BUILD => [
150 2 50       2 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         9  
  0         0  
151 2         6 map { "$_\::BUILD" } reverse @$linear_isa
152             ],
153             DEMOLISH => [
154 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         26  
  0         0  
155 1         3 map { "$_\::DEMOLISH" } @$linear_isa
  2         5  
156             ],
157             HAS_BUILDARGS => $class->can('BUILDARGS'),
158             HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
159             };
160             }
161              
162              
163             # Standard Moose/Moo-style constructor
164             sub new {
165 0 0   0   0 my $class = ref($_[0]) ? ref(shift) : shift;
166 0   0     0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
167 0         0 my $self = bless {}, $class;
168 0 0       0 my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
  0 0       0  
169 0         0 my $no_build = delete $args->{__no_BUILD__};
170              
171             # Attribute first
172             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 17
173 0 0       0 $self->{"first"} = ( exists( $args->{"first"} ) ? $args->{"first"} : $MyTest::Parent::__first_DEFAULT__->( $self ) );
174              
175             # Attribute second
176             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 20
177 0 0       0 $self->{"second"} = ( exists( $args->{"second"} ) ? $args->{"second"} : $MyTest::Parent::__second_DEFAULT__->( $self ) );
178              
179              
180             # Call BUILD methods
181 0 0 0     0 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
  0 0       0  
182              
183             # Unrecognized parameters
184 0 0       0 my @unknown = grep not( /\A(?:first|second)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
  0         0  
  0         0  
185              
186 0         0 return $self;
187             }
188              
189             # Used by constructor to call BUILD methods
190             sub BUILDALL {
191 0     0   0 my $class = ref( $_[0] );
192 0   0     0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
193 0 0       0 $_->( @_ ) for @{ $meta->{BUILD} || [] };
  0         0  
194             }
195              
196             # Destructor should call DEMOLISH methods
197             sub DESTROY {
198 1     1   3512 my $self = shift;
199 1   33     5 my $class = ref( $self ) || $self;
200 1   33     3 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
201 1 50       5 my $in_global_destruction = defined ${^GLOBAL_PHASE}
202             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
203             : Devel::GlobalDestruction::in_global_destruction();
204 1 50       2 for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
  1         4  
205 0         0 my $e = do {
206 0         0 local ( $?, $@ );
207 0         0 eval { $demolisher->( $self, $in_global_destruction ) };
  0         0  
208 0         0 $@;
209             };
210 1     1   8 no warnings 'misc'; # avoid (in cleanup) warnings
  1         2  
  1         501  
211 0 0       0 die $e if $e; # rethrow
212             }
213 1         12 return;
214             }
215              
216             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
217              
218             # Accessors for first
219             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 17
220             if ( $__XS ) {
221             Class::XSAccessor->import(
222             chained => 1,
223             "getters" => { "first" => "first" },
224             );
225             }
226             else {
227             *first = sub { @_ == 1 or Mite::Shim::croak( 'Reader "first" usage: $self->first()' ); $_[0]{"first"} };
228             }
229              
230             # Accessors for second
231             # has declaration, file ../../../../tmp/eVTsxXaC8k, line 20
232             if ( $__XS ) {
233             Class::XSAccessor->import(
234             chained => 1,
235             "getters" => { "second" => "second" },
236             );
237             }
238             else {
239             *second = sub { @_ == 1 or Mite::Shim::croak( 'Reader "second" usage: $self->second()' ); $_[0]{"second"} };
240             }
241              
242              
243             # See UNIVERSAL
244             sub DOES {
245 14     14   19 my ( $self, $role ) = @_;
246 14         17 our %DOES;
247 14 50       20 return $DOES{$role} if exists $DOES{$role};
248 14 50       22 return 1 if $role eq __PACKAGE__;
249 14 50 0     21 if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
      33        
250 0 0 0     0 $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
251             }
252 14         85 return $self->SUPER::DOES( $role );
253             }
254              
255             # Alias for Moose/Moo-compatibility
256             sub does {
257 7     7   753 shift->DOES( @_ );
258             }
259              
260             1;
261             }