diff options
author | Steve Hay <SteveHay@planit.com> | 2008-12-19 14:38:54 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2008-12-19 14:54:06 +0000 |
commit | 9b31c40c5f3f020eae721bb863fc9731399c4f70 (patch) | |
tree | c11372ddece10a1098bb47c5e7ef6e6bb86564d4 /lib/Module | |
parent | 6b6e6e926fbaa8fd5416b8b6996454222feffccd (diff) | |
download | perl-9b31c40c5f3f020eae721bb863fc9731399c4f70.tar.gz |
Subject: [PATCH] Update Module::Load::Conditional to 0.28
From: "Jos I. Boumans" <jos@dwim.org>
Date: Wed, 17 Dec 2008 14:24:23 +0100
Message-Id: <D986D195-F3E3-4E3E-9867-526C9C55D92F@dwim.org>
Diffstat (limited to 'lib/Module')
-rw-r--r-- | lib/Module/Load/Conditional.pm | 18 | ||||
-rw-r--r-- | lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t | 12 |
2 files changed, 24 insertions, 6 deletions
diff --git a/lib/Module/Load/Conditional.pm b/lib/Module/Load/Conditional.pm index 90f9d6cf36..4fba341d79 100644 --- a/lib/Module/Load/Conditional.pm +++ b/lib/Module/Load/Conditional.pm @@ -18,7 +18,7 @@ BEGIN { $FIND_VERSION $ERROR $CHECK_INC_HASH]; use Exporter; @ISA = qw[Exporter]; - $VERSION = '0.26'; + $VERSION = '0.28'; $VERBOSE = 0; $FIND_VERSION = 1; $CHECK_INC_HASH = 0; @@ -116,6 +116,11 @@ to find the file: Full path to the file that contains the module +=item dir + +Directory, or more exact the C<@INC> entry, where the module was +loaded from. + =item version The version number of the installed module - this will be C<undef> if @@ -226,6 +231,9 @@ sub check_install { } } + ### store the directory we found the file in + $href->{dir} = $dir; + ### files need to be in unix format under vms, ### or they might be loaded twice $href->{file} = ON_VMS @@ -236,18 +244,20 @@ sub check_install { if( $FIND_VERSION ) { my $in_pod = 0; - while (local $_ = <$fh> ) { + while ( my $line = <$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; + $in_pod = $line =~ /^=(?!cut)/ ? 1 : + $line =~ /^=cut/ ? 0 : + $in_pod; next if $in_pod; ### try to find a version declaration in this string. - my $ver = __PACKAGE__->_parse_version( $_ ); + my $ver = __PACKAGE__->_parse_version( $line ); if( defined $ver ) { $href->{version} = $ver; 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 01d427ad79..dbd5ecdfb3 100644 --- a/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t +++ b/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t @@ -20,8 +20,8 @@ use Test::More 'no_plan'; use constant ON_VMS => $^O eq 'VMS'; -use lib "$FindBin::Bin/../lib"; -use lib "$FindBin::Bin/to_load"; +use lib File::Spec->catdir($FindBin::Bin, qw[.. lib] ); +use lib File::Spec->catdir($FindBin::Bin, q[to_load] ); use_ok( 'Module::Load::Conditional' ); @@ -46,6 +46,12 @@ use_ok( 'Module::Load::Conditional' ); ok( $rv->{uptodate}, q[Verify self] ); is( $rv->{version}, $Module::Load::Conditional::VERSION, q[ Found proper version] ); + ok( $rv->{dir}, q[ Found directory information] ); + + { my $dir_re = qr/^$rv->{dir}/i; + like( $rv->{file}, $dir_re, + q[ Dir subset of file path] ); + } ### break up the specification my @rv_path = do { @@ -73,6 +79,8 @@ use_ok( 'Module::Load::Conditional' ); File::Spec::Unix->catfile(@rv_path), q[ Found proper file] ); + + } |