line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Output::LoadPreferences; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Output::LoadPreferences - subclass to parse load preferences command. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
6
|
|
|
6
|
|
8380
|
use Moose; |
|
6
|
|
|
|
|
364707
|
|
|
6
|
|
|
|
|
66
|
|
12
|
6
|
|
|
6
|
|
42896
|
use Siebel::Srvrmgr::Regexes qw(LOAD_PREF_RESP LOAD_PREF_CMD); |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
491
|
|
13
|
6
|
|
|
6
|
|
742
|
use namespace::autoclean; |
|
6
|
|
|
|
|
9037
|
|
|
6
|
|
|
|
|
58
|
|
14
|
6
|
|
|
6
|
|
474
|
use Carp; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
2427
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Siebel::Srvrmgr::ListParser::Output'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=pod |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See L<Siebel::Srvrmgr::ListParser::Output> for example. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This class is a subclass of L<Siebel::Srvrmgr::ListParser::Output>. In truth, this is not a parser for a C<list> command, but since the usage of |
27
|
|
|
|
|
|
|
C<load preferences> is strongly recommended, this subclass was added to enable usage in L<Siebel::Srvrmgr::Daemon::Action> subclasses. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 location |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
A string of location of the preferences file returned by the C<load preferences> command. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'location' => ( |
38
|
|
|
|
|
|
|
is => 'rw', |
39
|
|
|
|
|
|
|
isa => 'Str', |
40
|
|
|
|
|
|
|
reader => 'get_location', |
41
|
|
|
|
|
|
|
writer => 'set_location' |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 get_location |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Returns the C<location> attribute. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 set_location |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Set the C<location> attribute. Expects and string as parameter. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 parse |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Parses the C<load preferences> output stored in the C<raw_data> attribute, setting the C<data_parsed> attribute. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The C<raw_data> attribute will be set to an reference to an empty array. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
override 'parse' => sub { |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $data_ref = $self->get_raw_data(); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my %parsed_lines; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
foreach my $line ( @{$data_ref} ) { |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
SWITCH: { |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if ( $line =~ LOAD_PREF_RESP ) { |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my @data = split( /\:\s/, $line ); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
confess 'Caught invalid LOAD_PREF_RESP line' unless (@data); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$self->set_location( pop(@data) ); |
83
|
|
|
|
|
|
|
$parsed_lines{answer} = $line; |
84
|
|
|
|
|
|
|
last SWITCH; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
if ( $line =~ LOAD_PREF_CMD ) { |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$parsed_lines{command} = $line; |
91
|
|
|
|
|
|
|
last SWITCH; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
if ( $line eq '' ) { |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
last SWITCH; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
else { |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
confess 'Invalid data in line [' . $line . ']'; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
confess "Did not found any line with response\n" |
111
|
|
|
|
|
|
|
unless ( defined( $self->get_location() ) ); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
$self->set_data_parsed( \%parsed_lines ); |
114
|
|
|
|
|
|
|
$self->set_raw_data( [] ); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
return 1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
}; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=pod |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SEE ALSO |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=over 2 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L<Moose> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
147
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
148
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
149
|
|
|
|
|
|
|
(at your option) any later version. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
152
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
153
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
154
|
|
|
|
|
|
|
GNU General Public License for more details. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
157
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
6
|
|
|
6
|
|
36
|
no Moose; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
47
|
|
162
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |