0

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

Mark J Seger
  • 161
  • 1
  • 6

2 Answers2

0

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);

MrTuttle
  • 1,176
  • 5
  • 5
0

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(), $/;
ZnArK
  • 629
  • 4
  • 11