line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mock::Quick; |
2
|
3
|
|
|
3
|
|
57339
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
69
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
69
|
|
4
|
3
|
|
|
3
|
|
1270
|
use Exporter::Declare; |
|
3
|
|
|
|
|
50468
|
|
|
3
|
|
|
|
|
10
|
|
5
|
3
|
|
|
3
|
|
4327
|
use Mock::Quick::Class; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
65
|
|
6
|
3
|
|
|
3
|
|
969
|
use Mock::Quick::Object; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
51
|
|
7
|
3
|
|
|
3
|
|
11
|
use Mock::Quick::Object::Control; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
35
|
|
8
|
3
|
|
|
3
|
|
7
|
use Mock::Quick::Method; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
41
|
|
9
|
3
|
|
|
3
|
|
7
|
use Mock::Quick::Util; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
156
|
|
10
|
3
|
|
|
3
|
|
9
|
use Carp qw/carp/; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
233
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.111'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
import_arguments qw/intercept/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub after_import { |
17
|
3
|
|
|
3
|
0
|
6635
|
my $class = shift; |
18
|
3
|
|
|
|
|
4
|
my ( $importer, $specs ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
3
|
100
|
|
|
|
5
|
return unless $specs->config->{intercept}; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
6
|
my $intercept = $specs->config->{intercept}; |
23
|
3
|
|
|
3
|
|
9
|
no strict 'refs'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1058
|
|
24
|
1
|
|
|
1
|
|
3
|
*{"$importer\::QINTERCEPT"} = sub { $intercept }; |
|
1
|
|
|
|
|
1069
|
|
|
1
|
|
|
|
|
2
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my %CLASS_RELATED = ( |
28
|
|
|
|
|
|
|
qclass => 'new', |
29
|
|
|
|
|
|
|
qtakeover => 'takeover', |
30
|
|
|
|
|
|
|
qimplement => 'implement', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
for my $operation ( keys %CLASS_RELATED ) { |
34
|
|
|
|
|
|
|
my $meth = $CLASS_RELATED{$operation}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
default_export $operation => sub { |
37
|
7
|
|
|
7
|
|
1240
|
my @args = @_; |
38
|
|
|
|
|
|
|
|
39
|
7
|
100
|
|
|
|
41
|
return Mock::Quick::Class->$meth(@args) |
40
|
|
|
|
|
|
|
if defined wantarray; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
5
|
my $caller = caller; |
43
|
1
|
|
|
1
|
|
888
|
return $caller->QINTERCEPT->(sub { Mock::Quick::Class->$meth(@args) }) |
44
|
2
|
100
|
|
|
|
38
|
if $caller->can( 'QINTERCEPT' ); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
11
|
carp "Return value is ignored, your mock is destroyed as soon as it is created."; |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
0
|
default_export qcontrol => sub { Mock::Quick::Object::Control->new(@_) }; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
default_export qobj => sub { |
53
|
2
|
|
|
2
|
|
11
|
my $obj = Mock::Quick::Object->new(@_); |
54
|
2
|
|
|
|
|
8
|
my $control = Mock::Quick::Object::Control->new($obj); |
55
|
2
|
|
|
|
|
5
|
$control->strict(0); |
56
|
2
|
|
|
|
|
7
|
return $obj; |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
default_export qobjc => sub { |
60
|
3
|
|
|
3
|
|
22
|
my $obj = Mock::Quick::Object->new(@_); |
61
|
3
|
|
|
|
|
12
|
my $control = Mock::Quick::Object::Control->new($obj); |
62
|
3
|
|
|
|
|
8
|
$control->strict(0); |
63
|
3
|
|
|
|
|
6
|
return ( $obj, $control ); |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
default_export qstrict => sub { |
67
|
1
|
|
|
1
|
|
3
|
my $obj = Mock::Quick::Object->new(@_); |
68
|
1
|
|
|
|
|
3
|
my $control = Mock::Quick::Object::Control->new($obj); |
69
|
1
|
|
|
|
|
2
|
$control->strict(1); |
70
|
1
|
|
|
|
|
2
|
return $obj; |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
default_export qstrictc => sub { |
74
|
1
|
|
|
1
|
|
5
|
my $obj = Mock::Quick::Object->new(@_); |
75
|
1
|
|
|
|
|
3
|
my $control = Mock::Quick::Object::Control->new($obj); |
76
|
1
|
|
|
|
|
3
|
$control->strict(1); |
77
|
1
|
|
|
|
|
2
|
return ( $obj, $control ); |
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
4
|
|
|
4
|
|
929
|
default_export qclear => sub { \$Mock::Quick::Util::CLEAR }; |
81
|
5
|
|
|
5
|
|
696
|
default_export qmeth => sub(&) { Mock::Quick::Method->new(@_) }; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
purge_util(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |