in reply to File test on remote machine and mkpath
when running the former example we obtain an output like this:$ cat copyandmkdir.pl #!/usr/local/bin/perl -w use strict; use GRID::Machine; my $host = 'orion.pcg.ull.es'; my $dir = shift || "somedir"; my $file = shift || $0; # By default copy this program my $machine = GRID::Machine->new( host => $host, uses => [qw(Sys::Hostname)], ); my $r; $r = $machine->mkdir($dir, 0777) unless $machine->_w($dir); die "Can't make dir\n" unless $r->ok; $machine->chdir($dir)->ok or die "Can't change dir\n"; $machine->put([$file]) or die "Can't copy file\n"; print "HOST: ",$machine->eval(" hostname ")->result,"\n", "DIR: ",$machine->getcwd->result,"\n", "FILE: ",$machine->glob('*')->result,"\n";
$ copyandmkdir.pl HOST: orion DIR: /home/casiano/somedir FILE: copyandmkdir.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File test on remote machine and mkpath
by DeadPoet (Scribe) on Jan 18, 2011 at 00:16 UTC |