Gentoo Archives: gentoo-perl

From: antoine.raillon@××××××.net
To: gentoo-perl@l.g.o
Subject: [gentoo-perl] r13 - code
Date: Thu, 12 May 2005 21:57:25
Message-Id: 20050512215630.4D9BE8280EC@gredin.dragou.net
1 Author: mcummings
2 Date: 2005-05-11 15:59:01 +0200 (Wed, 11 May 2005)
3 New Revision: 13
4
5 Modified:
6 code/g-cpan.pl
7 Log:
8 Beu's changes - basically so it won't print ./program-name but program-name instead ;). Hmmm...could probably just do this with basename or something instead of the regex cost now that I commit this...
9
10
11
12 Modified: code/g-cpan.pl
13 ===================================================================
14 --- code/g-cpan.pl 2005-05-11 10:22:35 UTC (rev 12)
15 +++ code/g-cpan.pl 2005-05-11 13:59:01 UTC (rev 13)
16 @@ -41,6 +41,8 @@
17 # predeclared subs
18 sub printbig;
19
20 +my $prog = $0;
21 +$prog =~ s|^.*/||;
22
23 # Do we need to generate a config ?
24 eval 'use CPAN::Config;';
25 @@ -255,7 +257,7 @@
26 while(my $file = readdir PDIR) {
27 if(lc $file eq $dir) {
28 $found = $dir;
29 - print "$0: Looking for ebuilds in $sdir, found $found so far.\n" if $verbose;
30 + print "$prog: Looking for ebuilds in $sdir, found $found so far.\n" if $verbose;
31 close PDIR;
32 last SOURCE_FOLDER;
33 }
34 @@ -348,7 +350,7 @@
35 if ( $file =~ m|.*/([a-zA-Z-]*)[0-9]+\.| ) { return $1; }
36 if ( $file =~ m|.*/([^.]*)\.| ) { return $1; }
37
38 - warn "$0: Unable to coerce $file into a portage dir name";
39 + warn "$prog: Unable to coerce $file into a portage dir name";
40 return;
41 }
42
43 @@ -464,7 +466,7 @@
44
45 my $file = $obj->cpan_file;
46 my $dir = portage_dir($obj);
47 - print "$0: portage_dir returned $dir\n" if ($verbose);
48 + print "$prog: portage_dir returned $dir\n" if ($verbose);
49 unless ($dir) {
50 warn("Couldn't turn '$file' into a directory name\n");
51 return;
52 @@ -546,7 +548,7 @@
53
54 my $file = $obj->cpan_file;
55 my $dir = portage_dir($obj);
56 - print "$0: portage_dir returned $dir\n" if ($verbose);
57 + print "$prog: portage_dir returned $dir\n" if ($verbose);
58 unless ($dir) {
59 warn("Couldn't turn '$file' into a directory name\n");
60 return;
61 @@ -627,7 +629,7 @@
62 sub emerge_module {
63 foreach my $ebuild_name (@ebuild_list) {
64 $ebuild_name =~ m/.*\/(.*)-[^-]+\./;
65 - print "$0: emerging $ebuild_name\n";
66 + print "$prog: emerging $ebuild_name\n";
67 # FIXME Sniper
68 # check return values
69 system( "emerge", "--oneshot", "--digest", $ebuild_name );
70 @@ -850,20 +852,20 @@
71
72 sub exit_usage {
73 print <<"USAGE";
74 -Usage : $0 <Switch(es)> Module Name(s)
75 +Usage : $prog <Switch(es)> Module Name(s)
76
77 --install,-i Try to generate ebuild for the given module name
78 and, if successful, emerge it. Important : installation
79 requires exact CPAN Module Name.
80
81 --list,-l This command generates a list of the Perl modules and ebuilds
82 - handled by $0.
83 + handled by $prog.
84
85 --search,-s Search CPAN for the given expression (similar to
86 the "m /EXPR/" from the CPAN Shell). Searches are
87 case insensitive.
88
89 ---upgrade,-u Try to list and upgrade all Perl modules managed by $0.
90 +--upgrade,-u Try to list and upgrade all Perl modules managed by $prog.
91 It generate up-to-date ebuilds, then emerge then.
92
93 --verbose,-v Enable (some) verbose output.
94
95
96 --
97 gentoo-perl@g.o mailing list