"Peter A. Eisch" <[EMAIL PROTECTED]> writes:
> Yeah, pretty much except that I pass a reference to the object. My call
> evolved from passing the blob of stuff to write in a var that I passed as a
> reference to avoid having a dozen copies of it (passed by value) made on the
> stack. Maybe passing an object by reference is bad form? My usage
> currently goes something like:
>
> my $fh = new FileHandle $myfile, 'r';
> $resp = HTTP::Request->new(
> 'PUT',
> $remote,
> $headers,
> \$fh,
> );
Note that you can already get this effect with code like this (untested):
open(my $fh, "<", $myfile);
binmode($fh);
my $resp = HTTP::Request->new(PUT => $remote, $headers,
sub { my $buf; read($fh, $buf, 1024); $buf });
Regards,
Gisle