IPC-PerlSSH
view release on metacpan or search on metacpan
* Added 'Port' and 'SshOptions' constructor arguments
* Added 'Readh'+'Writeh' constructor form
* Use Test::Fatal instead of Test::Exception
* Various documentation updates
0.14 CHANGES:
* Provide STDERR-capturing versions of Library::Run functions
(fixes https://rt.cpan.org/Ticket/Display.html?id=49440)
0.13 BUGFIXES:
* Avoid fchmod/fchown on perls before 5.8.8
0.12 BUGFIXES:
* Handle SIGPIPE in Run::system_inout, handle exec() failures
* Always load library initialisation, even with partial load lists
* Fix tests/libraries to work on perl versions prior to 5.10 -
package variables need re-declaring
0.11 CHANGES:
* Added 'use warnings'
* Created Run and IO libraries
lib/IPC/PerlSSH/Library/FS.pm view on Meta::CPAN
=head1 FUNCTIONS
=head2 Simple Functions
The following perl functions have trivial wrappers that take arguments and
return values in the same way as perl's. They throw exceptions via the
C<IPC::PerlSSH> call when they fail, rather than returning undef, because
otherwise C<$!> would be difficult to obtain.
chown chmod lstat mkdir readlink rename rmdir stat symlink unlink utime
The following functions are imported from L<File::Path> with the following
API adjustments:
mkpath( $path, %opts ) # %opts supports mode, user, group
rmtree( $path, %opts ) # %opts supports safe, keep_root
=cut
init q{
use File::Path qw( mkpath rmtree );
};
func chown =>
q{my $uid = shift; my $gid = shift;
chown $uid, $gid, $_ or die "Cannot chown($uid, $gid, '$_') - $!" for @_;};
func chmod =>
q{my $mode = shift;
chmod $mode, $_ or die "Cannot chmod($mode, '$_') - $!" for @_;};
func lstat =>
q{my @s = lstat $_[0]; @s or die "Cannot lstat('$_[0]') - $!"; @s};
func mkdir =>
q{mkdir $_[0] or die "Cannot mkdir('$_[0]') - $!"};
lib/IPC/PerlSSH/Library/IO.pm view on Meta::CPAN
Only works on versions of remote F<perl> 5.8.8 and above.
=cut
func fchmod => q{
die "Perl too old for fchmod()" if $] < 5.008008;
my $fh = get_handle( shift );
chmod( $_[0], $fh ) or die "Cannot chmod() - $!\n";
};
=head2 fchown
Changes the owner (and group) of the remote filehandle.
$ips->call( "fchown", $uid, $gid )
Note the order of arguments does not match perl's C<chown()>.
Only works on versions of remote F<perl> 5.8.8 and above.
=cut
func fchown => q{
die "Perl too old for fchown()" if $] < 5.008008;
my $fh = get_handle( shift );
chown( $_[0], $_[1], $fh ) or die "Cannot chown() - $!\n";
};
=head1 AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
=cut
0x55AA;
t/22library-IO.t view on Meta::CPAN
is_deeply( \@stat, [ stat "$dir/testfile" ], 'fstat == local stat' );
SKIP: {
skip( "Perl too old to support fchmod()", 1 ) if $] < 5.008008;
$ips->call( "fchmod", $fd, 0755 );
is( (stat "$dir/testfile")[2] & 0777, 0755, 'fchmod works' );
}
# Can't test fchown without being root, but since it's simple and so similar
# to fchmod we'll presume it works...
$ips->call( "close", $fd );
# Test of pipe-open
$fd = $ips->call( "open", "-|", "$^X", "-e", 'print "Hello over the pipe\n"; exit 10' );
ok( $fd > 2, 'remote pipeopen gets filehandle' );
$data = $ips->call( "getline", $fd );
( run in 1.842 second using v1.01-cache-2.11-cpan-71847e10f99 )