This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updated Module::Load::Conditional to cpan version 0.31_01
authorChris Williams <chris@bingosnet.co.uk>
Fri, 23 Oct 2009 11:30:26 +0000 (12:30 +0100)
committerChris Williams <chris@bingosnet.co.uk>
Fri, 23 Oct 2009 11:30:26 +0000 (12:30 +0100)
  Changes for 0.31_01 Fri Oct 23 09:47:12 BST 2009
  =================================================
  * Added DEPRECATED and support for determining if
    a core module is loaded from perl lib path and
    setting uptodate accordingly.

Porting/Maintainers.pl
cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm

index 29adc2b..143dfde 100755 (executable)
@@ -1033,7 +1033,7 @@ use File::Glob qw(:case);
     'Module::Load::Conditional' =>
        {
        'MAINTAINER'    => 'kane',
-       'DISTRIBUTION'  => 'KANE/Module-Load-Conditional-0.30.tar.gz',
+       'DISTRIBUTION'  => 'BINGOS/Module-Load-Conditional-0.31_01.tar.gz',
        'FILES'         => q[cpan/Module-Load-Conditional],
        'CPAN'          => 1,
        'UPSTREAM'      => 'cpan',
index 47bafe1..4754011 100644 (file)
@@ -14,12 +14,13 @@ use version;
 use constant ON_VMS  => $^O eq 'VMS';
 
 BEGIN {
-    use vars        qw[ $VERSION @ISA $VERBOSE $CACHE @EXPORT_OK 
+    use vars        qw[ $VERSION @ISA $VERBOSE $CACHE @EXPORT_OK $DEPRECATED
                         $FIND_VERSION $ERROR $CHECK_INC_HASH];
     use Exporter;
     @ISA            = qw[Exporter];
-    $VERSION        = '0.30';
+    $VERSION        = '0.31_01';
     $VERBOSE        = 0;
+    $DEPRECATED     = 0;
     $FIND_VERSION   = 1;
     $CHECK_INC_HASH = 0;
     @EXPORT_OK      = qw[check_install can_load requires];
@@ -136,6 +137,9 @@ uptodate will always be true if the module was found.
 If no parsable version was found in the module, uptodate will also be
 true, since C<check_install> had no way to verify clearly.
 
+See also C<$Module::Load::Conditional::DEPRECATED>, which affects 
+the outcome of this value.
+
 =back
 
 =cut
@@ -208,7 +212,7 @@ sub check_install {
                     ($fh) = $dir->[0]->($dir, $file, @{$dir}{1..$#{$dir}})
     
                 } elsif (UNIVERSAL::can($dir, 'INC')) {
-                    ($fh) = $dir->INC->($dir, $file);
+                    ($fh) = $dir->INC($file);
                 }
     
                 if (!UNIVERSAL::isa($fh, 'GLOB')) {
@@ -300,6 +304,16 @@ sub check_install {
                 : 0;
     }
 
+    if ( $DEPRECATED and version->new($]) >= version->new('5.011') ) {
+        require Module::CoreList;
+        require Config;
+
+        $href->{uptodate} = 0 if 
+           exists $Module::CoreList::version{ 0+$] }{ $args->{module} } and
+           Module::CoreList::is_deprecated( $args->{module} ) and
+           $Config::Config{privlibexp} eq $href->{dir};
+    }
+
     return $href;
 }
 
@@ -600,6 +614,15 @@ This holds a string of the last error that happened during a call to
 C<can_load>. It is useful to inspect this when C<can_load> returns
 C<undef>.
 
+=head2 $Module::Load::Conditional::DEPRECATED
+
+This controls whether C<Module::Load::Conditional> checks if 
+a dual-life core module has been deprecated. If this is set to
+true C<check_install> will return false to C<uptodate>, if 
+a dual-life module is found to be loaded from C<$Config{privlibexp}>
+
+The default is 0;
+
 =head1 See Also
 
 C<Module::Load>