| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
################################################################# |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Hook::Filter::Plugin::Library - Usefull functions for writing filter rules |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# $Id: Library.pm,v 1.4 2007/05/24 14:52:37 erwan_lemonnier Exp $ |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# 060302 erwan Created |
|
8
|
|
|
|
|
|
|
# 070516 erwan Removed from_xxx(), added from(), arg() and subname() |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Hook::Filter::Plugins::Library; |
|
12
|
|
|
|
|
|
|
|
|
13
|
12
|
|
|
12
|
|
23212
|
use strict; |
|
|
12
|
|
|
|
|
29
|
|
|
|
12
|
|
|
|
|
472
|
|
|
14
|
12
|
|
|
12
|
|
67
|
use warnings; |
|
|
12
|
|
|
|
|
40
|
|
|
|
12
|
|
|
|
|
393
|
|
|
15
|
12
|
|
|
12
|
|
67
|
use Carp qw(croak); |
|
|
12
|
|
|
|
|
23
|
|
|
|
12
|
|
|
|
|
653
|
|
|
16
|
12
|
|
|
12
|
|
74
|
use Data::Dumper; |
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
1609
|
|
|
17
|
12
|
|
|
12
|
|
7536
|
use Hook::Filter::Hooker;# qw( get_caller_subname get_caller_package get_subname get_arguments ); |
|
|
12
|
|
|
|
|
35
|
|
|
|
12
|
|
|
|
|
3159
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#---------------------------------------------------------------- |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
# register - return a list of the tests available in this plugin |
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub register { |
|
25
|
24
|
|
|
24
|
1
|
89
|
return qw(from arg subname); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#---------------------------------------------------------------- |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
# from - returns the fully qualified name of the caller |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub from { |
|
34
|
12
|
|
|
12
|
1
|
39
|
return Hook::Filter::Hooker::get_caller_subname(); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#---------------------------------------------------------------- |
|
38
|
|
|
|
|
|
|
# |
|
39
|
|
|
|
|
|
|
# arg - return the n-ieme argument passed to the filtered subroutine |
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub arg { |
|
43
|
5
|
|
|
5
|
1
|
8
|
my $pos = shift; |
|
44
|
5
|
50
|
33
|
|
|
49
|
croak "invalid rule: function arg expects a number, got: ".Dumper($pos,@_) if (!defined $pos || @_ || $pos !~ /^\d+$/); |
|
|
|
|
33
|
|
|
|
|
|
45
|
5
|
|
|
|
|
14
|
my @args = Hook::Filter::Hooker::get_arguments(); |
|
46
|
5
|
|
|
|
|
92
|
return $args[$pos]; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#---------------------------------------------------------------- |
|
50
|
|
|
|
|
|
|
# |
|
51
|
|
|
|
|
|
|
# subname - return the fully qualified name of the called subroutine |
|
52
|
|
|
|
|
|
|
# |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub subname { |
|
55
|
40
|
|
|
40
|
1
|
112
|
return Hook::Filter::Hooker::get_subname(); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |