NAME
Net::SFTP::Foreign::Tempdir::Extract - Secure FTP client integrating SFTP, Tempdir, and Archive Extraction
SYNOPSIS
use Net::SFTP::Foreign::Tempdir::Extract;
my $sftp=Net::SFTP::Foreign::Tempdir::Extract->new(
user => $user,
match => qr/\.zip\Z/,
backup => "./backup", #default is not to backup
delete => 1, #default is not to delete
);
This is a typical implementation
package My::SFTP;
use base qw{Net::SFTP::Foreign::Tempdir::Extract};
sub host {"myserver.mydomain.tld"};
sub folder {"/myfolder"};
sub match {qr/\Amyfile\.zip\Z/};
Then in script
use My::SFTP qw{};
my $file=My::SFTP->new->next or exit; #SFTP file watcher...
DESCRIPTION
Secure FTP client which downloads files locally to a temp directory for operations and automatically cleans up all temp files after variables are out of scope.
USAGE
CONSTRUCTOR
new
METHODS
download
Downloads the named file in the folder.
my $file=$sftp->download("remote_file.zip"); #isa Net::SFTP::Foreign::Tempdir::Extract::File
my $file=$sftp->download("/remote_folder", "remote_file.zip"); # which isa Path::Class::File object with an extract method
next
Downloads the next file in list and saves it locally to a temporary folder. Returns a Path::Class::File object or undef if there are no more files.
list
Returns list of filenames that match the folder and regular expression
Note: List is shifted for each call to next method
PROPERTIES
host
SFTP server host name.
user
SFTP user name (defaults to current user)
folder
Folder on remote SFTP server.
match
Regular Expression to match file names for the next iterator
backup
Sets or returns the backup folder property.
delete
Sets or returns the delete boolean property.
OBJECT ACCESSORS
sftp
BUGS
Send email to author and log on RT.
SUPPORT
DavisNetworks.com supports all Perl applications including this package.
AUTHOR
Michael R. Davis
CPAN ID: MRDVT
Satellite Tracking of People, LLC
mdavis@stopllc.com
http://www.stopllc.com/
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.