line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Output::Tabular::Struct::Fixed; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
5100
|
use Moose; |
|
26
|
|
|
|
|
56
|
|
|
26
|
|
|
|
|
188
|
|
4
|
26
|
|
|
26
|
|
168361
|
use namespace::autoclean; |
|
26
|
|
|
|
|
60
|
|
|
26
|
|
|
|
|
214
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'Siebel::Srvrmgr::ListParser::Output::Tabular::Struct'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=pod |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Output::Tabular::Struct::Fixed - subclass to parse fixed width output from srvrmgr |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This class is a subclass of L<Siebel::Srvrmgr::ListParser::Output::Tabular::Struct> to parse fixed width output from C<srvrmgr>. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 fields_pattern |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This is a read-only attribute which is defined internally by invoking the C<define_fields_pattern> method during parsing execution. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
It is a string representing the pattern of the fields to be used with C<unpack> function. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has fields_pattern => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => 'Str', |
31
|
|
|
|
|
|
|
reader => 'get_fields_pattern', |
32
|
|
|
|
|
|
|
writer => '_set_fields_pattern' |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _build_col_sep { |
36
|
|
|
|
|
|
|
|
37
|
85
|
|
|
85
|
|
157
|
my $self = shift; |
38
|
85
|
|
|
|
|
6440
|
$self->_set_col_sep('\s{2,}'); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 define_fields_pattern |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Overrided from the parent class. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Based on the first two rows of a C<srvrmgr> output with fixed width format, it will define |
51
|
|
|
|
|
|
|
the fields pattern to be used with C<unpack> to retrieve the fields values. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Expects the "------------" line under the header with the fields names. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub define_fields_pattern { |
58
|
|
|
|
|
|
|
|
59
|
85
|
|
|
85
|
1
|
1833
|
my $self = shift; |
60
|
85
|
|
|
|
|
164
|
my $line = shift; |
61
|
|
|
|
|
|
|
|
62
|
85
|
|
|
|
|
4511
|
my $separator = $self->get_col_sep(); |
63
|
85
|
|
|
|
|
446
|
my $comp_sep = qr/$separator/; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# :TODO:30-12-2013:: some logging would ne nice here |
66
|
85
|
50
|
|
|
|
527
|
if ( $line =~ $comp_sep ) { |
67
|
|
|
|
|
|
|
|
68
|
85
|
|
|
|
|
1225
|
my @columns = split( /$separator/, $line ); |
69
|
|
|
|
|
|
|
|
70
|
85
|
|
|
|
|
142
|
my $pattern; |
71
|
|
|
|
|
|
|
|
72
|
85
|
|
|
|
|
210
|
foreach my $column (@columns) { |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# :WARNING :09/05/2013 12:19:37:: + 2 because of the spaces after the "---" that will be trimmed |
75
|
925
|
|
|
|
|
1799
|
$pattern .= 'A' . ( length($column) + 2 ); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
85
|
|
|
|
|
4972
|
$self->_set_fields_pattern($pattern); |
80
|
85
|
|
|
|
|
528
|
return 1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
else { |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
return 0; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 get_fields |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Overrided from parent class. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns the fields values as an array reference. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Expects a string with fields values to be parsed. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub get_fields { |
104
|
|
|
|
|
|
|
|
105
|
8722
|
|
|
8722
|
1
|
12156
|
my $self = shift; |
106
|
8722
|
|
|
|
|
11429
|
my $line = shift; |
107
|
|
|
|
|
|
|
|
108
|
8722
|
50
|
|
|
|
474520
|
if ( defined( $self->get_fields_pattern() ) ) { |
109
|
|
|
|
|
|
|
|
110
|
8722
|
|
|
|
|
469134
|
my @fields = unpack( $self->get_fields_pattern(), $line ); |
111
|
|
|
|
|
|
|
|
112
|
8722
|
|
|
|
|
28770
|
return \@fields; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
else { |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
confess 'cannot procede without being able to define the fields pattern for parsing: check if command output configuration is as expected by the parsing class'; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::Tabular> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
L<Moose> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::Tabular::Struct> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=back |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 AUTHOR |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This software is copyright (c) 2013 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
152
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
153
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
154
|
|
|
|
|
|
|
(at your option) any later version. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
157
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
158
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
159
|
|
|
|
|
|
|
GNU General Public License for more details. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
162
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |