Here are my subroutines for doing an ftp using a perlTK script. I've left out all the items above because it all works except for my subroutine in actually selecting an item and then pushing my "get file" button.
Subroutine to get files and list them to listbox. This sub works fine
============================================================
sub ftp_site_dell
{
my $ftp = Net::FTP->new ($ftp_site_dell)
or die "Could not connect";
$ftp->login($ftp_user, $ftp_password)
or die "Could not login";
$ftp->binary(); # Set binary mode
$ftp->cwd($ftp_dir)
or die "Could not change directories";
# List the files in the directory
my @remote_files = $ftp->ls($list_files);
foreach my $file (@remote_files)
# Put the files from ftp ls into the listbox
{
$files_lb->insert('end', $file);
}
========================================================
This is where I have problems. I just cannot figure out how to select the item i want and then when I push my button "get" that item via ftp get.
sub get_files
{
my @selected_files = $files_lb->curseselection();
foreach (@selected_files) {
my $ftp->get(@selected_files);
}
========================================================
I don't think I copied the code over with all the right curly brackets so just disregard that. I know I'm not using the right perl here but I just can't figure it out. Do I need separate subroutines??
Any help again is always appreciated. Also, just note this is really ugly code and I apologize to the real perl programmers out there.
TIA!
Subroutine to get files and list them to listbox. This sub works fine
============================================================
sub ftp_site_dell
{
my $ftp = Net::FTP->new ($ftp_site_dell)
or die "Could not connect";
$ftp->login($ftp_user, $ftp_password)
or die "Could not login";
$ftp->binary(); # Set binary mode
$ftp->cwd($ftp_dir)
or die "Could not change directories";
# List the files in the directory
my @remote_files = $ftp->ls($list_files);
foreach my $file (@remote_files)
# Put the files from ftp ls into the listbox
{
$files_lb->insert('end', $file);
}
========================================================
This is where I have problems. I just cannot figure out how to select the item i want and then when I push my button "get" that item via ftp get.
sub get_files
{
my @selected_files = $files_lb->curseselection();
foreach (@selected_files) {
my $ftp->get(@selected_files);
}
========================================================
I don't think I copied the code over with all the right curly brackets so just disregard that. I know I'm not using the right perl here but I just can't figure it out. Do I need separate subroutines??
Any help again is always appreciated. Also, just note this is really ugly code and I apologize to the real perl programmers out there.
TIA!