File Coverage

/tmp/LHpJZbTBlE.mite.pm
Criterion Covered Total %
statement 65 84 77.3
branch 16 38 42.1
condition 6 27 22.2
subroutine 14 15 93.3
pod n/a
total 101 164 61.5


line stmt bran cond sub pod time code
1             {
2             use Storable ();
3 2     2   28 use strict;
  2         14  
  2         62  
4 2     2   20 use warnings;
  2         10  
  2         104  
5 2     2   26 no warnings qw( once void );
  2         6  
  2         154  
6 2     2   18  
  2         6  
  2         444  
7             our $USES_MITE = "Mite::Class";
8             our $MITE_SHIM = "Mite::Shim";
9             our $MITE_VERSION = "0.010008";
10             # Mite keywords
11             BEGIN {
12             my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest" );
13 2     2   16 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
14 2         10 no warnings 'redefine';
15             (
16 2     2   20 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  2         14  
  2         448  
17             sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
18 0         0 sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
19 0         0 sub {},
20 0         0 sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
21             sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
22 2         20 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
23 0         0 );
24 0         0 };
25 2         108  
26             # Gather metadata for constructor and destructor
27             no strict 'refs';
28             my $class = shift; $class = ref($class) || $class;
29             my $linear_isa = mro::get_linear_isa( $class );
30             return {
31 2     2   18 BUILD => [
  2         16  
  2         1466  
32 2   33 2   4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         18  
33 2         20 map { "$_\::BUILD" } reverse @$linear_isa
34             ],
35             DEMOLISH => [
36 2 50       4 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  2         22  
  0         0  
37 2         6 map { "$_\::DEMOLISH" } @$linear_isa
38             ],
39             HAS_BUILDARGS => $class->can('BUILDARGS'),
40 2 50       4 HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
  2         24  
  0         0  
41 2         8 };
  2         8  
42             }
43              
44              
45             # Standard Moose/Moo-style constructor
46             my $class = ref($_[0]) ? ref(shift) : shift;
47             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
48             my $self = bless {}, $class;
49             my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ };
50             my $no_build = delete $args->{__no_BUILD__};
51 2 50   2   314  
52 2   33     34 # Attribute foo
53 2         12 # has declaration, file ../../../../tmp/LHpJZbTBlE, line 3
54 2 50       8 $args->{"foo"} = Storable::dclone( $args->{"foo"} ) if exists( $args->{"foo"} );
  0 50       0  
55 2         6 if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ;
56              
57              
58             # Call BUILD methods
59 2 50       212 $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
60 2 50       18  
  2         10  
61             # Unrecognized parameters
62             my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
63              
64 2 50 33     8 return $self;
  2 50       10  
65             }
66              
67 2 50       6 # Used by constructor to call BUILD methods
  2         12  
  2         14  
68             my $class = ref( $_[0] );
69 2         18 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
70             $_->( @_ ) for @{ $meta->{BUILD} || [] };
71             }
72              
73             # Destructor should call DEMOLISH methods
74 0     0   0 my $self = shift;
75 0   0     0 my $class = ref( $self ) || $self;
76 0 0       0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
  0         0  
77             my $in_global_destruction = defined ${^GLOBAL_PHASE}
78             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
79             : Devel::GlobalDestruction::in_global_destruction();
80             for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
81 2     2   4316 my $e = do {
82 2   33     8 local ( $?, $@ );
83 2   33     4 eval { $demolisher->( $self, $in_global_destruction ) };
84 2 50       8 $@;
85             };
86             no warnings 'misc'; # avoid (in cleanup) warnings
87 2 50       2 die $e if $e; # rethrow
  2         12  
88 0         0 }
89 0         0 return;
90 0         0 }
  0         0  
91 0         0  
92             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
93 2     2   12  
  2         14  
  2         606  
94 0 0       0 # Accessors for foo
95             # has declaration, file ../../../../tmp/LHpJZbTBlE, line 3
96 2         16  
97              
98             # See UNIVERSAL
99             my ( $self, $role ) = @_;
100             our %DOES;
101             return $DOES{$role} if exists $DOES{$role};
102             return 1 if $role eq __PACKAGE__;
103 2 50   2   22 if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
  2         50  
104             $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
105             }
106             return $self->SUPER::DOES( $role );
107             }
108 14     14   24  
109 14         18 # Alias for Moose/Moo-compatibility
110 14 50       22 shift->DOES( @_ );
111 14 50       32 }
112 14 50 0     38  
      33        
113 0 0 0     0 1;