Gentoo Archives: gentoo-perl

From: antoine.raillon@××××××.net
To: gentoo-perl@l.g.o
Subject: [gentoo-perl] r26 - trunk/bin
Date: Sun, 15 May 2005 11:38:49
Message-Id: 20050515113813.A954B8280F1@gredin.dragou.net
1 Author: cab
2 Date: 2005-05-15 13:38:13 +0200 (Sun, 15 May 2005)
3 New Revision: 26
4
5 Modified:
6 trunk/bin/g-cpan.pl
7 Log:
8 - Played with CPAN stuff so that it comes AFTER options parsing (see rev 25 for FIXME)
9 - Moved some 'use Module' strings
10
11
12 Modified: trunk/bin/g-cpan.pl
13 ===================================================================
14 --- trunk/bin/g-cpan.pl 2005-05-15 10:02:54 UTC (rev 25)
15 +++ trunk/bin/g-cpan.pl 2005-05-15 11:38:13 UTC (rev 26)
16 @@ -12,6 +12,7 @@
17 use File::Path;
18 use File::Basename;
19 use Term::ANSIColor;
20 +use Digest::MD5;
21
22 use constant MAKE_CONF => '/etc/make.conf';
23 use constant PATH_PKG_DEV_PERL => '/var/db/pkg/dev-perl';
24 @@ -39,43 +40,14 @@
25 use constant ERR_FOLDER_OPEN => "Couldn't open folder '%s', %s"; # foldername, $!
26 use constant ERR_FOLDER_CREATE => "Couldn't create folder '%s' : %s"; # foldername, $!
27
28 -
29 +# FIXME - cab
30 +# is it useful ?
31 # predeclared subs
32 sub printbig;
33
34 +my $VERSION = "0.13";
35 my $prog = basename($0);
36
37 -# Do we need to generate a config ?
38 -# FIXME cab
39 -# When calling g-cpan, if the user has no conf, g-cpan will generate one as first step.
40 -# This is not necessary if we're asking for --help and generate way too much output.
41 -eval 'use CPAN::Config;';
42 -my $needs_cpan_stub = $@ ? 1 : 0;
43 -
44 -# Test Replacement - ((A&B)or(C&B)) should be the same as ((A or C) and B)
45 -if ( ( ($needs_cpan_stub) || ( $> > 0 ) )
46 - && ( !-f "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" ) )
47 -{
48 -
49 - # In case match comes from the UID test
50 - $needs_cpan_stub = 1;
51 -
52 - # Generate a fake config for CPAN
53 - cpan_stub();
54 -}
55 -else {
56 - $needs_cpan_stub = 0;
57 -}
58 -
59 -use CPAN;
60 -
61 -use Getopt::Long;
62 -Getopt::Long::Configure("bundling");
63 -
64 -use Digest::MD5;
65 -
66 -my $VERSION = "0.13";
67 -
68 my @perl_dirs = (
69 "dev-perl", "perl-core", "perl-gcpan", "perl-text",
70 "perl-tools", "perl-xml", "perl-dev"
71 @@ -85,7 +57,11 @@
72 # Command line interpretation #
73 ###############################
74
75 -# Init all options
76 +# Module load & configure
77 +use Getopt::Long;
78 +Getopt::Long::Configure("bundling");
79 +
80 +# Init all options (has to be done to perform the 'sum test' later)
81 my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask, $noclean ) = ( 0, 0, 0, 0, 0, 0, 0, 0 );
82
83 #Get & Parse them
84 @@ -115,6 +91,31 @@
85 exit_usage();
86 }
87
88 +######################
89 +# CPAN Special Stuff #
90 +######################
91 +
92 +# Do we need to generate a config ?
93 +eval 'use CPAN::Config;';
94 +my $needs_cpan_stub = $@ ? 1 : 0;
95 +
96 +# Test Replacement - ((A&B)or(C&B)) should be the same as ((A or C) and B)
97 +if ( ( ($needs_cpan_stub) || ( $> > 0 ) )
98 + && ( !-f "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" ) )
99 +{
100 +
101 + # In case match comes from the UID test
102 + $needs_cpan_stub = 1;
103 +
104 + # Generate a fake config for CPAN
105 + cpan_stub();
106 +}
107 +else {
108 + $needs_cpan_stub = 0;
109 +}
110 +
111 +use CPAN;
112 +
113 ##########
114 # main() #
115 ##########
116
117
118 --
119 gentoo-perl@g.o mailing list