File Coverage

blib/lib/Siebel/Srvrmgr/Daemon/Action/ListCompTypes.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::Daemon::Action::ListCompTypes;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Siebel::Srvrmgr::Daemon::Action::ListCompTypes - subclass for parsing list comp types command output
8              
9             =head1 SYNOPSIS
10              
11             use Siebel::Srvrmgr::Daemon::Action::ListCompTypes;
12              
13             my $action = Siebel::Srvrmgr::Daemon::Action::ListCompTypes->new({ parser => Siebel::Srvrmgr::ListParser->new(),
14             params => [$myDumpFile]});
15              
16             $action->do(\@output);
17              
18             =cut
19              
20 5     5   7323 use Moose;
  5         9  
  5         33  
21 5     5   25714 use namespace::autoclean;
  5         10  
  5         39  
22 5     5   335 use Storable qw(nstore);
  5         8  
  5         1017  
23              
24             extends 'Siebel::Srvrmgr::Daemon::Action';
25             with 'Siebel::Srvrmgr::Daemon::Action::Serializable';
26              
27             =pod
28              
29             =head1 DESCRIPTION
30              
31             This subclass of L<Siebel::Srvrmgr::Daemon::Action> will try to find a L<Siebel::Srvrmgr::ListParser::Output::ListCompTypes> object in the given array reference
32             given as parameter to the C<do> method and stores the parsed data from this object in a serialized file.
33              
34             =head1 METHODS
35              
36             =head2 do_parsed
37              
38             It will check if the object given as parameter is a L<Siebel::Srvrmgr::ListParser::Output::ListCompDef> object. If true, it is serialized to the
39             filesystem with C<nstore> and the function returns 1 in this case. If none is found it will return 0.
40              
41             =cut
42              
43             override 'do_parsed' => sub {
44              
45             my $self = shift;
46             my $obj = shift;
47              
48             if ( $obj->isa( $self->get_exp_output() ) ) {
49              
50             my $data = $obj->get_data_parsed();
51              
52             nstore $data, $self->get_dump_file();
53              
54             return 1;
55              
56             }
57             else {
58              
59             return 0;
60              
61             }
62              
63             };
64              
65             override '_build_exp_output' => sub {
66              
67             return 'Siebel::Srvrmgr::ListParser::Output::Tabular::ListCompTypes';
68              
69             };
70              
71             =pod
72              
73             =head1 SEE ALSO
74              
75             =over
76              
77             =item *
78              
79             L<Siebel::Srvrgmr::Daemon::Action>
80              
81             =item *
82              
83             L<Storable>
84              
85             =item *
86              
87             L<Siebel::Srvrmgr::ListParser::Output::ListCompDef>
88              
89             =item *
90              
91             L<Siebel::Srvrmgr::Daemon::Action::Serializable>
92              
93             =back
94              
95             =head1 AUTHOR
96              
97             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>
98              
99             =head1 COPYRIGHT AND LICENSE
100              
101             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>
102              
103             This file is part of Siebel Monitoring Tools.
104              
105             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
106             it under the terms of the GNU General Public License as published by
107             the Free Software Foundation, either version 3 of the License, or
108             (at your option) any later version.
109              
110             Siebel Monitoring Tools is distributed in the hope that it will be useful,
111             but WITHOUT ANY WARRANTY; without even the implied warranty of
112             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113             GNU General Public License for more details.
114              
115             You should have received a copy of the GNU General Public License
116             along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>.
117              
118             =cut
119              
120             __PACKAGE__->meta->make_immutable;