You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Richard Dice <rd...@pobox.com> on 2000/12/11 19:47:44 UTC

open/opendir/readdir fail under latest perl/mod_perl/apache

Everyone:

Here's something that myself and my sysadmin guy have been working on
for a bit:  opendir appears to be broken for us on a new Apache/mod_perl
installation.

We've tried checking out the mailing list archives but nothing jumpped
out at us along these lines.

Any ideas from anyone? (much more info follows...)

Thanks,

   - Richard

(BTW, "use CGI::Carp 'fatalsToBrowser';" causes our installation to 
segfault when included in my startup.perl program, which is invoked
from within httpd.conf with 'PerlRequire startup.perl'... just to muddy
the waters some more. :-) )

(BTW 2, do Apache::Registry scripts now allow variable _not_ to have
explicit package declaration and/or explicit lexical declarations?
Damian is showing me a program that he wrote that has neither, and yet
runs under Apache::Registry, and this freaks me out.)

-------- Original Message --------
Subject: open/opendir/readdir fail under latest perl/mod_perl/apache.
Date: Mon, 11 Dec 2000 13:17:59 -0500
From: Damian M Gryski <da...@shad.ca>
To: rdice@pobox.com

   I've been trying to use opendir/readdir under mod_perl 1.24 with
   apache 1.2.14 under Debian GNU/Linux.  The system is an up-to-date
   Debian `woody' system, and so is using the .deb of perl 5.6.0

   The problem is that while neither opendir nor readdir actually return
   errors, they also don't return the results I'm expecting: namely,
   the directory contents.  Instead, the results consist of a list
   containing the correct # of items, but each item is a zero-length
   scalar (and _not_ the undefined value!) rather than a filename.

   This problem does not occur on a system running mod_perl 1.24
   with apache 1.3.12 and perl 5.005_03.  I can't find anything in the
   changelog for either mod_perl or apache suggesting a change in how
   opendir is used.

   Here's some example code that fails:

---8< CUT HERE >8---
#!/usr/bin/perl

use strict;

my $some_dir = "/home/dmg";

opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
my @files = readdir(DIR);
closedir(DIR);

print "Content-type: text/plain\n\n";
print join("\n", @files), "\n";
exit 0;
---8< CUT HERE >8---

   On the working system, it correctly produces the list of files
   in my home directory.  On the `broken' system, it produces a list
   of zero-length strings. (On both systems, it works when run from the
   command line.)

   TIA,

   Damian

-- 
Damian Gryski
ShadNet Admin
damian@shad.ca

Re: open/opendir/readdir fail under latest perl/mod_perl/apache

Posted by Stas Bekman <st...@stason.org>.
On Mon, 11 Dec 2000, Richard Dice wrote:

> Everyone:
> 
> Here's something that myself and my sysadmin guy have been working on
> for a bit:  opendir appears to be broken for us on a new Apache/mod_perl
> installation.

Rich, please send in the relevant parts of the strace output, or may be
you will learn what's the problem while looking at it. I doubt it has
anything to do with mod_perl. Does this code work from the command line?

FYI, your code works for me...

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/