Return-Path: Delivered-To: apmail-httpd-apreq-dev-archive@httpd.apache.org Received: (qmail 19781 invoked by uid 500); 1 May 2003 16:59:19 -0000 Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 19768 invoked from network); 1 May 2003 16:59:18 -0000 Received: from theoryx5.uwinnipeg.ca (142.132.1.82) by daedalus.apache.org with SMTP; 1 May 2003 16:59:18 -0000 Received: from localhost (randy@localhost) by theoryx5.uwinnipeg.ca (8.11.6/8.11.6) with ESMTP id h41Gg7g03537; Thu, 1 May 2003 11:42:07 -0500 Date: Thu, 1 May 2003 11:42:07 -0500 (CDT) From: Randy Kobes To: Stas Bekman cc: David Wheeler , Joe Schaefer , Steve Hay , apreq dev list Subject: Re: libapreq-1.2 release candidate In-Reply-To: <3EB08226.7000803@stason.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Thu, 1 May 2003, Stas Bekman wrote: > David Wheeler wrote: [ ... ] > > > > No, the point is that when I told `find` to search for > > "test.pm" it didn't find any "Test.pm" files, and when I told > > it to search for "Test.pm" it didn't find any "test.pm" > > files. So it pays attention to the case you tell it to look > > for when it searches the file system. Theoretically, Perl > > can do this, too, at least on case-insensitive file systems > > that are also case-preserving. > > Ah, that's cool. Care to ask this question at p5p? If there is > some pragma that can solve that, that'll be the end of the > story. Although not perhaps ideal, what about something like the following? As an example, Digest::SHA1 exports a function sha1(). Doing then eval{ require Digest::SHA1; import Digest::SHA1 qw(sha1); sha1(); }; print "Oh oh ... : $@\n" if $@; is OK, but eval{ require Digest::SHa1; import Digest::SHa1 qw(sha1); sha1(); }; print "Oh oh ... : $@\n" if $@; prints out that an undefined subroutine &main::sha1 was called. The call to sha1() is needed for systems, like Win32, and perhaps also MAC OS X, that preserve case when writing filenames but are otherwise case insensitive. Alternatively, like David illustrated from the system, one can from Perl see if the particular module file exists, by going through @INC, using readdir to get a listing, and then grepping through the listing for a particular filename - this will honor case: my $hit; foreach (@INC) { my $dir = "$_/Digest"; next unless -d $dir; opendir(DIR, $dir) or die "Cannot opendir $dir: $!\n"; my @matches = grep {/^SHa1.pm$/} readdir DIR; closedir DIR; $hit++ if @matches; } print "Oh oh - it's not there ...\n" unless $hit; -- best regards, randy