File Coverage

/tmp/RyOyCsLeL_.mite.pm
Criterion Covered Total %
statement 61 80 76.2
branch 18 40 45.0
condition 7 27 25.9
subroutine 12 13 92.3
pod n/a
total 98 160 61.2


line stmt bran cond sub pod time code
1             {
2             use strict;
3 1     1   7 use warnings;
  1         1  
  1         31  
4 1     1   5 no warnings qw( once void );
  1         2  
  1         31  
5 1     1   12  
  1         2  
  1         140  
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", "Foo" );
12 1     1   5 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
13 1         1 no warnings 'redefine';
14             (
15 1     1   7 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  1         2  
  1         197  
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 4         13 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
22 0         0 );
23 0         0 };
24 1         60  
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   6 BUILD => [
  1         2  
  1         736  
31 1   33 1   4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         5  
32 1         6 map { "$_\::BUILD" } reverse @$linear_isa
33             ],
34             DEMOLISH => [
35 1 50       2 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         7  
  0         0  
36 1         4 map { "$_\::DEMOLISH" } @$linear_isa
37             ],
38             HAS_BUILDARGS => $class->can('BUILDARGS'),
39 1 50       1 HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
  1         17  
  0         0  
40 1         3 };
  1         4  
41             }
42              
43              
44             # Standard Moose/Moo-style constructor
45             my $class = ref($_[0]) ? ref(shift) : shift;
46             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
47             my $self = bless {}, $class;
48             my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
49             my $no_build = delete $args->{__no_BUILD__};
50 7 50   7   18168  
51 7   66     31 # Attribute number
52 7         13 # has declaration, file ../../../../tmp/RyOyCsLeL_, line 11
53 7 50       21 $self->{"number"} = ( exists( $args->{"number"} ) ? $args->{"number"} : $Foo::__number_DEFAULT__->( $self ) );
  0 50       0  
54 7         19  
55             # Attribute list
56             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 15
57             $self->{"list"} = ( exists( $args->{"list"} ) ? $args->{"list"} : $Foo::__list_DEFAULT__->( $self ) );
58 7 100       21  
59             # Attribute closure
60             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 20
61             $self->{"closure"} = ( exists( $args->{"closure"} ) ? $args->{"closure"} : $Foo::__closure_DEFAULT__->( $self ) );
62 7 50       17  
63             # Attribute counter
64             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 28
65             $self->{"counter"} = ( exists( $args->{"counter"} ) ? $args->{"counter"} : $Foo::__counter_DEFAULT__->( $self ) );
66 7 50       17  
67              
68             # Call BUILD methods
69             $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
70 7 50       17  
71             # Unrecognized parameters
72             my @unknown = grep not( /\A(?:c(?:losure|ounter)|list|number)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
73              
74 7 50 33     16 return $self;
  7 50       40  
75             }
76              
77 7 50       9 # Used by constructor to call BUILD methods
  7         21  
  7         18  
78             my $class = ref( $_[0] );
79 7         25 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
80             $_->( @_ ) for @{ $meta->{BUILD} || [] };
81             }
82              
83             # Destructor should call DEMOLISH methods
84 0     0   0 my $self = shift;
85 0   0     0 my $class = ref( $self ) || $self;
86 0 0       0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
  0         0  
87             my $in_global_destruction = defined ${^GLOBAL_PHASE}
88             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
89             : Devel::GlobalDestruction::in_global_destruction();
90             for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
91 7     7   8194 my $e = do {
92 7   33     19 local ( $?, $@ );
93 7   33     17 eval { $demolisher->( $self, $in_global_destruction ) };
94 7 50       19 $@;
95             };
96             no warnings 'misc'; # avoid (in cleanup) warnings
97 7 50       10 die $e if $e; # rethrow
  7         18  
98 0         0 }
99 0         0 return;
100 0         0 }
  0         0  
101 0         0  
102             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
103 1     1   8  
  1         2  
  1         602  
104 0 0       0 # Accessors for closure
105             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 20
106 7         50 if ( $__XS ) {
107             Class::XSAccessor->import(
108             chained => 1,
109             "accessors" => { "closure" => "closure" },
110             );
111             }
112             else {
113             *closure = sub { @_ > 1 ? do { $_[0]{"closure"} = $_[1]; $_[0]; } : ( $_[0]{"closure"} ) };
114             }
115              
116             # Accessors for counter
117             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 28
118             if ( $__XS ) {
119             Class::XSAccessor->import(
120             chained => 1,
121             "accessors" => { "counter" => "counter" },
122             );
123             }
124             else {
125             *counter = sub { @_ > 1 ? do { $_[0]{"counter"} = $_[1]; $_[0]; } : ( $_[0]{"counter"} ) };
126             }
127              
128             # Accessors for list
129             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 15
130             if ( $__XS ) {
131             Class::XSAccessor->import(
132             chained => 1,
133             "accessors" => { "list" => "list" },
134             );
135             }
136             else {
137             *list = sub { @_ > 1 ? do { $_[0]{"list"} = $_[1]; $_[0]; } : ( $_[0]{"list"} ) };
138             }
139              
140             # Accessors for number
141             # has declaration, file ../../../../tmp/RyOyCsLeL_, line 11
142             if ( $__XS ) {
143             Class::XSAccessor->import(
144             chained => 1,
145             "accessors" => { "number" => "number" },
146             );
147             }
148             else {
149             *number = sub { @_ > 1 ? do { $_[0]{"number"} = $_[1]; $_[0]; } : ( $_[0]{"number"} ) };
150             }
151              
152              
153             # See UNIVERSAL
154             my ( $self, $role ) = @_;
155             our %DOES;
156             return $DOES{$role} if exists $DOES{$role};
157             return 1 if $role eq __PACKAGE__;
158             if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
159             $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
160             }
161             return $self->SUPER::DOES( $role );
162 7     7   14 }
163 7         8  
164 7 50       13 # Alias for Moose/Moo-compatibility
165 7 50       11 shift->DOES( @_ );
166 7 50 0     14 }
      33        
167 0 0 0     0  
168             1;