line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XAS::Lib::Stomp::POE::Filter; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use XAS::Lib::Stomp::Parser; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
4
|
use XAS::Constants 'CRLF :stomp'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use XAS::Class |
9
|
1
|
|
|
|
|
11
|
debug => 0, |
10
|
|
|
|
|
|
|
version => $VERSION, |
11
|
|
|
|
|
|
|
base => 'XAS::Base', |
12
|
|
|
|
|
|
|
accessors => 'filter eol', |
13
|
|
|
|
|
|
|
constant => { |
14
|
|
|
|
|
|
|
LF => "\n", |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
vars => { |
17
|
|
|
|
|
|
|
PARAMS => { |
18
|
|
|
|
|
|
|
-target => { optional => 1, default => undef, regex => STOMP_LEVELS }, |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
1
|
|
|
1
|
|
244
|
; |
|
1
|
|
|
|
|
1
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#use Data::Hexdumper; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
# Public methods |
27
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub get_one_start { |
30
|
0
|
|
|
0
|
1
|
|
my ($self, $buffers) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
foreach my $buffer (@$buffers) { |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (my $frame = $self->filter->parse($buffer)) { |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
push(@{$self->{frames}}, $frame); |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_one { |
45
|
0
|
|
|
0
|
1
|
|
my ($self) = shift; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @ret; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if (my $frame = shift(@{$self->{frames}})) { |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
push(@ret, $frame); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return \@ret; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_pending { |
60
|
0
|
|
|
0
|
1
|
|
my ($self) = shift; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $self->filter->get_pending; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub put { |
67
|
0
|
|
|
0
|
1
|
|
my ($self, $frames) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my @ret; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
foreach my $frame (@$frames) { |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $buffer = $frame->as_string; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# $self->log->debug(hexdump($buffer)); |
76
|
0
|
|
|
|
|
|
push(@ret, $buffer); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return \@ret; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
85
|
|
|
|
|
|
|
# Private methods |
86
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub init { |
89
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my $self = $class->SUPER::init(@_); |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
unless (defined($self->{target})) { |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->{target} = $self->env->mqlevel; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
$self->{eol} = ($self->target > 1.1) ? CRLF : LF; |
100
|
0
|
|
|
|
|
|
$self->{filter} = XAS::Lib::Stomp::Parser->new(-target => $self->target); |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return $self; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |