Re: LWP and $content
ts (decoux@moulon.inra.fr)
Sat, 5 Aug 1995 12:48:18 +0200
> No, that's a bit tricky: the content is not actually used until the
> Protocol/whatever module. So not only would yo need to educate the
> LWP::Request about files (and don't forget Content-length), you
> also need to change all the protocols to use this new interface.
> That could be quite a big change... And you might even want a more
> generic sub or module approach, rather than restricting yourself
> to files. Anyway, that needs careful thought rather than a hack.
>
> If the size of the content is a big problem, it might at least be reduced
> by preventing the content copies in LWP::protocol::http::request()...,
> and using references instead. That can be done in addition to the current
> interface, just add a $request->contentref;
>
What about making no modification but :
if(ref($content) eq "SCALAR") {
$senddata .= $$content;
} elsif(ref($content) ne "CODE") {
$senddata .= $content;
}
$socket->write($senddata);
&$content($socket) if ref($content) eq "CODE";
With this, an application can put it's specific sub to send the content, no ?
Guy Decoux