line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::AssertOS::Validate; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
52350
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
41
|
|
5
|
2
|
|
|
2
|
|
10
|
use Exporter qw(import); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
6
|
2
|
|
|
2
|
|
524
|
use Siebel::AssertOS::Linux::Distribution qw(distribution_name); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
374
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.9'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=pod |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Siebel::AssertOS::Validate - validate is OS is supported or not |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This module does the proper validation used on L while it's being |
18
|
|
|
|
|
|
|
imported. See B. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This module was created basically to facilitate unit testing. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 EXPORT |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Nothing is exported by default. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The function C is the only function exported by demand of this module. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @EXPORT_OK = qw(os_is); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 FUNCTIONS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 os_is |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Expects a string as parameter, being the string the name of the OS (like C<$^O> environment variable). |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
It returns true or false (in Perl terms) if the OS is supported or not. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
In the case of Linux, it will also C if the distribution is not support and the return false. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub os_is { |
45
|
4
|
|
|
4
|
1
|
1127
|
my $os = shift; |
46
|
|
|
|
|
|
|
|
47
|
4
|
50
|
|
|
|
11
|
if ( $os eq 'linux' ) { |
48
|
|
|
|
|
|
|
# supported Linux distribuitions |
49
|
0
|
|
|
|
|
0
|
my %distros = |
50
|
|
|
|
|
|
|
( redhat => 1, suse => 1, 'oracle enterprise linux' => 1 ); |
51
|
0
|
|
|
|
|
0
|
my $distro = distribution_name(); |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
0
|
if ( exists( $distros{$distro} ) ) { |
54
|
0
|
|
|
|
|
0
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else { |
57
|
0
|
|
|
|
|
0
|
warn "The Linux distribution '$distro' is not supported"; |
58
|
0
|
|
|
|
|
0
|
return 0; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
4
|
100
|
|
|
|
13
|
return 1 if ( $os eq 'MSWin32' ); |
64
|
3
|
100
|
|
|
|
7
|
return 1 if ( $os eq 'aix' ); |
65
|
2
|
100
|
|
|
|
7
|
return 1 if ( $os eq 'solaris' ); |
66
|
|
|
|
|
|
|
|
67
|
1
|
50
|
|
|
|
4
|
if ( $os eq 'hpux' ) { |
68
|
0
|
|
|
|
|
0
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
1
|
|
|
|
|
5
|
return 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, Earfreitas@cpan.orgE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This software is copyright (c) 2015 of Alceu Rodrigues de Freitas Junior, Earfreitas@cpan.orgE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This file is part of Siebel GNU Tools project. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Siebel GNU Tools is free software: you can redistribute it and/or modify |
87
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
88
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
89
|
|
|
|
|
|
|
(at your option) any later version. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Siebel GNU Tools is distributed in the hope that it will be useful, |
92
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
93
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
94
|
|
|
|
|
|
|
GNU General Public License for more details. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
97
|
|
|
|
|
|
|
along with Siebel GNU Tools. If not, see . |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |