line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mock::Quick::Object; |
2
|
7
|
|
|
7
|
|
1616
|
use strict; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
220
|
|
3
|
7
|
|
|
7
|
|
32
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
228
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
1946
|
use Mock::Quick::Util; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
629
|
|
6
|
7
|
|
|
7
|
|
3916
|
use Mock::Quick::Object::Control; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
228
|
|
7
|
7
|
|
|
7
|
|
124
|
use Carp (); |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
122
|
|
8
|
7
|
|
|
7
|
|
30
|
use Scalar::Util (); |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
2156
|
|
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
|
|
1179
|
my ($self) = @_; |
21
|
8
|
|
|
|
|
52
|
my ( $package, $sub ) = ( $AUTOLOAD =~ m/^(.+)::([^:]+)$/ ); |
22
|
8
|
|
|
|
|
13
|
$AUTOLOAD = undef; |
23
|
|
|
|
|
|
|
|
24
|
8
|
50
|
|
|
|
42
|
Carp::croak "Can't locate object method \"$sub\" via package \"$package\"" |
25
|
|
|
|
|
|
|
unless Scalar::Util::blessed( $self ); |
26
|
|
|
|
|
|
|
|
27
|
8
|
|
|
|
|
29
|
my $code = $self->can( $sub ); |
28
|
8
|
100
|
|
|
|
72
|
Carp::croak "Can't locate object method \"$sub\" in this instance" |
29
|
|
|
|
|
|
|
unless $code; |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
|
|
17
|
goto &$code; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
alt_meth can => ( |
35
|
7
|
|
|
7
|
|
70
|
class => sub { no warnings 'misc'; goto &UNIVERSAL::can }, |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
827
|
|
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
|
|
38
|
no warnings 'misc'; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
1425
|
|
45
|
|
|
|
|
|
|
$sub = UNIVERSAL::can( $self, $name ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
$sub ||= sub { |
48
|
43
|
|
|
43
|
|
1692
|
unshift @_ => ( shift( @_ ), $name ); |
49
|
43
|
|
|
|
|
108
|
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
|
41
|
sub isa { no warnings 'misc'; goto &UNIVERSAL::isa } |
|
7
|
|
|
8
|
|
54
|
|
|
7
|
|
|
|
|
792
|
|
|
8
|
|
|
|
|
4112
|
|
59
|
0
|
|
|
0
|
0
|
|
sub DOES { goto &isa } |
60
|
7
|
|
|
7
|
0
|
37
|
sub VERSION { no warnings 'misc'; goto &UNIVERSAL::VERSION } |
|
7
|
|
|
0
|
|
8
|
|
|
7
|
|
|
|
|
1026
|
|
|
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__ |