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   136048 use strict;
  88         277  
  88         2824  
3 88     88   450 use warnings;
  88         210  
  88         2200  
4              
5 88     88   476 use Carp ();
  88         191  
  88         2863  
6 88     88   30568 BEGIN { our @CARP_NOT = qw(Moo::HandleMoose) }
7              
8       2     sub DESTROY { }
9              
10             sub AUTOLOAD {
11 138     138   282956 my ($meth) = (our $AUTOLOAD =~ /([^:]+)$/);
12 138         347 my $self = shift;
13 138 100       1051 Carp::croak "Can't call $meth without object instance"
14             if !ref $self;
15 134 100       993 Carp::croak "Can't inflate Moose metaclass with Moo::sification disabled"
16             if $Moo::sification::disabled;
17 130         1799 require Moo::HandleMoose;
18 130         704 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->$meth(@_)
19             }
20             sub can {
21 36     36 0 178564 my $self = shift;
22 36 100 100     251 return $self->SUPER::can(@_)
23             if !ref $self or $Moo::sification::disabled;
24 32         961 require Moo::HandleMoose;
25 32         223 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->can(@_)
26             }
27             sub isa {
28 92     92 0 1333416 my $self = shift;
29 92 100 100     1770 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     651 return !!0
36             if @_ == 1 && $_[0] eq 'Exception::Class::Base';
37              
38 82         548 require Moo::HandleMoose;
39 82         719 Moo::HandleMoose::inject_real_metaclass_for($self->{name})->isa(@_)
40             }
41 6     6 0 33 sub make_immutable { $_[0] }
42              
43             1;