line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::CheckOptional; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
133393
|
use strict; |
|
2
|
|
|
|
|
38
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
78
|
use 5.005; |
|
2
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
253
|
|
7
|
|
|
|
|
|
|
# For module install and version checks |
8
|
2
|
|
|
2
|
|
1058
|
use Module::AutoInstall; |
|
2
|
|
|
|
|
222363
|
|
|
2
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
92
|
use vars qw( @ISA $VERSION ); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
106
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
1011
|
use Module::Install::Base; |
|
2
|
|
|
|
|
1469
|
|
|
2
|
|
|
|
|
231
|
|
13
|
|
|
|
|
|
|
@ISA = qw( Module::Install::Base Module::AutoInstall ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d%02d", q/0.11.5/ =~ /(\d+)/g; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# --------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub check_optional { |
20
|
4
|
|
|
4
|
1
|
9106
|
my ($self, $module, $version, $message) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Tell Module::Install to include this, since we use it. |
23
|
4
|
|
|
|
|
29
|
$self->perl_version('5.005'); |
24
|
4
|
|
|
|
|
63
|
$self->include('Module::AutoInstall', 0); |
25
|
|
|
|
|
|
|
|
26
|
4
|
50
|
33
|
|
|
43
|
croak "check_optional requires a dependency and version such as \"Carp => 1.03\"" |
27
|
|
|
|
|
|
|
unless defined $module and defined $version; |
28
|
|
|
|
|
|
|
|
29
|
4
|
100
|
|
|
|
15
|
return if Module::AutoInstall::_version_cmp( |
30
|
|
|
|
|
|
|
Module::AutoInstall::_load($module), $version ) >= 0; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
360
|
print<
|
33
|
|
|
|
|
|
|
*************************************************************************** |
34
|
|
|
|
|
|
|
NOTE: The optional module $module (version $version) is not installed. |
35
|
|
|
|
|
|
|
EOF |
36
|
|
|
|
|
|
|
|
37
|
3
|
100
|
|
|
|
34
|
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 |