#!/usr/bin/perl

use strict;
use warnings;
use open ':std', ':encoding(UTF-8)';

use FileHandle;
use Net::FTP::Recursive;

use lib '/app/tools/bookpub/lib';
use BookPub::Catalog::Import::Process::Fetcher::Base;


my $fetcher = BookPub::Catalog::Import::Process::Fetcher::Base->new( 'importRecord' => -1 );
my $ftpSite     = $fetcher->_ftpSite();
my $ftpUserName = $fetcher->_ftpUserName();
my $ftpPassword = $fetcher->_ftpPassword();

my $fh = FileHandle->new( "/tmp/ftplisting.txt", "w" );
$fh->autoflush;

my $ftp = Net::FTP::Recursive->new( $ftpSite, 'Debug' => 0 );
$ftp->login( $ftpUserName, $ftpPassword );
$ftp->rls( 'Filehandle' => $fh, 'PrintSize' => 1  );
$ftp->quit;
$fh->close;
