line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# WARNING WARNING WARNING |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# DO NOT CHANGE ANYTHING IN THIS MODULE. OTHERWISE, A LOT OF API |
5
|
|
|
|
|
|
|
# AND OTHER TESTS MAY BREAK. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# This module is here to test certain behaviors. If you need |
8
|
|
|
|
|
|
|
# to test something else, add another test module. |
9
|
|
|
|
|
|
|
# It's that simple. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# This does not need to be indexed by PAUSE |
13
|
|
|
|
|
|
|
package |
14
|
|
|
|
|
|
|
RPC::ExtDirect::Test::Pkg::Hooks; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
765
|
use strict; |
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
47
|
|
17
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
41
|
|
18
|
2
|
|
|
2
|
|
10
|
no warnings 'uninitialized'; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
63
|
|
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
293
|
use RPC::ExtDirect before => \&nonexistent_before_hook; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our ($foo_foo_called, $foo_bar_called, $foo_baz_called); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub foo_foo : ExtDirect(1) { |
25
|
0
|
|
|
0
|
0
|
0
|
$foo_foo_called = 1; |
26
|
2
|
|
|
2
|
|
9
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub foo_bar : ExtDirect(2, before => 'NONE') { |
29
|
1
|
|
|
1
|
0
|
4
|
$foo_bar_called = 1; |
30
|
2
|
|
|
2
|
|
213
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
7
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# This hook will simply raise a flag and die |
33
|
|
|
|
|
|
|
sub foo_baz_after { |
34
|
1
|
|
|
1
|
0
|
2
|
$foo_baz_called = 1; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
14
|
die; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Return hashref result |
40
|
|
|
|
|
|
|
sub foo_baz : ExtDirect( params => [foo, bar, baz], before => 'NONE', after => \&foo_baz_after) |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
43
|
1
|
|
|
|
|
3
|
my %param = @_; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $ret = { msg => 'foo! bar! baz!', foo => $param{foo}, |
46
|
|
|
|
|
|
|
bar => $param{bar}, baz => $param{baz}, |
47
|
1
|
|
|
|
|
5
|
}; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
delete @param{ qw(foo bar baz) }; |
50
|
1
|
|
|
|
|
3
|
@$ret{ keys %param } = values %param; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
3
|
return $ret; |
53
|
2
|
|
|
2
|
|
438
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
7
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Testing hook changing parameters |
56
|
|
|
|
|
|
|
sub foo_hook : ExtDirect(1) { |
57
|
3
|
|
|
3
|
0
|
4
|
my ($class, $foo) = @_; |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
6
|
my $ret = [ @_ ]; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
9
|
return $ret; |
62
|
2
|
|
|
2
|
|
225
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
5
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|