Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-perl
Navigation:
Lists: gentoo-perl: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-perl@g.o
From: "David (Sniper) Rigaudiere" <sniper@...>
Subject: sub ebuild_exists - a lot of lc($dir)
Date: Thu, 12 May 2005 03:11:49 +0200

 sub ebuild_exists {
-    my ($dir) = lc $_[0];
+    my ($dir) = $_[0];

     # need to try harder here - see &portage_dir comments.
     # should return an ebuild name from this, as case matters.
@@ -264,8 +270,9 @@
         next if not -d $sdir;
         opendir PDIR, $sdir or fatal(ERR_FOLDER_OPEN, $sdir, $!);
         while(my $file = readdir PDIR) {
-            if(lc $file eq $dir) {
-                $found = $dir;
+            if(lc $file eq lc $dir) {
+               my $cat = basename($sdir);
+                $found = "$cat/$file";                                      
                                                                


I don't understand this modification.
Why lc($dir) for each file in PDIR, best is one and only lc($dir) at the start
of sub for best performances.

If $found must be the original $dir w/o case change, I propose :


sub ebuild_exists {
     my ($dir) =  @_;
     my $lcase_dir = lc $dir;

[...later...]

         while(my $file = readdir PDIR) {
             if(lc $file eq $lcase_dir) {
                 $found = $dir;


$cab->todo->add('svn commit notif email script'); # ;-)

David "Sniper" Rigaudiere
GPG KeyID 0xFF1E982D

-- 
gentoo-perl@g.o mailing list

Replies:
Re: sub ebuild_exists - a lot of lc($dir)
-- Michael Cummings
Réf. : sub ebuild_exists - a lot of lc($dir)
-- antoine . raillon
Navigation:
Lists: gentoo-perl: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
look'n'feel
Next by thread:
Réf. : sub ebuild_exists - a lot of lc($dir)
Previous by date:
look'n'feel
Next by date:
g-cpan.pl


Updated Jun 17, 2009

Summary: Archive of the gentoo-perl mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.