File::Slurp::Remote::SmartOpen - open files locally or remotely automatially
use File::Slurp::Remote::SmartOpen; smartopen($file, $fd, $mode);
This module provides one function: smartopen($file, $fd, $mode). The function looks at the filename. If it has a colon in it, then it assumes that what comes before the colon is a hostname. If that hostname is not the hostname of the local system, it uses ssh to get to the remote system to open the file.
smartopen($file, $fd, $mode)
If the filename ends with .gz or .bz2, then it will pipe the input (or output) though zcat or bzcat (gzip or bzip2) as it opens the file.
.gz
.bz2
zcat
bzcat
gzip
bzip2
The mode can be r or w. It defaults to read.
r
w
By default, remote files are accessed with
ssh -o StrictHostKeyChecking=no
You can override that by redefining $File::Slurp::Remote::SmartOpen::ssh.
$File::Slurp::Remote::SmartOpen::ssh
smartopen("host1:/etc/passwd", my $fd, "r");
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.
To install Tie::Function::Examples, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::Function::Examples
CPAN shell
perl -MCPAN -e shell install Tie::Function::Examples
For more information on module installation, please visit the detailed CPAN module installation guide.