File Coverage

blib/lib/Siebel/Srvrmgr/ListParser/Output/Tabular/ListCompTypes.pm
Criterion Covered Total %
statement 24 25 96.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 31 34 91.1


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::ListParser::Output::Tabular::ListCompTypes;
2              
3 8     8   7492 use Moose 2.0401;
  8         181  
  8         62  
4 8     8   67018 use namespace::autoclean 0.13;
  8         206  
  8         70  
5              
6             extends 'Siebel::Srvrmgr::ListParser::Output::Tabular';
7             our $VERSION = '0.29'; # VERSION
8              
9             =pod
10              
11             =head1 NAME
12              
13             Siebel::Srvrmgr::ListParser::Output::Tabular::ListCompTypes - subclass to parse list comp types command
14              
15             =cut
16              
17              
18             =pod
19              
20             =head1 SYNOPSIS
21              
22             See L<Siebel::Srvrmgr::ListParser::Output::Tabular> for examples.
23              
24             =head1 DESCRIPTION
25              
26             This subclass of L<Siebel::Srvrmgr::ListParser::Output::Tabular> parses the output of the command C<list comp types>.
27              
28             This is the list configuration of the C<srvrmgr> expected by the module:
29              
30             srvrmgr> configure list comp type
31             CT_NAME (76): Component type name
32             CT_RUNMODE (31): Supported run mode
33             CT_ALIAS (31): Component type alias
34             CT_DESC_TEXT (251): Description of component type
35              
36             If the configuration is not setup as this, the parsing will fail and the module may raise exceptions.
37              
38             =head1 ATTRIBUTES
39              
40             All from superclass.
41              
42             =head1 METHODS
43              
44             =head2 get_attribs
45              
46             Returns the array reference stored in the C<types_attribs> attribute.
47              
48             =head2 set_attribs
49              
50             Sets the attribute C<types_attribs>. Expects an array reference as parameter.
51              
52             =cut
53              
54             sub _build_expected {
55              
56 22     22   62 my $self = shift;
57              
58 22         1141 $self->_set_expected_fields(
59             [ 'CT_NAME', 'CT_RUNMODE', 'CT_ALIAS', 'CT_DESC_TEXT' ] );
60              
61             }
62              
63             sub _consume_data {
64              
65 5518     5518   10845 my $self = shift;
66 5518         9564 my $fields_ref = shift;
67 5518         9390 my $parsed_ref = shift;
68              
69 5518         11846 my $ct_name = $fields_ref->[0];
70              
71 5518         9114 my $list_len = scalar( @{$fields_ref} );
  5518         11310  
72              
73 5518         252214 my $columns_ref = $self->get_expected_fields();
74              
75 5518 50       13854 confess "Could not retrieve the name of the fields"
76             unless ( defined($columns_ref) );
77              
78 5518 50       9410 if ( @{$fields_ref} ) {
  5518         13551  
79              
80 5518         14258 for ( my $i = 0 ; $i < $list_len ; $i++ ) {
81              
82 22072         77891 $parsed_ref->{$ct_name}->{ $columns_ref->[$i] } =
83             $fields_ref->[$i];
84              
85             }
86              
87 5518         27489 return 1;
88              
89             }
90             else {
91              
92 0           return 0;
93              
94             }
95              
96             }
97              
98             =pod
99              
100             =head1 SEE ALSO
101              
102             =over
103              
104             =item *
105              
106             L<Siebel::Srvrmgr::ListParser::Output::Tabular>
107              
108             =item *
109              
110             L<Moose>
111              
112             =item *
113              
114             L<Siebel::Srvrmgr::ListParser::Output::ToString>
115              
116             =back
117              
118             =head1 AUTHOR
119              
120             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
121              
122             =head1 COPYRIGHT AND LICENSE
123              
124             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
125              
126             This file is part of Siebel Monitoring Tools.
127              
128             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
129             it under the terms of the GNU General Public License as published by
130             the Free Software Foundation, either version 3 of the License, or
131             (at your option) any later version.
132              
133             Siebel Monitoring Tools is distributed in the hope that it will be useful,
134             but WITHOUT ANY WARRANTY; without even the implied warranty of
135             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136             GNU General Public License for more details.
137              
138             You should have received a copy of the GNU General Public License
139             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
140              
141             =cut
142              
143 8     8   3005 no Moose;
  8         26  
  8         52  
144             __PACKAGE__->meta->make_immutable;