File Coverage

blib/lib/Moo/HandleMoose/FakeMetaClass.pm
Criterion Covered Total %
statement 26 26 100.0
branch 10 10 100.0
condition 8 9 88.8
subroutine 9 9 100.0
pod 0 3 0.0
total 53 57 92.9


line stmt bran cond sub pod time code
1             package Moo::HandleMoose::FakeMetaClass;
2 88     88   143896 use strict;
  88         259  
  88         2769  
3 88     88   531 use warnings;
  88         213  
  88         2101  
4              
5 88     88   484 use Carp ();
  88         199  
  88         2947  
6 88     88   31955 BEGIN { our @CARP_NOT = qw(Moo::HandleMoose) }
7              
8       2     sub DESTROY { }
9              
10             sub AUTOLOAD {
11 138     138   245168 my ($meth) = (our $AUTOLOAD =~ /([^:]+)$/);
12 138         379 my $self = shift;
13 138 100       1162 Carp::croak "Can't call $meth without object instance"
14             if !ref $self;
15 134 100       824 Carp::croak "Can't inflate Moose metaclass with Moo::sification disabled"
16             if $Moo::sification::disabled;
17 130         1660 require Moo::HandleMoose;
18 130         784 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->$meth(@_)
19             }
20             sub can {
21 40     40 0 215307 my $self = shift;
22 40 100 100     378 return $self->SUPER::can(@_)
23             if !ref $self or $Moo::sification::disabled;
24 32         1617 require Moo::HandleMoose;
25 32         228 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->can(@_)
26             }
27             sub isa {
28 92     92 0 1432458 my $self = shift;
29 92 100 100     777 return $self->SUPER::isa(@_)
30             if !ref $self or $Moo::sification::disabled;
31              
32             # prevent inflation by Devel::StackTrace, which does this check. examining
33             # the stack trace in an exception from inflation could re-trigger inflation
34             # and cause another exception.
35 88 100 66     640 return !!0
36             if @_ == 1 && $_[0] eq 'Exception::Class::Base';
37              
38 82         534 require Moo::HandleMoose;
39 82         657 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->isa(@_)
40             }
41 6     6 0 25 sub make_immutable { $_[0] }
42              
43             1;