line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::Daemon::Action::Serializable; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
9558
|
use Moose::Role; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
633
|
|
4
|
11
|
|
|
11
|
|
62050
|
use Storable qw(nstore); |
|
11
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
675
|
|
5
|
11
|
|
|
11
|
|
65
|
use warnings; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
349
|
|
6
|
11
|
|
|
11
|
|
61
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
339
|
|
7
|
11
|
|
|
11
|
|
59
|
use Carp; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
3375
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=pod |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Siebel::Srvrmgr::Daemon::Action::Serializable - role for serializable subclasses of Siebel::Srvrmgr::Daemon::Action |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This class is a role, not a subclass of L<Siebel::Srvrmgr::Daemon::Action>. It is intended to be used by subclasses that |
18
|
|
|
|
|
|
|
needs serialization to the filesystem. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 dump_file |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This attribute is a string used to indicate in which file the data from L<Siebel::Srvmrgr::ListParser::Output::ListCompDef> should |
25
|
|
|
|
|
|
|
be serialized into the OS filesystem. The string can be a complete path or just the filename. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has dump_file => ( |
30
|
|
|
|
|
|
|
isa => 'Str', |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
reader => 'get_dump_file', |
33
|
|
|
|
|
|
|
writer => 'set_dump_file' |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 get_dump_file |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Returns the string stored in the attribute C<dump_file>. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 set_dump_file |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Sets the attribute C<dump_file>. Expects a string as parameter. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 BUILD |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Right after object creation this method will process the C<params> attribute and retrieve the first index of the array reference |
51
|
|
|
|
|
|
|
to define the C<dump_file> attribute using the method C<set_dump_file>. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
If the C<params> attribute is an empty reference, the method wil raise an exception. If the value given is undefined or an empty |
54
|
|
|
|
|
|
|
string, an exception will be raised as well. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub BUILD { |
59
|
|
|
|
|
|
|
|
60
|
46
|
|
|
46
|
1
|
89
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
46
|
|
|
|
|
2312
|
my $params_ref = $self->get_params(); |
63
|
|
|
|
|
|
|
|
64
|
46
|
50
|
33
|
|
|
197
|
unless ( ( defined($params_ref) ) and ( scalar( @{$params_ref} ) >= 1 ) ) { |
|
46
|
|
|
|
|
215
|
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
0
|
die |
67
|
|
|
|
|
|
|
'Must have at least one value in the params attribute array reference' |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
46
|
|
|
|
|
111
|
my $file = $params_ref->[0]; |
72
|
|
|
|
|
|
|
|
73
|
46
|
50
|
33
|
|
|
259
|
if ( ( defined($file) ) and ( $file ne '' ) ) { |
74
|
|
|
|
|
|
|
|
75
|
46
|
50
|
|
|
|
2555
|
$self->set_dump_file($file) if ( defined($file) ); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else { |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
0
|
die 'dump_file attribute must be defined'; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 store |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Serializes a arbitrary data reference to the file as returned by C<get_dump_file> method. That serialization is done with L<Storable> module C<nstore> function. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Expects as parameters a data reference. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns any value returned by the C<nstore> function. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub store { |
97
|
|
|
|
|
|
|
|
98
|
17
|
|
|
17
|
1
|
34
|
my $self = shift; |
99
|
17
|
|
|
|
|
32
|
my $data_ref = shift; |
100
|
|
|
|
|
|
|
|
101
|
17
|
50
|
|
|
|
67
|
confess "the received parameter is not a reference" |
102
|
|
|
|
|
|
|
if ( ref($data_ref) eq '' ); |
103
|
|
|
|
|
|
|
|
104
|
17
|
|
|
|
|
895
|
nstore $data_ref, $self->get_dump_file(); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SEE ALSO |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::Daemon::Action> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<Storable> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
133
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
134
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
135
|
|
|
|
|
|
|
(at your option) any later version. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
138
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
139
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
140
|
|
|
|
|
|
|
GNU General Public License for more details. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
143
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |