Re: LWP and $content

Martijn Koster (mak@victor.nexor.co.uk)
Mon, 07 Aug 1995 17:51:50 BST


In message <199508070846.KAA09699@moulon.inra.fr>, ts writes:

> > Yes it should work for http, but I don't like to give out the filedescripto
>r.  
> > There might be protcols where this will not be appropriate (for instance 
> > mailto based on Mail::Send).  I would rather see an interface more like the
> 
> > one for content in the response.
> 
>  Hey, I've made this modification in LWP::Protocol::http.pm !
>  This module don't handle `mailto:', it handle only `http:' !

Sure, but you're redefining the interfaces, which affects all protocols.

I aggree with Gisle I'd rather see a sub based solution as used in the
response. That might also help with interrupts.
 
>     if(ref($content) eq "SCALAR") {
>         $senddata .= $$content;
>     } elsif(ref($content) ne "CODE") {
>         $senddata .= $content;
>     }
 
I think that use of ref() is probably a good idea. 
Note you're still copying it to $senddata, it'd be better to actually
write it straight from the reference.

-- Martijn
__________
Internet: m.koster@nexor.co.uk
X-400: C=GB; A= ; P=Nexor; O=Nexor; S=koster; I=M
WWW: http://web.nexor.co.uk/mak/mak.html