CC: | pcollins [...] cpan.org |
Subject: | Getting a resource directly to *STDOUT doesn't work in v0.34 |
Hi, I upgraded to HTTP::DAV 0.34 and now experience a bug. I was
previously using HTTP::DAV 0.31 and the following code worked:
$dav->get("-url" => $file_url, "-to" => \*STDOUT, "-callback" => sub
{}) or die "couldn't get $file_url: " . $dav->message();
Basically I am outputting a file from the WebDAV repository to the
standard output. I'm retrieving a file from a WebDAV repository and
want to display it to the remote end (a web browser) without slurping
the file into memory. Note the empty callback parameter. I had to do
this because for some strange reason, in DAV.pm you have the following
line 387:
if ($callback || ref($local_name) =~ /SCALAR/ ) {
Note that you do not check for a GLOB (which my \*STDOUT clearly refers
to). Therefore, I passed in an empty callback to get that block of code
to execute even though there was no real callback. That worked fine in
0.31. Now I find that it does not work in 0.34.
I tried modifying DAV.pm so that the line instead reads:
if ($callback || ref($local_name) =~ /GLOB/ || ref($local_name) =~ /
SCALAR/ ) {
It now will process the GLOB without requiring me to pass in a dummy
callback, but it still doesn't print out the stream of bytes. I do see
that the DAV server is actually serving up the bytes to the DAV client
(HTTP::DAV), but it is not being passed along to the web browser, which
means HTTP::DAV is not spitting out the bytes to STDOUT.
Do you know what is wrong?