Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

could not save .exp output file

Status
Not open for further replies.

SunnyVu

Technical User
Oct 30, 2006
3
US
Hi,

I am new to PERL. I just setup an IIS server with PERL to learn .cgi and expect(.exp) scripts. .cgi pages are loading fine. I also able to run the test.exp scripts in Cygwin. However when I try to use the script below to generate the tmp file and read from it. Somehow the file is not written to the same directory (cgi-bin). I already set the Web permission for this directory as read/write. Is there any other settings I need to check when the file could not be written? Thanks all.

if($hostname ne ""){

print ("$hostname\n");
$tmp = "tmp".rand;
system "c:/expect/bin/expect test.exp $hostname $cmd> $tmp";

open fp, "<$tmp";
while(<fp>){
if($harpo != -1)
{print dd($_);
}
}
close fp;
}
 
I would hard code in all of your paths.

system "c:/expect/bin/expect test.exp $hostname $cmd> $tmp";

would become something like
system "c:/expect/bin/expect /path/to/testexp/test.exp $hostname $cmd> /path/to/cgi-bin/$tmp"

You don't want to ever assume that just because something works when you run it from CLI that anything like paths or ENV variables will be carried over to how it runs from the web.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top