line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package FooMatch; |
3
|
4
|
|
|
4
|
|
84
|
use strict; |
|
4
|
|
|
|
|
64
|
|
|
4
|
|
|
|
|
520
|
|
4
|
4
|
|
|
4
|
|
132
|
use warnings; |
|
4
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
496
|
|
5
|
4
|
|
|
4
|
|
60
|
no warnings qw( once void ); |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
1800
|
|
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
|
4
|
|
|
4
|
|
100
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "FooMatch" ); |
13
|
4
|
|
|
|
|
48
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
14
|
|
|
|
|
|
|
package Mite::Shim; |
15
|
4
|
|
|
4
|
|
56
|
no warnings 'redefine'; |
|
4
|
|
|
|
|
40
|
|
|
4
|
|
|
|
|
1768
|
|
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
|
4
|
|
|
|
|
25108
|
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
|
4
|
|
|
|
|
348
|
); |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
29
|
|
|
|
|
|
|
sub __META__ { |
30
|
4
|
|
|
4
|
|
80
|
no strict 'refs'; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
7112
|
|
31
|
4
|
|
33
|
4
|
|
12
|
my $class = shift; $class = ref($class) || $class; |
|
4
|
|
|
|
|
28
|
|
32
|
4
|
|
|
|
|
52
|
my $linear_isa = mro::get_linear_isa( $class ); |
33
|
|
|
|
|
|
|
return { |
34
|
|
|
|
|
|
|
BUILD => [ |
35
|
4
|
50
|
|
|
|
8
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
4
|
|
|
|
|
40
|
|
|
0
|
|
|
|
|
0
|
|
36
|
4
|
|
|
|
|
16
|
map { "$_\::BUILD" } reverse @$linear_isa |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
DEMOLISH => [ |
39
|
4
|
50
|
|
|
|
12
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
4
|
|
|
|
|
108
|
|
|
0
|
|
|
|
|
0
|
|
40
|
4
|
|
|
|
|
16
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
4
|
|
|
|
|
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
|
4
|
50
|
|
4
|
|
1316
|
my $class = ref($_[0]) ? ref(shift) : shift; |
51
|
4
|
|
33
|
|
|
152
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
52
|
4
|
|
|
|
|
32
|
my $self = bless {}, $class; |
53
|
4
|
50
|
|
|
|
56
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
54
|
4
|
|
|
|
|
12
|
my $no_build = delete $args->{__no_BUILD__}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Attribute attr (type: StrMatch[(?^i:A)]) |
57
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/wj8oNL4RD3, line 4 |
58
|
4
|
50
|
|
|
|
16
|
if ( exists $args->{"attr"} ) { do { package FooMatch::__SAFE_NAMESPACE__; !ref($args->{"attr"}) and $args->{"attr"} =~ qr/(?^i:A)/ } or Mite::Shim::croak "Type check failed in constructor: %s should be %s", "attr", "StrMatch[(?^i:A)]"; $self->{"attr"} = $args->{"attr"}; } ; |
|
4
|
50
|
|
|
|
8
|
|
|
4
|
50
|
|
|
|
64
|
|
|
4
|
|
|
|
|
20
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Call BUILD methods |
62
|
4
|
50
|
33
|
|
|
40
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
|
4
|
50
|
|
|
|
28
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Unrecognized parameters |
65
|
4
|
50
|
|
|
|
8
|
my @unknown = grep not( /\Aattr\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
24
|
|
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
36
|
return $self; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
71
|
|
|
|
|
|
|
sub BUILDALL { |
72
|
0
|
|
|
0
|
|
0
|
my $class = ref( $_[0] ); |
73
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
74
|
0
|
0
|
|
|
|
0
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
78
|
|
|
|
|
|
|
sub DESTROY { |
79
|
4
|
|
|
4
|
|
3372
|
my $self = shift; |
80
|
4
|
|
33
|
|
|
16
|
my $class = ref( $self ) || $self; |
81
|
4
|
|
33
|
|
|
48
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
82
|
4
|
50
|
|
|
|
24
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
83
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
84
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
85
|
4
|
50
|
|
|
|
4
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
4
|
|
|
|
|
16
|
|
86
|
0
|
|
|
|
|
0
|
my $e = do { |
87
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
88
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
89
|
0
|
|
|
|
|
0
|
$@; |
90
|
|
|
|
|
|
|
}; |
91
|
4
|
|
|
4
|
|
128
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
4
|
|
|
|
|
104
|
|
|
4
|
|
|
|
|
3028
|
|
92
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
93
|
|
|
|
|
|
|
} |
94
|
4
|
|
|
|
|
48
|
return; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Accessors for attr |
100
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/wj8oNL4RD3, line 4 |
101
|
12
|
100
|
66
|
12
|
|
168
|
sub attr { @_ > 1 ? do { (!ref($_[1]) and $_[1] =~ qr/(?^i:A)/) or Mite::Shim::croak( "Type check failed in %s: value should be %s", "accessor", "StrMatch[(?^i:A)]" ); $_[0]{"attr"} = $_[1]; $_[0]; } : ( $_[0]{"attr"} ) } |
|
8
|
100
|
|
|
|
124
|
|
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
36
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# See UNIVERSAL |
105
|
|
|
|
|
|
|
sub DOES { |
106
|
32
|
|
|
32
|
|
72
|
my ( $self, $role ) = @_; |
107
|
32
|
|
|
|
|
44
|
our %DOES; |
108
|
32
|
50
|
|
|
|
76
|
return $DOES{$role} if exists $DOES{$role}; |
109
|
32
|
50
|
|
|
|
76
|
return 1 if $role eq __PACKAGE__; |
110
|
32
|
50
|
0
|
|
|
92
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
|
|
|
33
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
0
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
112
|
|
|
|
|
|
|
} |
113
|
32
|
|
|
|
|
160
|
return $self->SUPER::DOES( $role ); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
117
|
|
|
|
|
|
|
sub does { |
118
|
32
|
|
|
32
|
|
25104
|
shift->DOES( @_ ); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
} |