line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mock::Quick::Object; |
2
|
7
|
|
|
7
|
|
1118
|
use strict; |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
151
|
|
3
|
7
|
|
|
7
|
|
19
|
use warnings; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
127
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
1278
|
use Mock::Quick::Util; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
387
|
|
6
|
7
|
|
|
7
|
|
2523
|
use Mock::Quick::Object::Control; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
136
|
|
7
|
7
|
|
|
7
|
|
36
|
use Carp (); |
|
7
|
|
|
|
|
5
|
|
|
7
|
|
|
|
|
67
|
|
8
|
7
|
|
|
7
|
|
21
|
use Scalar::Util (); |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
1110
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTOLOAD; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
class_meth new => sub { |
13
|
|
|
|
|
|
|
my $class = shift; |
14
|
|
|
|
|
|
|
my %proto = @_; |
15
|
|
|
|
|
|
|
return bless \%proto, $class; |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub AUTOLOAD { |
19
|
|
|
|
|
|
|
# Do not shift this, we need it when we use goto &$sub |
20
|
8
|
|
|
8
|
|
1010
|
my ($self) = @_; |
21
|
8
|
|
|
|
|
44
|
my ( $package, $sub ) = ( $AUTOLOAD =~ m/^(.+)::([^:]+)$/ ); |
22
|
8
|
|
|
|
|
13
|
$AUTOLOAD = undef; |
23
|
|
|
|
|
|
|
|
24
|
8
|
50
|
|
|
|
34
|
Carp::croak "Can't locate object method \"$sub\" via package \"$package\"" |
25
|
|
|
|
|
|
|
unless Scalar::Util::blessed( $self ); |
26
|
|
|
|
|
|
|
|
27
|
8
|
|
|
|
|
24
|
my $code = $self->can( $sub ); |
28
|
8
|
100
|
|
|
|
32
|
Carp::croak "Can't locate object method \"$sub\" in this instance" |
29
|
|
|
|
|
|
|
unless $code; |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
|
|
33
|
goto &$code; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
alt_meth can => ( |
35
|
7
|
|
|
7
|
|
36
|
class => sub { no warnings 'misc'; goto &UNIVERSAL::can }, |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
541
|
|
36
|
|
|
|
|
|
|
obj => sub { |
37
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $control = Mock::Quick::Object::Control->new( $self ); |
40
|
|
|
|
|
|
|
return if $control->strict && !exists $self->{$name}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $sub; |
43
|
|
|
|
|
|
|
{ |
44
|
7
|
|
|
7
|
|
32
|
no warnings 'misc'; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
678
|
|
45
|
|
|
|
|
|
|
$sub = UNIVERSAL::can( $self, $name ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
$sub ||= sub { |
48
|
43
|
|
|
43
|
|
1157
|
unshift @_ => ( shift( @_ ), $name ); |
49
|
43
|
|
|
|
|
96
|
goto &call; |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
inject( Scalar::Util::blessed( $self ), $name, $sub ); |
52
|
|
|
|
|
|
|
return $sub; |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# http://perldoc.perl.org/perlobj.html#Default-UNIVERSAL-methods |
57
|
|
|
|
|
|
|
# DOES is equivalent to isa by default |
58
|
7
|
|
|
7
|
0
|
25
|
sub isa { no warnings 'misc'; goto &UNIVERSAL::isa } |
|
7
|
|
|
8
|
|
32
|
|
|
7
|
|
|
|
|
353
|
|
|
8
|
|
|
|
|
3369
|
|
59
|
0
|
|
|
0
|
0
|
|
sub DOES { goto &isa } |
60
|
7
|
|
|
7
|
0
|
19
|
sub VERSION { no warnings 'misc'; goto &UNIVERSAL::VERSION } |
|
7
|
|
|
0
|
|
6
|
|
|
7
|
|
|
|
|
570
|
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
obj_meth DESTROY => sub { |
63
|
|
|
|
|
|
|
my $self = shift; |
64
|
|
|
|
|
|
|
Mock::Quick::Object::Control->new( $self )->_clean; |
65
|
|
|
|
|
|
|
unshift @_ => ( $self, 'DESTROY' ); |
66
|
|
|
|
|
|
|
goto &call; |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
purge_util(); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |