File Coverage

/tmp/IlsDHCr1tD.mite.pm
Criterion Covered Total %
statement 99 125 79.2
branch 25 58 43.1
condition 9 42 21.4
subroutine 22 23 95.6
pod n/a
total 155 248 62.5


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