It may have just been a type-o but your $CUR_DIR variable is missing an end quote and a semicolon.  Also it wouldn't print anything on your local dir because of the way readir works. From the docs:

 

"If you're planning to filetest the return values out of a readdir, you'd better prepend the directory in question. Otherwise, because we didn't chdir there, it would have been testing the wrong file."

 

Finally it's possible the user that runs the cgi script on the server (ie user "nobody" in unix) may not have permissions to open this network resource.

 

hope this helps.

 

-Wayne

 

 

-----Original Message-----
From: Tfbsr Bertrand [mailto:[EMAIL PROTECTED]
Sent:
Tuesday, November 04, 2003 1:58 PM
To: Activeperl
Subject: cgi script and opendir command

 

I have this bit of code in a cgi script and cannot seems to get it it work.  Is there any problem in calling the opendir command from a cgi script?

 

It always comes back with cannot opendir directory.

If I give it a local path instead of remote path, it open but prints nothing.

Any ideas

Thanks in advance

 

$CUR_DIR = "\\\\myserver\\e\$\\dir1\\dir2

 

opendir(HOMEDIR, $CUS_DIR) || die "can't open customers home directory:$!";
while(defined ($file = readdir(HOMEDIR))) {
 next if $file =~ /^\.\.?$/;
 next if -f $file;
 print "$file\n";

}


Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Reply via email to