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   167978 use strict;
  88         266  
  88         3009  
3 88     88   553 use warnings;
  88         197  
  88         2410  
4              
5 88     88   499 use Carp ();
  88         226  
  88         3109  
6 88     88   33004 BEGIN { our @CARP_NOT = qw(Moo::HandleMoose) }
7              
8       2     sub DESTROY { }
9              
10             sub AUTOLOAD {
11 138     138   258888 my ($meth) = (our $AUTOLOAD =~ /([^:]+)$/);
12 138         491 my $self = shift;
13 138 100       1192 Carp::croak "Can't call $meth without object instance"
14             if !ref $self;
15 134 100       1034 Carp::croak "Can't inflate Moose metaclass with Moo::sification disabled"
16             if $Moo::sification::disabled;
17 130         1907 require Moo::HandleMoose;
18 130         756 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->$meth(@_)
19             }
20             sub can {
21 36     36 0 220248 my $self = shift;
22 36 100 100     243 return $self->SUPER::can(@_)
23             if !ref $self or $Moo::sification::disabled;
24 32         1068 require Moo::HandleMoose;
25 32         260 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->can(@_)
26             }
27             sub isa {
28 92     92 0 1518485 my $self = shift;
29 92 100 100     1922 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     647 return !!0
36             if @_ == 1 && $_[0] eq 'Exception::Class::Base';
37              
38 82         597 require Moo::HandleMoose;
39 82         712 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->isa(@_)
40             }
41 6     6 0 27 sub make_immutable { $_[0] }
42              
43             1;