line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mock::Furl; |
2
|
5
|
|
|
5
|
|
161212
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
190
|
|
3
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
146
|
|
4
|
5
|
|
|
5
|
|
4845
|
use Test::MockObject; |
|
5
|
|
|
|
|
15784
|
|
|
5
|
|
|
|
|
32
|
|
5
|
5
|
|
|
5
|
|
10607
|
use parent 'Exporter'; |
|
5
|
|
|
|
|
1616
|
|
|
5
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw/ |
7
|
|
|
|
|
|
|
$Mock_furl |
8
|
|
|
|
|
|
|
$Mock_furl_http |
9
|
|
|
|
|
|
|
$Mock_furl_req $Mock_furl_request |
10
|
|
|
|
|
|
|
$Mock_furl_res $Mock_furl_resp $Mock_furl_response |
11
|
|
|
|
|
|
|
/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
|
|
|
|
|
|
# Don't load the mock classes if the real ones are already loaded |
17
|
5
|
|
|
5
|
|
1194
|
my $mo = Test::MockObject->new; |
18
|
5
|
|
|
|
|
91
|
my @mock_classes = ( |
19
|
|
|
|
|
|
|
[ 'Furl' => '$Mock_furl' ], |
20
|
|
|
|
|
|
|
[ 'HTTP' => '$Mock_furl_http' ], |
21
|
|
|
|
|
|
|
[ 'Request' => '$Mock_furl_request $Mock_furl_req' ], |
22
|
|
|
|
|
|
|
[ 'Response' => '$Mock_furl_response $Mock_furl_resp $Mock_furl_res' ], |
23
|
|
|
|
|
|
|
); |
24
|
5
|
|
|
|
|
23
|
for my $c (@mock_classes) { |
25
|
20
|
|
|
|
|
39
|
my ($real, $imports) = @$c; |
26
|
20
|
50
|
|
|
|
62
|
if (!$mo->check_class_loaded($real)) { |
27
|
20
|
|
|
|
|
327
|
my $mock_class = "Test::Mock::Furl::$real"; |
28
|
20
|
|
|
|
|
1054
|
eval "require $mock_class"; ## no critic |
29
|
20
|
50
|
|
|
|
89
|
if ($@) { |
30
|
0
|
0
|
|
|
|
0
|
warn "error during require $mock_class: $@" if $@; |
31
|
0
|
|
|
|
|
0
|
next; |
32
|
|
|
|
|
|
|
} |
33
|
20
|
|
|
|
|
53
|
my $import = "$mock_class qw($imports)"; |
34
|
20
|
|
|
|
|
1283
|
eval "import $import"; ## no critic |
35
|
20
|
50
|
|
|
|
132
|
warn "error during import $import: $@" if $@; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |