summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-01-04 17:04:11 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-01-04 17:04:11 +0000
commite163f9a0cad0e6bc632cba9a82e10b83f046f88d (patch)
tree8561cb8bbe0a53ce7607deef24ec5559203ba98d /lib
parentbe2597dfdde55c276ac6c4b68dadc448c601d0cc (diff)
downloadperl-e163f9a0cad0e6bc632cba9a82e10b83f046f88d.tar.gz
Upgrade Module::Load::Conditional to 0.14
p4raw-id: //depot/perl@29688
Diffstat (limited to 'lib')
-rw-r--r--lib/Module/Load/Conditional.pm21
-rw-r--r--lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t17
-rw-r--r--lib/Module/Load/Conditional/t/to_load/Commented.pm8
-rw-r--r--lib/Module/Load/Conditional/t/to_load/InPod.pm11
-rw-r--r--lib/Module/Load/Conditional/t/to_load/LoadIt.pm6
-rw-r--r--lib/Module/Load/Conditional/t/to_load/Must/Be/Loaded.pm6
6 files changed, 46 insertions, 23 deletions
diff --git a/lib/Module/Load/Conditional.pm b/lib/Module/Load/Conditional.pm
index 510ae24f36..0aa3d04086 100644
--- a/lib/Module/Load/Conditional.pm
+++ b/lib/Module/Load/Conditional.pm
@@ -15,7 +15,7 @@ BEGIN {
$FIND_VERSION $ERROR $CHECK_INC_HASH];
use Exporter;
@ISA = qw[Exporter];
- $VERSION = '0.12';
+ $VERSION = '0.14';
$VERBOSE = 0;
$FIND_VERSION = 1;
$CHECK_INC_HASH = 0;
@@ -228,8 +228,17 @@ sub check_install {
### user wants us to find the version from files
if( $FIND_VERSION ) {
+ my $in_pod = 0;
while (local $_ = <$fh> ) {
+ ### stolen from EU::MM_Unix->parse_version to address
+ ### #24062: "Problem with CPANPLUS 0.076 misidentifying
+ ### versions after installing Text::NSP 1.03" where a
+ ### VERSION mentioned in the POD was found before
+ ### the real $VERSION declaration.
+ $in_pod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $in_pod;
+ next if $in_pod;
+
### skip commented out lines, they won't eval to anything.
next if /^\s*#/;
@@ -522,10 +531,8 @@ Jos Boumans E<lt>kane@cpan.orgE<gt>.
=head1 COPYRIGHT
-This module is
-copyright (c) 2002 Jos Boumans E<lt>kane@cpan.orgE<gt>.
-All rights reserved.
+This module is copyright (c) 2002-2007 Jos Boumans
+E<lt>kane@cpan.orgE<gt>. All rights reserved.
-This library is free software;
-you may redistribute and/or modify it under the same
-terms as Perl itself.
+This library is free software; you may redistribute and/or modify
+it under the same terms as Perl itself.
diff --git a/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t b/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t
index f46fd9ccf1..af05c45b5e 100644
--- a/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t
+++ b/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t
@@ -16,7 +16,7 @@ use strict;
use lib qw[../lib to_load];
use File::Spec ();
-use Test::More tests => 20;
+use Test::More tests => 23;
### case 1 ###
use_ok( 'Module::Load::Conditional' ) or diag "Module.pm not found. Dying", die;
@@ -78,7 +78,14 @@ use_ok( 'Module::Load::Conditional' ) or diag "Module.pm not found. Dying", die
}
-### test $FILE_VERSION
+### test finding a version of a module that mentions $VERSION in pod
+{ my $rv = check_install( module => 'InPod' );
+ ok( $rv, 'Testing $VERSION in POD' );
+ ok( $rv->{version}, " Version found" );
+ is( $rv->{version}, 2, " Version is correct" );
+}
+
+### test $FIND_VERSION
{ local $Module::Load::Conditional::FIND_VERSION = 0;
local $Module::Load::Conditional::FIND_VERSION = 0;
@@ -126,20 +133,18 @@ use_ok( 'Module::Load::Conditional' ) or diag "Module.pm not found. Dying", die
### test 'requires' ###
-
SKIP:{
skip "Depends on \$^X, which doesn't work well when testing the Perl core",
1 if $ENV{PERL_CORE};
- my %list = map { $_ => 1 } requires('Carp');
+ my %list = map { $_ => 1 } requires('Carp');
+
my $flag;
$flag++ unless delete $list{'Exporter'};
ok( !$flag, q[Detecting requirements] );
}
-
-
### test using the %INC lookup for check_install
{ local $Module::Load::Conditional::CHECK_INC_HASH = 1;
local $Module::Load::Conditional::CHECK_INC_HASH = 1;
diff --git a/lib/Module/Load/Conditional/t/to_load/Commented.pm b/lib/Module/Load/Conditional/t/to_load/Commented.pm
index 2ee302e96c..1e3e057f33 100644
--- a/lib/Module/Load/Conditional/t/to_load/Commented.pm
+++ b/lib/Module/Load/Conditional/t/to_load/Commented.pm
@@ -1,4 +1,4 @@
-# $VERSION = 1;
-$VERSION = 2;
-
-1;
+# $VERSION = 1;
+$VERSION = 2;
+
+1;
diff --git a/lib/Module/Load/Conditional/t/to_load/InPod.pm b/lib/Module/Load/Conditional/t/to_load/InPod.pm
new file mode 100644
index 0000000000..0d4c39b60c
--- /dev/null
+++ b/lib/Module/Load/Conditional/t/to_load/InPod.pm
@@ -0,0 +1,11 @@
+=pod
+
+$VERSION = 1;
+
+=cut
+
+package InPod;
+
+$VERSION = 2;
+
+1;
diff --git a/lib/Module/Load/Conditional/t/to_load/LoadIt.pm b/lib/Module/Load/Conditional/t/to_load/LoadIt.pm
index 87025e8a51..b97123dac7 100644
--- a/lib/Module/Load/Conditional/t/to_load/LoadIt.pm
+++ b/lib/Module/Load/Conditional/t/to_load/LoadIt.pm
@@ -1,3 +1,3 @@
-$VERSION = 1;
-
-1;
+$VERSION = 1;
+
+1; \ No newline at end of file
diff --git a/lib/Module/Load/Conditional/t/to_load/Must/Be/Loaded.pm b/lib/Module/Load/Conditional/t/to_load/Must/Be/Loaded.pm
index e6423f3263..e1af010dc8 100644
--- a/lib/Module/Load/Conditional/t/to_load/Must/Be/Loaded.pm
+++ b/lib/Module/Load/Conditional/t/to_load/Must/Be/Loaded.pm
@@ -1,3 +1,3 @@
-$VERSION = 0.01;
-
-1;
+$VERSION = 0.01;
+
+1; \ No newline at end of file