Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I write to a remote server

Status
Not open for further replies.

dimitad

Programmer
Joined
Sep 16, 2006
Messages
10
Location
US
Hi all,

Is there a module or command in Perl that allows you to write/delete files that are on a different machine (both being UNIX) just by providing the url for that machine and the path to the file.
I was trying to get it to work with File::Remote but I get an error that the file does not exist. Here is the code:

#!/usr/bin/perl
use strict;
# check if required modules are present

use File::Remote qw(:replace);
setrsh('/usr/bin/ssh');
setrcp('/usr/bin/scp');
open (REMOTE, "server_url:/home/classes/eese/projects/sendemail.php") or die $!;
print while(<REMOTE>);
close(REMOTE);
 
This should work
Code:
use File::Remote qw(:replace);
setrsh('/usr/bin/ssh');
setrcp('/usr/bin/scp');
open (REMOTE, "/home/classes/eese/projects/sendemail.php") or die $!;
print while(<REMOTE>);
close(REMOTE);

M. Brooks
 
Hmm but the remote server "server_url" from above requires login and is missing in the code you provided.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top