#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use lib '/usr/local/lib/perl/';
use LFTP;

my $lftp_bin = "/home/user/local/bin/lftp";
my $user = "user";
my $password = "password";
my $host = "127.0.0.1";
my $port = "21";

#starting new lftp process, no timeout = indefinite
my $lftp = LFTP->new({'lftp_bin' => $lftp_bin,
                      'timeout' => '30',
});

#To connect
$lftp->command("open -u $user,$password -p $port $host");

#enter dir
$lftp->command("cd test_dir",6);

#Do a ls
my @list = $lftp->command("ls");

#Quit the lftp process
$lftp->command("quit");

#print what we got from the ls
print Dumper @list;
