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


in reply to Re^4: in memory files in 5.6.1
in thread in memory files in 5.6.1

how handle these kind of "InMemoryfile" to put this on a local drive

Well, just use a plain file instead!

or to a webserver via HTTP::DAV of (S)FTP ? The transfer programs allways want to have a filename instead a filehandle.

HTTP::DAV implements WebDAV, which is, as the name suggests, an extension to HTTP. HTTP does not know anything about files. So a sane DAV client should be able to upload arbitary data, not just files. And in fact, HTTP::DAV documents for the put method:

One can upload/put a string by passing a reference to a scalar in the -local parameter.

Of course, to access the scalar behind IO::Scalar, you need to pass a reference to a scalar to the constructor IO::Scalar->new(), see IO::Scalar. BTW: You would pass the same reference to HTTP::DAV's put() method.

Net::SFTP implements open, read, write, close. No need to mess with in-memory files, but of course, you could write the scalar used to store the in-memory file using Net::SFTP's write method.

Net::FTP accepts a file name or a file handle for put(), so you should be able to pass the IO::Scalar instance to put().

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)