File Coverage

blib/lib/Siebel/Srvrmgr/Daemon/Action/ListSessions.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::Daemon::Action::ListSessions;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Siebel::Srvrmgr::Daemon::Action::ListSessions - subclass of Siebel::Srvrmgr::Daemon::Action to recover sessions information
8              
9             =head1 SYNOPSIS
10              
11             See L<Siebel::Srvrmgr::Daemon::Action> for an example.
12              
13             =head1 DESCRIPTION
14              
15             This is a subclass of L<Siebel::Srvrmgr::Daemon::Action> that will recover sessions information as documented in the C<do_parsed> method.
16              
17             =cut
18              
19 1     1   2833 use Moose;
  1         2  
  1         6  
20 1     1   4269 use namespace::autoclean;
  1         2  
  1         8  
21 1     1   62 use Siebel::Srvrmgr;
  1         2  
  1         12  
22 1     1   10 use Siebel::Srvrmgr::Daemon::ActionStash;
  1         1  
  1         156  
23              
24             extends 'Siebel::Srvrmgr::Daemon::Action';
25              
26             =head1 METHODS
27              
28             =head2 do_parsed
29              
30             This method is overrided from parent class.
31              
32             The method will recover the sessions as the iterator returned from the C<get_sessions> method from the L<Siebel::Srvrmgr::ListParser::Output::Tabular::ListSessions> instance created by the parser and
33             stash it in the L<Siebel::Srvrmgr::Daemon::ActionStash> available.
34              
35             Expects as parameters:
36              
37             =over
38              
39             =item 1.
40              
41             a L<Siebel::Srvrmgr::ListParser::Output> instance
42              
43             =item 2.
44              
45             A string identifying the Siebel servername which sessions is expected to be in the first parameter
46              
47             =back
48              
49             This method will returne true in the case the object received as parameter C<isa> L<Siebel::Srvrmgr::ListParser::Output::Tabular::ListSessions> or false otherwise.
50              
51             =cut
52              
53             override 'do_parsed' => sub {
54              
55             my $self = shift;
56             my $obj = shift;
57             my $servername = $self->get_params()->[0];
58              
59             if ( $obj->isa('Siebel::Srvrmgr::ListParser::Output::Tabular::ListSessions') ) {
60            
61             my $stash = Siebel::Srvrmgr::Daemon::ActionStash->instance();
62             $stash->push_stash( $obj->get_sessions($servername) );
63            
64             return 1;
65              
66             }
67             else {
68              
69             return 0;
70              
71             }
72              
73             };
74              
75             =pod
76              
77             =head1 SEE ALSO
78              
79             =over
80              
81             =item *
82              
83             L<Siebel::Srvrmgr::Daemon::Action>
84              
85             =item *
86              
87             L<Siebel::Srvrmgr::Daemon::ActionStash>
88              
89             =item *
90              
91             L<Siebel::Srvrmgr::ListParser::Output::Tabular::ListSessions>
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;