http://qs321.pair.com?node_id=533741

Eyck has asked for the wisdom of the Perl Monks concerning the following question:

Salut,

I've got a little problem with great DAV-explorer - 'dave', it has got a great interface, works fine, until you try to impress your peers and show off it's abilities by transferring securely and easily (https) few gigabyte sized file...
your workstation suddenly melts. Not good.

Here's the culprit:

binmode F; while(<F>) { $content .= $_; } close F;

All is well and good, although this code appears not in dave itself, but in HTTP::Dav library (line 877, /usr/share/perl5/HTTP/DAV.pm), since this problem exists in library and not in dave, it's way harder to fix, especially since the problem here actually is not with HTTP::Dav, but with LWP itself, because it requires $content parameter to be copied scalar..

Fixing LWP would be rather heroic task, it is widely used, you would have to either change it's API, or maybe extend it to support passing filehandles...

What are the options? It's obvious that one would try to make his fixes as non-invasive as possible (fixing relatively esoteric HTTP::Dav) but the more logical and usefull thing would be to fix the problem at it's source.., is there some way to MMAP a file into scalar? how should one go about changing as popular lib as LWP?