Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

How to read the network file.

by ungalnanban (Pilgrim)
on May 13, 2010 at 04:29 UTC ( #839771=perlquestion: print w/ replies, xml ) Need Help??
ungalnanban has asked for the wisdom of the Perl Monks concerning the following question:

I'm using the Net::FTP for get the remote hosting file. I want to read the file. I don't want to get the file from remote host to my host (local host) I need to read the file content only,is there any module to do this.

use strict; use warnings; use Data::Dumper; use Net::FTP; my $ftp = Net::FTP->new("",Debug => 0) or die "Cannot connect to $@"; $ftp->login("root",'root123') or die "Cannot login ", $ftp->message; $ftp->cwd("SUGUMAR") or die "Cannot change working directory ", $ftp->message; $ftp->get("Testing.txt") or die "get failed ", $ftp->message; $ftp->quit;
In the above sample program I get the file from then I will read the file and do the operation, I don't want to place the file in my local system. I need to read the "Testing.txt" file content.


Comment on How to read the network file.
Download Code
Replies are listed 'Best First'.
Re: How to read the network file.
by nagalenoj (Friar) on May 13, 2010 at 05:28 UTC
    File::Remote - Read/write/edit remote files transparently.

    You could also manually so ssh to the host you want and read/write files of the host(which has been done internally in the above module).

Re: How to read the network file.
by marto (Bishop) on May 13, 2010 at 06:20 UTC

    As a side note please remember that ftp does not encrypt data. In the example above you're sending your root password in plain text, the file you get is also transferred without encryption. File::Remote can be configured to use ssh or scp.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://839771]
Approved by planetscape
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-11-29 02:38 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls