r27267 - /trunk/dh-make-perl/dh-make-perl

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Tue Nov 25 22:31:00 UTC 2008


Author: dmn
Date: Tue Nov 25 22:30:57 2008
New Revision: 27267

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27267
Log:
move the check for core modules in is_core_module()

this function uses hash lookups instead of grepping over a list

Modified:
    trunk/dh-make-perl/dh-make-perl

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=27267&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Tue Nov 25 22:30:57 2008
@@ -467,6 +467,18 @@
 
 }
 
+sub is_core_module {
+    my $module = shift;
+
+    my $core = $Module::CoreList::version{$]}
+            || $Module::CoreList::version{$]+0};
+
+    $core
+        or die "Internal error: \$Module::CoreList::version{ $] } is empty";
+
+    return exists( $core->{$module} );
+}
+
 sub setup_dir {
     my ( $dist, $mod, $cpanversion, $tarball );
     $mod_cpan_version = '';
@@ -474,7 +486,7 @@
         my ($new_maindir);
 
         # Is the module a core module?
-        if ( grep( /$opts{cpan}/, @stdmodules ) ) {
+        if ( is_core_module( $opts{cpan} ) ) {
             die "$opts{cpan} is a standard module.\n"
                 unless $opts{'core-ok'};
         }
@@ -1068,7 +1080,17 @@
     }
 
     foreach my $module ( keys(%dep_hash) ) {
-        next if ( grep ( /^$module$/, @stdmodules ) );
+        if ( is_core_module($module) ) {
+            print "= $module is a core module\n";
+
+            # TODO
+            # see if there is a version requirement and if the core
+            # module satisfies it. If it does, see if previous perl
+            # releases satisfy it too and if needed, bump the perl
+            # dependency to the lowest version that contains module
+            # version satisfying the dependency
+            next;
+        }
 
         push @uses, $module;
     }




More information about the Pkg-perl-cvs-commits mailing list