| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::Daemon::Cleanup; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1545
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
147
|
|
|
4
|
3
|
|
|
3
|
|
26
|
use strict; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
86
|
|
|
5
|
3
|
|
|
3
|
|
19
|
use Siebel::Srvrmgr; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
59
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use Moose::Role; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.29'; # VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Siebel::Srvrmgr::Daemon::Cleanup - Moose roles for Siebel::Srvrmgr::Daemon subclasses cleanup |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This Moose role provides cleanup "hidden" methods for subclasses of L<Siebel::Srvrmgr::Daemon> to execute |
|
16
|
|
|
|
|
|
|
their own cleanup of temporary files when they're done. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _del_file { |
|
21
|
5
|
|
|
5
|
|
18
|
my ( $self, $filename ) = @_; |
|
22
|
5
|
|
|
|
|
35
|
my $logger = Siebel::Srvrmgr->gimme_logger( blessed($self) ); |
|
23
|
|
|
|
|
|
|
|
|
24
|
5
|
100
|
|
|
|
140
|
if ( defined($filename) ) { |
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
50
|
|
|
|
65
|
if ( -e $filename ) { |
|
27
|
4
|
|
|
|
|
373
|
my $ret = unlink $filename; |
|
28
|
|
|
|
|
|
|
|
|
29
|
4
|
50
|
|
|
|
20
|
if ($ret) { |
|
30
|
4
|
|
|
|
|
30
|
return 1; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
else { |
|
33
|
0
|
|
|
|
|
0
|
$logger->warn("Could not remove $filename: $!"); |
|
34
|
0
|
|
|
|
|
0
|
return 0; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
0
|
|
|
|
|
0
|
$logger->warn("File $filename does not exists"); |
|
40
|
0
|
|
|
|
|
0
|
return 0; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _del_input_file { |
|
47
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
|
48
|
2
|
|
|
|
|
75
|
return $self->_del_file( $self->get_input_file() ); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _del_output_file { |
|
52
|
3
|
|
|
3
|
|
8
|
my $self = shift; |
|
53
|
3
|
|
|
|
|
121
|
return $self->_del_file( $self->get_output_file() ); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
L<Moose::Role> |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::Daemon> |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
|
83
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
84
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
85
|
|
|
|
|
|
|
(at your option) any later version. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
|
88
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
89
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
93
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |