CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Net::Ftp in a scheduled task

 



stamina_josh
New User

Jul 8, 2008, 9:18 AM

Post #1 of 3 (1296 views)
Net::Ftp in a scheduled task Can't Post

Hi, I am trying to use Net::Ftp in a windows scheduled task but it just won't work. I scaled down my script to just try and do a directory listing to keep it as simple as poss:

___________________________________
$dest_server = "blah" ;
$remote_user = "blah";
$remote_pass = "blah" ;
my @remote_files ;

print "Logging into $dest_server\n" ;
my $ftp_conn = Net::FTP->new($dest_server) or die "Can't open $dest_server $@\n" ;
$ftp_conn->login($remote_user, $remote_pass) or die "Can't login to $dest_server $@\n" ;
print "Successfully logged in.\n" ;
print "Setting to binary mode.\n" ;
$ftp_conn->binary() ;
my @remote_files = $ftp_conn->ls ;

print "remote files: \n" ;
map {print $_ ."\n" } @remote_files ;
if (! @remote_files) {
print "\tNo files found.\n"
}
___________________________________

This works absolutely fine from the command line (using cygwin). Can anyone please help?


travs69
Novice

Jul 8, 2008, 10:46 AM

Post #2 of 3 (1292 views)
Re: [stamina_josh] Net::Ftp in a scheduled task [In reply to] Can't Post

I'm not sure what you expect it to do. It's just printing the output.. which you will probably never see. Are you logging anything to file or are you using the task schedulers output to tell you it failed. I think when you use the task scheduler you have to specifiy c:/perl/bin/perl.exe c:/path/to/script.pl also. (could be wrong.. haven't used it in a long time).


stamina_josh
New User

Jul 9, 2008, 1:33 AM

Post #3 of 3 (1246 views)
Re: [travs69] Net::Ftp in a scheduled task [In reply to] Can't Post

Thanks for your reply. Upon further investigation I noticed that when called without the full path, it is obviously picking up the first perl it comes across. In this case it is using the perl in cygwin's path. I'm not sure why this affects the ftp module but will run a few tests directing it at the activestate perl instead.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives