Hi hanenkamp,
please do you have an idea to how handle these kind of "InMemoryfile" to put this on a local drive or to a webserver via HTTP::DAV of (S)FTP ?
The transfer programs allways want to have a filename instead a filehandle.
Regards
WolliK
| [reply] |
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". ;-)
| [reply] [d/l] [select] |
Hi affoken,
I've tried different ways, but none of them works.
I've created a InMemoryFile withe two lines;
foo_line_01\n
foo_line_02\n
Here are the output of my tests:
Try to upload all the *.txt files from this directory:
command: ..put( -local => "*.txt", -url => "$url/$base_dir/$work_dir" )
Reply..: put *.txt succeeded
Try to upload the InMemoryfile accessed via filehandler $fh:
command: ..put( -local => "$fh", -url => "$url/$base_dir/$work_dir" )
Reply..: put foo_Line_01
foo_Line_02
failed
command: ..put( -local => \$fh, -url => "$url/$base_dir/$work_dir" )
Reply..: put REF(0x274dc28) failed
command: ..put( -local => $fhref, -url => "$url/$base_dir/$work_dir" )
Reply..: put REF(0x274dc28) failed
command: ..put( -local => "\$fh", -url => "$url/$base_dir/$work_dir" )
Reply..: put $fh failed
command: ..put( -local => "\$fhref",-url => "$url/$base_dir/$work_dir" )
Reply..: put $fhref failed
Any idea how to handle the -local parameter of the HTTP::DAV put request for an InMemoryfile linehandler?
Regards
WolliK
| [reply] |