File Coverage

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