perl-docs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: Quick Documentation Fix
Date Fri, 07 Apr 2006 12:54:43 GMT


Miles Crawford wrote:
> 
> On:
> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_out_
> and
> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_err_headers_out_
> 
> 
> it is suggested that the proper syntax for adding a header is:
> 
> $r->headers_out->add('Set-Cookie' => $cookie);
> 
> This howerver does not work. 

of course it does.  you can see from yourself in the mod_perl test suite:

t/response/TestAPI/err_headers_out.pm [21]:
$r->err_headers_out->add('X-err_headers_out' => "err_headers_out");

using the set() or add() interface is the preferred method, over the tied
interface shown below.

> The example at:
> http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_err_header_out_
> 
> 
> has it right, with:
> 
> $r->headers_out->{'Pragma'} = "no-cache";

this documentation is for the compat layer.  I can't recall offhand whether
this syntax works without Apache2::compat or not.

but regardless, so you know, the first example adds to any existing
Set-Cookie outgoing headers, and only in the headers_out table, which will
not persist across REDIRECT responses (use err_headers_out for that).  the
second example overwrites any existing Pragma headers in headers_out table.

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Mime
View raw message