Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a perl script that wants to get a list of file in a directory using either opendir/readdir OR glob. It works fine if that directory is below the one the perl script is in OR /tmp. For any other directory it says it's empty!

Am I missing something? I made sure my permissions exactly match those of /tmp and I can't read anything on that other directory. Are there some funky directives that I need to change? I even looked for special references to 'tmp' in all the conf files and nothing.

Has anyone seen this behavior before? I'm running RHEL6.2


share|improve this question

Did this script work on < RHEL6.2? Are you using mod_perl or perl cgi? If the later, are you using suExec? If so, try adding this to your script, in case logging's broken somewhere:

use CGI::Carp qw(fatalsToBrowser);

share|improve this answer

Be sure to use absolute path names in your script.
For example:

  • do "../";
  • do "/var/www/perl/";

Same thing with all your open(...); statements.

Here's a good snippet for finding the server directory you're script is in.

use Cwd;
print "Content-Type: text/plain\n\n"
print getcwd(), $/;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.