line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mock::Quick; |
2
|
3
|
|
|
3
|
|
84173
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
99
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
114
|
|
4
|
3
|
|
|
3
|
|
2204
|
use Exporter::Declare; |
|
3
|
|
|
|
|
67917
|
|
|
3
|
|
|
|
|
14
|
|
5
|
3
|
|
|
3
|
|
7526
|
use Mock::Quick::Class; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
110
|
|
6
|
3
|
|
|
3
|
|
1422
|
use Mock::Quick::Object; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
71
|
|
7
|
3
|
|
|
3
|
|
17
|
use Mock::Quick::Object::Control; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
51
|
|
8
|
3
|
|
|
3
|
|
11
|
use Mock::Quick::Method; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
61
|
|
9
|
3
|
|
|
3
|
|
188
|
use Mock::Quick::Util; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
243
|
|
10
|
3
|
|
|
3
|
|
15
|
use Carp qw/carp/; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
376
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.110'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
import_arguments qw/intercept/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub after_import { |
17
|
3
|
|
|
3
|
0
|
10084
|
my $class = shift; |
18
|
3
|
|
|
|
|
9
|
my ( $importer, $specs ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
3
|
100
|
|
|
|
9
|
return unless $specs->config->{intercept}; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
9
|
my $intercept = $specs->config->{intercept}; |
23
|
3
|
|
|
3
|
|
17
|
no strict 'refs'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1562
|
|
24
|
1
|
|
|
1
|
|
5
|
*{"$importer\::QINTERCEPT"} = sub { $intercept }; |
|
1
|
|
|
|
|
1268
|
|
|
1
|
|
|
|
|
6
|
|
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
|
|
1628
|
my @args = @_; |
38
|
|
|
|
|
|
|
|
39
|
7
|
100
|
|
|
|
50
|
return Mock::Quick::Class->$meth(@args) |
40
|
|
|
|
|
|
|
if defined wantarray; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
10
|
my $caller = caller; |
43
|
1
|
|
|
1
|
|
1396
|
return $caller->QINTERCEPT->(sub { Mock::Quick::Class->$meth(@args) }) |
44
|
2
|
100
|
|
|
|
64
|
if $caller->can( 'QINTERCEPT' ); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
18
|
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
|
|
13
|
my $obj = Mock::Quick::Object->new(@_); |
54
|
2
|
|
|
|
|
11
|
my $control = Mock::Quick::Object::Control->new($obj); |
55
|
2
|
|
|
|
|
8
|
$control->strict(0); |
56
|
2
|
|
|
|
|
8
|
return $obj; |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
default_export qobjc => sub { |
60
|
3
|
|
|
3
|
|
20
|
my $obj = Mock::Quick::Object->new(@_); |
61
|
3
|
|
|
|
|
13
|
my $control = Mock::Quick::Object::Control->new($obj); |
62
|
3
|
|
|
|
|
11
|
$control->strict(0); |
63
|
3
|
|
|
|
|
7
|
return ( $obj, $control ); |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
default_export qstrict => sub { |
67
|
1
|
|
|
1
|
|
6
|
my $obj = Mock::Quick::Object->new(@_); |
68
|
1
|
|
|
|
|
4
|
my $control = Mock::Quick::Object::Control->new($obj); |
69
|
1
|
|
|
|
|
4
|
$control->strict(1); |
70
|
1
|
|
|
|
|
3
|
return $obj; |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
default_export qstrictc => sub { |
74
|
1
|
|
|
1
|
|
5
|
my $obj = Mock::Quick::Object->new(@_); |
75
|
1
|
|
|
|
|
4
|
my $control = Mock::Quick::Object::Control->new($obj); |
76
|
1
|
|
|
|
|
3
|
$control->strict(1); |
77
|
1
|
|
|
|
|
4
|
return ( $obj, $control ); |
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
4
|
|
|
4
|
|
1561
|
default_export qclear => sub { \$Mock::Quick::Util::CLEAR }; |
81
|
5
|
|
|
5
|
|
853
|
default_export qmeth => sub(&) { Mock::Quick::Method->new(@_) }; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
purge_util(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |