Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

-mark

share|improve this question

2 Answers 2

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 "../perlscript.pl";
  • do "/var/www/perl/perlscript.pl";

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

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

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

Your Answer

 
discard

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.