File Coverage

/tmp/3Ao5RWkZRr.mite.pm
Criterion Covered Total %
statement 80 99 80.8
branch 19 40 47.5
condition 6 27 22.2
subroutine 15 16 93.7
pod n/a
total 120 182 65.9


line stmt bran cond sub pod time code
1             {
2             package FooCR;
3 2     2   32 use strict;
  2         30  
  2         192  
4 2     2   64 use warnings;
  2         26  
  2         256  
5 2     2   28 no warnings qw( once void );
  2         14  
  2         628  
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   22 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "FooCR" );
13 2         18 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
14             package Mite::Shim;
15 2     2   14 no warnings 'redefine';
  2         22  
  2         780  
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         432 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         212 );
25             };
26             };
27              
28             # Gather metadata for constructor and destructor
29             sub __META__ {
30 2     2   54 no strict 'refs';
  2         10  
  2         1294  
31 2   33 2   6 my $class = shift; $class = ref($class) || $class;
  2         18  
32 2         20 my $linear_isa = mro::get_linear_isa( $class );
33             return {
34             BUILD => [
35 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         26  
  0         0  
36 2         8 map { "$_\::BUILD" } reverse @$linear_isa
37             ],
38             DEMOLISH => [
39 2 50       12 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         48  
  0         0  
40 2         8 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   362 my $class = ref($_[0]) ? ref(shift) : shift;
51 2   33     28 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
52 2         6 my $self = bless {}, $class;
53 2 50       22 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 num (type: __ANON__)
57             # has declaration, file ../../../../tmp/3Ao5RWkZRr, line 4
58 2 50       14 if ( exists $args->{"num"} ) { do { package FooCR::__SAFE_NAMESPACE__; do { local $_ = $args->{"num"};local @_ = ($args->{"num"}); !!eval{ # BEGIN quote_sub PRELUDE
  2 50       4  
  2         2  
  2         4  
  2         8  
  2         4  
59             package FooCR;
60             BEGIN {
61 2     2   14 $^H = 133090;
62 2         16 ${^WARNING_BITS} = "UUUUUUUUUUUUUUUUUU\001";
63 2         1466 %^H = (
64             );
65             }
66             # END quote_sub PRELUDE
67 2         8 $_[0] > 0 } } } or Mite::Shim::croak "Type check failed in constructor: %s should be %s", "num", "__ANON__"; $self->{"num"} = $args->{"num"}; } ;
  2         10  
68              
69              
70             # Call BUILD methods
71 2 50 33     8 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
  2 50       28  
72              
73             # Unrecognized parameters
74 2 50       6 my @unknown = grep not( /\Anum\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
  2         14  
  2         8  
75              
76 2         18 return $self;
77             }
78              
79             # Used by constructor to call BUILD methods
80             sub BUILDALL {
81 0     0   0 my $class = ref( $_[0] );
82 0   0     0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
83 0 0       0 $_->( @_ ) for @{ $meta->{BUILD} || [] };
  0         0  
84             }
85              
86             # Destructor should call DEMOLISH methods
87             sub DESTROY {
88 2     2   1618 my $self = shift;
89 2   33     10 my $class = ref( $self ) || $self;
90 2   33     22 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
91 2 50       12 my $in_global_destruction = defined ${^GLOBAL_PHASE}
92             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
93             : Devel::GlobalDestruction::in_global_destruction();
94 2 50       12 for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
  2         10  
95 0         0 my $e = do {
96 0         0 local ( $?, $@ );
97 0         0 eval { $demolisher->( $self, $in_global_destruction ) };
  0         0  
98 0         0 $@;
99             };
100 2     2   54 no warnings 'misc'; # avoid (in cleanup) warnings
  2         50  
  2         584  
101 0 0       0 die $e if $e; # rethrow
102             }
103 2         26 return;
104             }
105              
106             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
107              
108             # Accessors for num
109             # has declaration, file ../../../../tmp/3Ao5RWkZRr, line 4
110 4 100       8 sub num { @_ > 1 ? do { do { package FooCR::__SAFE_NAMESPACE__; do { local $_ = $_[1];local @_ = ($_[1]); !!eval{ # BEGIN quote_sub PRELUDE
  4         6  
  4         14  
  4         16  
  4         6  
111             package FooCR;
112             BEGIN {
113 2     2   22 $^H = 133090;
114 2         22 ${^WARNING_BITS} = "UUUUUUUUUUUUUUUUUU\001";
115 2         824 %^H = (
116             );
117             }
118             # END quote_sub PRELUDE
119 6 100   6   82 $_[0] > 0 } } } or Mite::Shim::croak( "Type check failed in %s: value should be %s", "accessor", "__ANON__" ); $_[0]{"num"} = $_[1]; $_[0]; } : ( $_[0]{"num"} ) }
  4         46  
  2         14  
  2         6  
120              
121              
122             # See UNIVERSAL
123             sub DOES {
124 16     16   48 my ( $self, $role ) = @_;
125 16         30 our %DOES;
126 16 50       48 return $DOES{$role} if exists $DOES{$role};
127 16 50       34 return 1 if $role eq __PACKAGE__;
128 16 50 0     42 if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
      33        
129 0 0 0     0 $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
130             }
131 16         114 return $self->SUPER::DOES( $role );
132             }
133              
134             # Alias for Moose/Moo-compatibility
135             sub does {
136 16     16   1774 shift->DOES( @_ );
137             }
138              
139             1;
140             }