line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SPOCP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5400
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
1
|
|
|
1
|
|
744
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
1496
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
13
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
14
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This allows declaration use Net::SPOCP ':all'; |
17
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
18
|
|
|
|
|
|
|
# will save memory. |
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
20
|
|
|
|
|
|
|
spocp_split_parts |
21
|
|
|
|
|
|
|
spocp_map |
22
|
|
|
|
|
|
|
SPOCP_PORT; |
23
|
|
|
|
|
|
|
) ] ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @EXPORT = qw( |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
574
|
use Net::SPOCP::SExpr; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
34
|
1
|
|
|
1
|
|
676
|
use Net::SPOCP::Protocol; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
324
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $SPOCP_PORT = 4751; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Preloaded methods go here. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new |
41
|
|
|
|
|
|
|
{ |
42
|
5
|
|
|
5
|
0
|
59
|
my $self = shift; |
43
|
5
|
|
33
|
|
|
32
|
my $class = ref $self || $self; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
20
|
my %args = @_; |
46
|
5
|
|
|
|
|
54
|
my $me = bless \%args,$class; |
47
|
5
|
|
|
|
|
40
|
$me->init(); |
48
|
5
|
|
|
|
|
58
|
$me; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub rule |
52
|
|
|
|
|
|
|
{ |
53
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
7
|
my %args = @_; |
56
|
1
|
|
|
|
|
2
|
foreach my $tag (qw(resource action subject)) |
57
|
|
|
|
|
|
|
{ |
58
|
3
|
|
|
|
|
6
|
unshift(@{$args{$tag}},$tag); |
|
3
|
|
|
|
|
9
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
8
|
Net::SPOCP::SExpr->create([spocp=>$args{resource},$args{action},$args{subject}]); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# rule-utilities |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub spocp_split_parts |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
1
|
0
|
45
|
my $split = shift; |
69
|
1
|
|
|
|
|
2
|
my @out; |
70
|
1
|
|
|
|
|
3
|
foreach my $x (@_) |
71
|
|
|
|
|
|
|
{ |
72
|
3
|
|
|
|
|
27
|
push(@out,split($split,$x)); |
73
|
|
|
|
|
|
|
} |
74
|
1
|
|
|
|
|
8
|
\@out; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub spocp_map |
78
|
|
|
|
|
|
|
{ |
79
|
1
|
|
|
1
|
0
|
3
|
my @out; |
80
|
1
|
|
|
|
|
4
|
while (@_) |
81
|
|
|
|
|
|
|
{ |
82
|
6
|
|
|
|
|
8
|
my $k = shift; |
83
|
6
|
|
|
|
|
9
|
my $v = shift; |
84
|
6
|
|
|
|
|
18
|
push(@out,[$k,$v]); |
85
|
|
|
|
|
|
|
} |
86
|
1
|
|
|
|
|
9
|
\@out; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub l_encode |
90
|
|
|
|
|
|
|
{ |
91
|
7
|
100
|
|
7
|
0
|
25
|
return "" unless $_[1]; |
92
|
6
|
|
|
|
|
46
|
sprintf("%d:%s",length($_[1]),$_[1]); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
__END__ |