File Coverage

/tmp/90Uxee6Yft.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   8 use warnings;
  1         11  
  1         30  
4 1     1   5 no warnings qw( once void );
  1         2  
  1         33  
5 1     1   5  
  1         9  
  1         128  
6             our $USES_MITE = "Mite::Class";
7             our $MITE_SHIM = "Mite::Shim";
8             our $MITE_VERSION = "0.010008";
9             # Mite keywords
10             BEGIN {
11             my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Foo" );
12 1     1   10 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
13 1         1 no warnings 'redefine';
14             (
15 1     1   10 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  1         1  
  1         186  
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         10 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
22 0         0 );
23 0         0 };
24 1         47  
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         1  
  1         806  
31 1   33 1   2 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         3  
32 1         6 map { "$_\::BUILD" } reverse @$linear_isa
33             ],
34             DEMOLISH => [
35 1 50       2 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         5  
  0         0  
36 1         3 map { "$_\::DEMOLISH" } @$linear_isa
37             ],
38             HAS_BUILDARGS => $class->can('BUILDARGS'),
39 1 50       1 HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
  1         14  
  0         0  
40 1         1 };
  1         15  
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   20495  
51 7   66     20 # Attribute number
52 7         11 # has declaration, file ../../../../tmp/90Uxee6Yft, line 11
53 7 50       19 $self->{"number"} = ( exists( $args->{"number"} ) ? $args->{"number"} : $Foo::__number_DEFAULT__->( $self ) );
  0 50       0  
54 7         7  
55             # Attribute list
56             # has declaration, file ../../../../tmp/90Uxee6Yft, line 15
57             $self->{"list"} = ( exists( $args->{"list"} ) ? $args->{"list"} : $Foo::__list_DEFAULT__->( $self ) );
58 7 100       18  
59             # Attribute closure
60             # has declaration, file ../../../../tmp/90Uxee6Yft, line 20
61             $self->{"closure"} = ( exists( $args->{"closure"} ) ? $args->{"closure"} : $Foo::__closure_DEFAULT__->( $self ) );
62 7 50       19  
63             # Attribute counter
64             # has declaration, file ../../../../tmp/90Uxee6Yft, line 28
65             $self->{"counter"} = ( exists( $args->{"counter"} ) ? $args->{"counter"} : $Foo::__counter_DEFAULT__->( $self ) );
66 7 50       14  
67              
68             # Call BUILD methods
69             $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
70 7 50       26  
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     14 return $self;
  7 50       24  
75             }
76              
77 7 50       8 # Used by constructor to call BUILD methods
  7         22  
  7         12  
78             my $class = ref( $_[0] );
79 7         20 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   6687 my $e = do {
92 7   33     22 local ( $?, $@ );
93 7   33     14 eval { $demolisher->( $self, $in_global_destruction ) };
94 7 50       17 $@;
95             };
96             no warnings 'misc'; # avoid (in cleanup) warnings
97 7 50       10 die $e if $e; # rethrow
  7         13  
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   13  
  1         2  
  1         599  
104 0 0       0 # Accessors for closure
105             # has declaration, file ../../../../tmp/90Uxee6Yft, line 20
106 7         41 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/90Uxee6Yft, 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/90Uxee6Yft, 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/90Uxee6Yft, 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   8 }
163 7         13  
164 7 50       12 # Alias for Moose/Moo-compatibility
165 7 50       8 shift->DOES( @_ );
166 7 50 0     11 }
      33        
167 0 0 0     0  
168             1;