Re: setting HTTP::Message content_ref ?

Gisle Aas (gisle@activestate.com)
12 Jan 2001 12:27:18 -0800


Heinrich Langos <heinrich@wh9.tu-dresden.de> writes:

> from the documentation i see that HTTP::Message->content can be used
> to get and set the content while ->content_ref can only be used to get
> a reference to the current content.
> 
> is there a special reason for this ?

It is just that there is no way in perl to set up a hash value (which
is what the content attribute of HTTP::Message is) to reference the
same data as the passed in reference reference.  It means we can't get
the true reference semantics unless we change all users of of content
to also deal with "reference to SCALAR" stuff.  One way around this is
to use the Array-RefElem module, but I don't think I want a dependency
it it.

You can do updates through ->content_ref with code like this:

  ${$req->content_ref} = "..................";

but this will still make a copy if you have a multi-megabyte data
block to transfer.

Regards,
Gisle