Connector::Proxy::Net::SFTP
Read/Write files to/from a remote host using FTP.
LOCATION is the only mandatory parameter, if neither file nor path is set, the file is constructed from the arguments given to the method call.
The DNS name or IP of the target host.
Port number (Integer), default is 22.
A basedir which is always prepended to the path.
Pattern for Template Toolkit to build the content. The data is passed "as is". If data is a scalar, it is wrapped into a hash using DATA as key.
SFTP username
SFTP password
SFTP connection timeout, default is 30 seconds
Set the debug flag for Net::SFTP
HashRef holding additional arguments to pass to underlying object. @see Net::SFTP / Net::SSH::Perl
Write data to a file.
$conn->set('filename', { NAME => 'John Doe', 'ROLE' => 'Administrator' });
See the file parameter how to control the filename.
Fetch data from a file. See the file parameter how to control the filename.
my $data = $conn->set('filename');
Return the file names in the given directory.
my $conn = Connector::Proxy::Net::SFTP->new({ LOCATION => 'localhost', file => '[% ARGS.0 %].txt', basedir => '/var/data/', content => ' Hello [% NAME %]', }); $conn->set('test', { NAME => 'John Doe' });
Results in a file /var/data/test.txt with the content Hello John Doe.
To enable the transfer, the file is created on the local disk using tempdir/tempfile. The directory is created with permissions only for the current user, so no other user than root and yourself is able to see the content. The tempfile is cleaned up immediatly, the directory is handled by the internal garbage collection.
To install Connector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Connector
CPAN shell
perl -MCPAN -e shell install Connector
For more information on module installation, please visit the detailed CPAN module installation guide.