line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::CheckOptional; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
47898
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
19
|
use 5.005; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
69
|
|
7
|
|
|
|
|
|
|
# For module install and version checks |
8
|
1
|
|
|
1
|
|
739
|
use Module::AutoInstall; |
|
1
|
|
|
|
|
102188
|
|
|
1
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
29
|
use vars qw( @ISA $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
480
|
use Module::Install::Base; |
|
1
|
|
|
|
|
372
|
|
|
1
|
|
|
|
|
119
|
|
13
|
|
|
|
|
|
|
@ISA = qw( Module::Install::Base Module::AutoInstall ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d%02d", q/0.11.1/ =~ /(\d+)/g; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# --------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub check_optional { |
20
|
4
|
|
|
4
|
1
|
5191
|
my ($self, $module, $version, $message) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Tell Module::Install to include this, since we use it. |
23
|
4
|
|
|
|
|
24
|
$self->perl_version('5.005'); |
24
|
4
|
|
|
|
|
57
|
$self->include('Module::AutoInstall', 0); |
25
|
|
|
|
|
|
|
|
26
|
4
|
50
|
33
|
|
|
41
|
croak "check_optional requires a dependency and version such as \"Carp => 1.03\"" |
27
|
|
|
|
|
|
|
unless defined $module and defined $version; |
28
|
|
|
|
|
|
|
|
29
|
4
|
100
|
|
|
|
12
|
return if Module::AutoInstall::_version_cmp( |
30
|
|
|
|
|
|
|
Module::AutoInstall::_load($module), $version ) >= 0; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
397
|
print<
|
33
|
|
|
|
|
|
|
*************************************************************************** |
34
|
|
|
|
|
|
|
NOTE: The optional module $module (version $version) is not installed. |
35
|
|
|
|
|
|
|
EOF |
36
|
|
|
|
|
|
|
|
37
|
3
|
100
|
|
|
|
62
|
print "\n$message" if defined $message; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# --------------------------------------------------------------------------- |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Module::Install::CheckOptional - A Module::Install extension that checks to see if an optional dependency is satisfied |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
In Makefile.PL: |
52
|
|
|
|
|
|
|
use inc::Module::Install; |
53
|
|
|
|
|
|
|
... |
54
|
|
|
|
|
|
|
check_optional( Carp => 1.02, |
55
|
|
|
|
|
|
|
"This module will perform better error reporting with Carp installed."); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is a Module::Install extension that checks that a suitable version of a module is installed, printing a message if it is not. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 METHODS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over 4 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item check_optional( EMODULE NAMEE => E0|VERSIONE, [MESSAGE] ) |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Checks whether a module is installed or not and that it has the correct |
70
|
|
|
|
|
|
|
version. Prints a note similar to the following if the module with a version |
71
|
|
|
|
|
|
|
greater than or equal to the specified version cannot be found: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
*************************************************************************** |
74
|
|
|
|
|
|
|
NOTE: The optional module Carp (version 1.03) is not installed. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
In addition, the optional MESSAGE argument will be appended to the notice. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=back |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This code is distributed under the GNU General Public License (GPL) Version 2. |
86
|
|
|
|
|
|
|
See the file LICENSE in the distribution for details. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
David Coppit Edavid@coppit.orgE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SEE ALSO |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |