line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::Tools; |
2
|
|
|
|
|
|
|
|
3
|
25
|
|
|
25
|
|
566487
|
use strict; |
|
25
|
|
|
|
|
31
|
|
|
25
|
|
|
|
|
620
|
|
4
|
25
|
|
|
25
|
|
85
|
use warnings; |
|
25
|
|
|
|
|
35
|
|
|
25
|
|
|
|
|
598
|
|
5
|
25
|
|
|
25
|
|
83
|
use base 'Exporter'; |
|
25
|
|
|
|
|
55
|
|
|
25
|
|
|
|
|
1627
|
|
6
|
25
|
|
|
25
|
|
103
|
use English qw(-no_match_vars); |
|
25
|
|
|
|
|
28
|
|
|
25
|
|
|
|
|
134
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
9
|
|
|
|
|
|
|
getNoWhere |
10
|
|
|
|
|
|
|
trimWhitespaces |
11
|
|
|
|
|
|
|
getOSTempDir |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub getNoWhere { |
15
|
0
|
0
|
|
0
|
1
|
|
return $OSNAME eq 'MSWin32' ? 'nul' : '/dev/null'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub trimWhitespaces { |
19
|
0
|
|
|
0
|
1
|
|
my ($string) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$string =~ s/^\s+//; |
22
|
0
|
|
|
|
|
|
$string =~ s/\s+$//; |
23
|
0
|
|
|
|
|
|
$string =~ s/\s+/ /g; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $string; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub getOSTempDir { |
29
|
0
|
0
|
|
0
|
1
|
|
return $OSNAME eq 'MSWin32' ? 'C:\\Temp\\' : '/tmp/'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Armadito::Agent::Tools - Various tools used in Armadito Agent. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This module provides some basic functions for multiple usages. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 FUNCTIONS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 getNoWhere() |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Get OS noWhere. For example: /dev/null on Linux. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 getOSTempDir() |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Get OS temp directory path. For example: C:\Temp on Windows. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 trimWhitespaces($string) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Remove leading and trailing whitespace, and fold multiple whitespace |
56
|
|
|
|
|
|
|
characters into a single one. |