http://www.perlmonks.org?node_id=131523

Are you sick and tired of writing to a file with Net::FTP? Have you thought "gee, it would be nice if graham had made it possible for me to write to a scalar?"

Well, monks, I have. And tonight I decided it was time to do something about it.

So, I present Net::FTP::Scalar.

Here is the sample code, and the module is available on envy.posixnap.net.

#!/usr/bin/perl use warnings; use strict; use Net::FTP::Scalar; $Net::FTP::Scalar::SCALAR_MODE = 1; my $OUT_FILE; my $ftp = Net::FTP::Scalar -> new("ftp.isi.edu", Debug => 0); $ftp -> login("anonymous", "foo@"); $ftp -> cwd("/in-notes"); if (not $ftp -> get("rfc1001.txt")) { $ftp -> quit; die "could not ftp ...\n"; } else { $OUT_FILE = $Net::FTP::Scalar::OUT_FILE; } print $OUT_FILE; exit 0;

--
Laziness, Impatience, Hubris, and Generosity.