httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <>
Subject Re: libapreq-1.2 release candidate
Date Thu, 01 May 2003 16:42:07 GMT
On Thu, 1 May 2003, Stas Bekman wrote:

> David Wheeler wrote:
[ ... ]
> > 
> > No, the point is that when I told `find` to search for
> > "" it didn't find any "" files, and when I told
> > it to search for "" it didn't find any ""
> > 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

my $hit;
foreach (@INC) {
  my $dir = "$_/Digest";
  next unless -d $dir;
  opendir(DIR, $dir) or die "Cannot opendir $dir: $!\n";
  my @matches = grep {/^$/} readdir DIR;
  closedir DIR;
  $hit++ if @matches;

print "Oh oh - it's not there ...\n" unless $hit;

best regards,

View raw message