line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Buffer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Buffer - class to store output of commands |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
22
|
|
|
22
|
|
3261
|
use Moose 2.0401; |
|
22
|
|
|
|
|
434
|
|
|
22
|
|
|
|
|
221
|
|
12
|
22
|
|
|
22
|
|
182376
|
use namespace::autoclean 0.13; |
|
22
|
|
|
|
|
618
|
|
|
22
|
|
|
|
|
209
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.29'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $buffer = Siebel::Srvrmgr::ListParser::Buffer->new( |
21
|
|
|
|
|
|
|
{ |
22
|
|
|
|
|
|
|
type => 'sometype', |
23
|
|
|
|
|
|
|
cmd_line => 'list something' |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$buffer->set_content( $cmd_output_line ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This class is used by L<Siebel::Srvrmgr::ListParser> to store output read (between two commands) while is processing all the output. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 type |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
String that identified which kind of output is being stored. This will be used by abstract factory classes to instantiate objects from |
38
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output> subclasses. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'type' => ( is => 'ro', isa => 'Str', required => 1, reader => 'get_type' ); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 cmd_line |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
String that contains the identified commands that generated the output. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'cmd_line' => |
53
|
|
|
|
|
|
|
( is => 'ro', isa => 'Str', required => 1, reader => 'get_cmd_line' ); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 content |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
An array reference with the output being stored. Each index is one line read stored from the output. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'content' => ( |
64
|
|
|
|
|
|
|
is => 'rw', |
65
|
|
|
|
|
|
|
isa => 'ArrayRef', |
66
|
|
|
|
|
|
|
reader => '_get_content', |
67
|
|
|
|
|
|
|
writer => '_set_content', |
68
|
|
|
|
|
|
|
default => sub { return [] } |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 get_type |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns the string stored in the attribute C<type>. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 get_cmd_line |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns the string stored in the attribute C<type>. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 get_content |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the buffer content B<without> new lines. This is the expected behavior since parsers will not know what to |
86
|
|
|
|
|
|
|
do with new lines characters. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub get_content { |
91
|
188
|
|
|
188
|
1
|
599
|
my $self = shift; |
92
|
188
|
|
|
|
|
443
|
my @content = @{ $self->_get_content }; |
|
188
|
|
|
|
|
12109
|
|
93
|
188
|
|
|
|
|
4206
|
chomp( @content ); |
94
|
188
|
|
|
|
|
8695
|
return \@content; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 get_raw_content |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Returns the buffer content B<with> new lines characters. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub get_raw_content { |
104
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
105
|
0
|
|
|
|
|
0
|
return $self->_get_content; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 set_content |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Setter for the C<content> attribute. Expects a string as parameter. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
If C<content> already has data, it will be appended as expected. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub set_content { |
117
|
49682
|
|
|
49682
|
1
|
116414
|
my ( $self, $value ) = @_; |
118
|
|
|
|
|
|
|
|
119
|
49682
|
50
|
|
|
|
115026
|
if ( defined($value) ) { |
120
|
49682
|
|
|
|
|
1892213
|
my $buffer_ref = $self->_get_content(); |
121
|
49682
|
|
|
|
|
91677
|
push( @{$buffer_ref}, $value ); |
|
49682
|
|
|
|
|
1812387
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=pod |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
139
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
140
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
141
|
|
|
|
|
|
|
(at your option) any later version. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
144
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
145
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
146
|
|
|
|
|
|
|
GNU General Public License for more details. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
149
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |