Different results for command line and CGI for perl web form script -


the code sub:

sub put_file {     my($host, $placement_directory, $tar_directory, $filename, $user, $pass) = @_;     $ftp = net::ftp->new($host) or die "cannot connect localhost";      $ftp->login($user, $pass) or die "cannot log in";      $ftp->cwd($placement_directory);     print $tar_directory."/".$filename;     $ftp->put("$tar_directory/$filename") or die "cannot put file ", $ftp->message;      print "file has been placed \n"; } 

so when sub called test script(that runs command line) uses same config file , of same things cgi script, no errors found , file placed correctly. when sub called cgi script script output $tar_directory."/".$filename not "file has been placed \n" , ftp->message outputs "cannot put file directory changed." seems come cwd line before it.

other info: have tried running test script multiple users same result. use strict , warnings. tar file being moved created script.

i'm new perl advice helpful because i'm stuck on , cant find using power of google.

just guess. ftp->put failing, triggering die. unless have:

use cgi::carp qw(carpout fatalstobrowser); 

you won't see die message in browser. since died, don't see final print statement either.

check webserver log die output, or change "die" "print".


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -