r34702 - in /trunk/dh-make-perl: debian/changelog lib/DhMakePerl.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sun May 3 16:02:56 UTC 2009


Author: dmn
Date: Sun May  3 16:02:50 2009
New Revision: 34702

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34702
Log:
move CPAN configuration into a method

Modified:
    trunk/dh-make-perl/debian/changelog
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=34702&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Sun May  3 16:02:50 2009
@@ -18,6 +18,7 @@
   * add 'make' to the list of commands
   * remove code supporting CPAN < 1.9205, which is what ships with
     perl-modules 5.10 (on which we already depend)
+  * move CPAN configuration into a method
 
  -- gregor herrmann <gregoa at debian.org>  Mon, 27 Apr 2009 16:42:59 +0200
 

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=34702&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Sun May  3 16:02:50 2009
@@ -30,6 +30,8 @@
     ...
 
 =head1 METHODS
+
+=over
 
 =cut
 
@@ -353,6 +355,32 @@
     return $v;
 }
 
+=item configure_cpan
+
+Configure CPAN module. It is safe to call this method more than once, it will
+do nothing if CPAN is already configured.
+
+=cut
+
+sub configure_cpan {
+    my $self = shift;
+
+    return if $CPAN::Config_loaded;
+
+    CPAN::Config->load( be_silent => not $self->cfg->verbose );
+
+    unshift( @{ $CPAN::Config->{'urllist'} }, $self->cfg->cpan_mirror )
+        if $self->cfg->cpan_mirror;
+
+    $CPAN::Config->{'build_dir'} = $ENV{'HOME'} . "/.cpan/build";
+    $CPAN::Config->{'cpan_home'} = $ENV{'HOME'} . "/.cpan/";
+    $CPAN::Config->{'histfile'}  = $ENV{'HOME'} . "/.cpan/history";
+    $CPAN::Config->{'keep_source_where'} = $ENV{'HOME'} . "/.cpan/source";
+    $CPAN::Config->{'tar_verbosity'} = $self->cfg->verbose ? 'v' : '';
+    $CPAN::Config->{'load_module_verbosity'}
+        = $self->cfg->verbose ? 'verbose' : 'silent';
+}
+
 sub setup_dir {
     my ($self) = @_;
 
@@ -368,19 +396,7 @@
                 unless $self->cfg->core_ok;
         }
 
-###		require CPAN;
-        CPAN::Config->load( be_silent => not $self->cfg->verbose );
-
-        unshift( @{ $CPAN::Config->{'urllist'} }, $self->cfg->cpan_mirror )
-            if $self->cfg->cpan_mirror;
-
-        $CPAN::Config->{'build_dir'} = $ENV{'HOME'} . "/.cpan/build";
-        $CPAN::Config->{'cpan_home'} = $ENV{'HOME'} . "/.cpan/";
-        $CPAN::Config->{'histfile'}  = $ENV{'HOME'} . "/.cpan/history";
-        $CPAN::Config->{'keep_source_where'} = $ENV{'HOME'} . "/.cpan/source";
-        $CPAN::Config->{'tar_verbosity'} = $self->cfg->verbose ? 'v' : '';
-        $CPAN::Config->{'load_module_verbosity'}
-            = $self->cfg->verbose ? 'verbose' : 'silent';
+        $self->configure_cpan;
 
         # This modification allows to retrieve all the modules that
         # match the user-provided string.
@@ -1797,6 +1813,8 @@
     return $fh;
 }
 
+=back
+
 =head1 AUTHOR
 
 dh-make-perl was created by Paolo Molaro.




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