Author: cab
Date: 2005-05-15 13:38:13 +0200 (Sun, 15 May 2005)
New Revision: 26
Modified:
trunk/bin/g-cpan.pl
Log:
- Played with CPAN stuff so that it comes AFTER options parsing (see rev 25 for FIXME)
- Moved some 'use Module' strings
Modified: trunk/bin/g-cpan.pl
===================================================================
--- trunk/bin/g-cpan.pl 2005-05-15 10:02:54 UTC (rev 25)
+++ trunk/bin/g-cpan.pl 2005-05-15 11:38:13 UTC (rev 26)
@@ -12,6 +12,7 @@
use File::Path;
use File::Basename;
use Term::ANSIColor;
+use Digest::MD5;
use constant MAKE_CONF => '/etc/make.conf';
use constant PATH_PKG_DEV_PERL => '/var/db/pkg/dev-perl';
@@ -39,43 +40,14 @@
use constant ERR_FOLDER_OPEN => "Couldn't open folder '%s', %s"; # foldername, $!
use constant ERR_FOLDER_CREATE => "Couldn't create folder '%s' : %s"; # foldername, $!
-
+# FIXME - cab
+# is it useful ?
# predeclared subs
sub printbig;
+my $VERSION = "0.13";
my $prog = basename($0);
-# Do we need to generate a config ?
-# FIXME cab
-# When calling g-cpan, if the user has no conf, g-cpan will generate one as first step.
-# This is not necessary if we're asking for --help and generate way too much output.
-eval 'use CPAN::Config;';
-my $needs_cpan_stub = $@ ? 1 : 0;
-
-# Test Replacement - ((A&B)or(C&B)) should be the same as ((A or C) and B)
-if ( ( ($needs_cpan_stub) || ( $> > 0 ) )
- && ( !-f "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" ) )
-{
-
- # In case match comes from the UID test
- $needs_cpan_stub = 1;
-
- # Generate a fake config for CPAN
- cpan_stub();
-}
-else {
- $needs_cpan_stub = 0;
-}
-
-use CPAN;
-
-use Getopt::Long;
-Getopt::Long::Configure("bundling");
-
-use Digest::MD5;
-
-my $VERSION = "0.13";
-
my @perl_dirs = (
"dev-perl", "perl-core", "perl-gcpan", "perl-text",
"perl-tools", "perl-xml", "perl-dev"
@@ -85,7 +57,11 @@
# Command line interpretation #
###############################
-# Init all options
+# Module load & configure
+use Getopt::Long;
+Getopt::Long::Configure("bundling");
+
+# Init all options (has to be done to perform the 'sum test' later)
my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask, $noclean ) = ( 0, 0, 0, 0, 0, 0, 0, 0 );
#Get & Parse them
@@ -115,6 +91,31 @@
exit_usage();
}
+######################
+# CPAN Special Stuff #
+######################
+
+# Do we need to generate a config ?
+eval 'use CPAN::Config;';
+my $needs_cpan_stub = $@ ? 1 : 0;
+
+# Test Replacement - ((A&B)or(C&B)) should be the same as ((A or C) and B)
+if ( ( ($needs_cpan_stub) || ( $> > 0 ) )
+ && ( !-f "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" ) )
+{
+
+ # In case match comes from the UID test
+ $needs_cpan_stub = 1;
+
+ # Generate a fake config for CPAN
+ cpan_stub();
+}
+else {
+ $needs_cpan_stub = 0;
+}
+
+use CPAN;
+
##########
# main() #
##########
--
gentoo-perl@g.o mailing list
|