Gentoo Archives: gentoo-perl

From: "David (Sniper) Rigaudiere" <sniper@×××××××××.net>
To: gentoo-perl@l.g.o
Subject: [gentoo-perl] sub ebuild_exists - a lot of lc($dir)
Date: Thu, 12 May 2005 01:11:51
Message-Id: 20050512010448.M45172@rigaudiere.net
1 sub ebuild_exists {
2 - my ($dir) = lc $_[0];
3 + my ($dir) = $_[0];
4
5 # need to try harder here - see &portage_dir comments.
6 # should return an ebuild name from this, as case matters.
7 @@ -264,8 +270,9 @@
8 next if not -d $sdir;
9 opendir PDIR, $sdir or fatal(ERR_FOLDER_OPEN, $sdir, $!);
10 while(my $file = readdir PDIR) {
11 - if(lc $file eq $dir) {
12 - $found = $dir;
13 + if(lc $file eq lc $dir) {
14 + my $cat = basename($sdir);
15 + $found = "$cat/$file";
16
17
18
19 I don't understand this modification.
20 Why lc($dir) for each file in PDIR, best is one and only lc($dir) at the start
21 of sub for best performances.
22
23 If $found must be the original $dir w/o case change, I propose :
24
25
26 sub ebuild_exists {
27 my ($dir) = @_;
28 my $lcase_dir = lc $dir;
29
30 [...later...]
31
32 while(my $file = readdir PDIR) {
33 if(lc $file eq $lcase_dir) {
34 $found = $dir;
35
36
37 $cab->todo->add('svn commit notif email script'); # ;-)
38
39 David "Sniper" Rigaudiere
40 GPG KeyID 0xFF1E982D
41
42 --
43 gentoo-perl@g.o mailing list

Replies

Subject Author
Réf. : [gentoo-perl] sub ebuild_exists - a lot of lc($dir) antoine.raillon@××××.com
Re: [gentoo-perl] sub ebuild_exists - a lot of lc($dir) Michael Cummings <mcummings@g.o>