File Coverage

/tmp/74rLRJ5T68.mite.pm
Criterion Covered Total %
statement 121 162 74.6
branch 31 76 40.7
condition 13 57 22.8
subroutine 26 29 89.6
pod n/a
total 191 324 58.9


line stmt bran cond sub pod time code
1             {
2             package RandomThing;
3 2     2   12 use strict;
  2         4  
  2         62  
4 2     2   92 use warnings;
  2         6  
  2         94  
5 2     2   12 no warnings qw( once void );
  2         8  
  2         348  
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 2     2   10 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "RandomThing" );
13 2         2 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
14             package Mite::Shim;
15 2     2   14 no warnings 'redefine';
  2         4  
  2         404  
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         10 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 2         98 );
25             };
26             };
27              
28             # Gather metadata for constructor and destructor
29             sub __META__ {
30 2     2   14 no strict 'refs';
  2         4  
  2         1336  
31 2   33 2   8 my $class = shift; $class = ref($class) || $class;
  2         24  
32 2         8 my $linear_isa = mro::get_linear_isa( $class );
33             return {
34             BUILD => [
35 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         28  
  0         0  
36 2         8 map { "$_\::BUILD" } reverse @$linear_isa
37             ],
38             DEMOLISH => [
39 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         30  
  0         0  
40 2         4 map { "$_\::DEMOLISH" } @$linear_isa
  2         8  
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 2 50   2   6 my $class = ref($_[0]) ? ref(shift) : shift;
51 2   33     22 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
52 2         6 my $self = bless {}, $class;
53 2 50       8 my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
  0 50       0  
54 2         6 my $no_build = delete $args->{__no_BUILD__};
55              
56             # Attribute number
57             # has declaration, file ../../../../tmp/74rLRJ5T68, line 5
58 2 50       12 $self->{"number"} = ( exists( $args->{"number"} ) ? $args->{"number"} : $self->_build_number );
59              
60              
61             # Call BUILD methods
62 2 50 33     6 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
  2 50       12  
63              
64             # Unrecognized parameters
65 2 50       2 my @unknown = grep not( /\Anumber\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
  2         6  
  2         4  
66              
67 2         24 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   2 my $self = shift;
80 2   33     8 my $class = ref( $self ) || $self;
81 2   33     6 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
82 2 50       12 my $in_global_destruction = defined ${^GLOBAL_PHASE}
83             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
84             : Devel::GlobalDestruction::in_global_destruction();
85 2 50       4 for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
  2         8  
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 2     2   16 no warnings 'misc'; # avoid (in cleanup) warnings
  2         4  
  2         778  
92 0 0       0 die $e if $e; # rethrow
93             }
94 2         40 return;
95             }
96              
97             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
98              
99             # Accessors for number
100             # has declaration, file ../../../../tmp/74rLRJ5T68, line 5
101             if ( $__XS ) {
102             Class::XSAccessor->import(
103             chained => 1,
104             "getters" => { "number" => "number" },
105             );
106             }
107             else {
108             *number = sub { @_ == 1 or Mite::Shim::croak( 'Reader "number" usage: $self->number()' ); $_[0]{"number"} };
109             }
110              
111              
112             # See UNIVERSAL
113             sub DOES {
114 14     14   28 my ( $self, $role ) = @_;
115 14         14 our %DOES;
116 14 50       26 return $DOES{$role} if exists $DOES{$role};
117 14 50       28 return 1 if $role eq __PACKAGE__;
118 14 50 0     28 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         74 return $self->SUPER::DOES( $role );
122             }
123              
124             # Alias for Moose/Moo-compatibility
125             sub does {
126 14     14   4022 shift->DOES( @_ );
127             }
128              
129             1;
130             }{
131             package GatewayToRandom;
132 2     2   16 use strict;
  2         4  
  2         62  
133 2     2   12 use warnings;
  2         2  
  2         76  
134 2     2   14 no warnings qw( once void );
  2         4  
  2         224  
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 2     2   8 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "GatewayToRandom" );
142 2         4 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
143             package Mite::Shim;
144 2     2   14 no warnings 'redefine';
  2         2  
  2         382  
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 2         8 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 2         100 );
154             };
155             };
156              
157             # Gather metadata for constructor and destructor
158             sub __META__ {
159 2     2   14 no strict 'refs';
  2         2  
  2         1170  
160 2   33 2   6 my $class = shift; $class = ref($class) || $class;
  2         10  
161 2         12 my $linear_isa = mro::get_linear_isa( $class );
162             return {
163             BUILD => [
164 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         14  
  0         0  
165 2         10 map { "$_\::BUILD" } reverse @$linear_isa
166             ],
167             DEMOLISH => [
168 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         28  
  0         0  
169 2         6 map { "$_\::DEMOLISH" } @$linear_isa
  2         6  
170             ],
171             HAS_BUILDARGS => $class->can('BUILDARGS'),
172             HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
173             };
174             }
175              
176              
177             # Standard Moose/Moo-style constructor
178             sub new {
179 2 50   2   334 my $class = ref($_[0]) ? ref(shift) : shift;
180 2   33     40 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
181 2         8 my $self = bless {}, $class;
182 2 50       10 my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
  0 50       0  
183 2         46 my $no_build = delete $args->{__no_BUILD__};
184              
185             # Attribute random_thing
186             # has declaration, file ../../../../tmp/74rLRJ5T68, line 12
187 2 50       8 if ( exists $args->{"random_thing"} ) { $self->{"random_thing"} = $args->{"random_thing"}; } ;
  0         0  
188              
189              
190             # Call BUILD methods
191 2 50 33     10 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
  2 50       10  
192              
193             # Unrecognized parameters
194 2 50       2 my @unknown = grep not( /\Arandom_thing\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
  2         34  
  2         10  
195              
196 2         18 return $self;
197             }
198              
199             # Used by constructor to call BUILD methods
200             sub BUILDALL {
201 0     0   0 my $class = ref( $_[0] );
202 0   0     0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
203 0 0       0 $_->( @_ ) for @{ $meta->{BUILD} || [] };
  0         0  
204             }
205              
206             # Destructor should call DEMOLISH methods
207             sub DESTROY {
208 2     2   1250 my $self = shift;
209 2   33     8 my $class = ref( $self ) || $self;
210 2   33     6 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
211 2 50       10 my $in_global_destruction = defined ${^GLOBAL_PHASE}
212             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
213             : Devel::GlobalDestruction::in_global_destruction();
214 2 50       2 for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
  2         10  
215 0         0 my $e = do {
216 0         0 local ( $?, $@ );
217 0         0 eval { $demolisher->( $self, $in_global_destruction ) };
  0         0  
218 0         0 $@;
219             };
220 2     2   16 no warnings 'misc'; # avoid (in cleanup) warnings
  2         4  
  2         998  
221 0 0       0 die $e if $e; # rethrow
222             }
223 2         10 return;
224             }
225              
226             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
227              
228             # Accessors for random_thing
229             # has declaration, file ../../../../tmp/74rLRJ5T68, line 12
230 18 100 33 18   18 sub _assert_blessed_random_thing { my $object = do { ( exists($_[0]{"random_thing"}) ? $_[0]{"random_thing"} : ( $_[0]{"random_thing"} = $_[0]->_build_random_thing ) ) }; require Scalar::Util && Scalar::Util::blessed($object) or Mite::Shim::croak( "random_thing is not a blessed object" ); $object }
  18 50       52  
  18         176  
  18         122  
231 0 0   0   0 sub random_thing { @_ == 1 or Mite::Shim::croak( 'Reader "random_thing" usage: $self->random_thing()' ); ( exists($_[0]{"random_thing"}) ? $_[0]{"random_thing"} : ( $_[0]{"random_thing"} = $_[0]->_build_random_thing ) ) }
  0 0       0  
232              
233             # Delegated methods for random_thing
234             # has declaration, file ../../../../tmp/74rLRJ5T68, line 12
235 18     18   62 sub number { shift->_assert_blessed_random_thing->number( @_ ) }
236              
237              
238             # See UNIVERSAL
239             sub DOES {
240 14     14   26 my ( $self, $role ) = @_;
241 14         16 our %DOES;
242 14 50       26 return $DOES{$role} if exists $DOES{$role};
243 14 50       24 return 1 if $role eq __PACKAGE__;
244 14 50 0     22 if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
      33        
245 0 0 0     0 $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
246             }
247 14         78 return $self->SUPER::DOES( $role );
248             }
249              
250             # Alias for Moose/Moo-compatibility
251             sub does {
252 14     14   1536 shift->DOES( @_ );
253             }
254              
255             1;
256             }