On Fri, 17 Aug 2001, Geoffrey Young wrote:

> > I've got a question for the mod_perl world about the behavior of the 
> > $r->headers_in->do(sub {...some code...}) method.

<code snipped>

> it probably won't matter, but do() iterates through the table and exits
> either when the list is exhausted or the subroutine returns a non-true value
> 
> $r->headers_in->do(sub {
>   $request->header(@_);
>   #print STDERR "header passed: (@_)\n";
>   1;
>   });
> 
> like the Eagle book does and see if that helps.  Otherwise, there might be
> something going on internally with Apache where the proxy headers are
> stripped.  I don't do proxies, so I'm not that familar with the mechanics of
> them...
> 
> --Geoff

Thanks Geoff. In fact, it did matter, and solved the problem.

In the process, I've found what seems to be a mistake, or at least an
oversight, in the Eagle book...  (a good workman and all, I know, but bear with
me) 

On page 475, it has do() explained exactly as Geoff stated above,
i.e. that the subroutine reference passed to it must return a true value
or the iteration will stop. 

But on page 380, it has the following code as part of example 7-12:

$r->headers_in->do(sub {
    $request->header(@_);
});

>From what I can see, HTTP::Request->header returns undef when
setting a header value, so while this code isn't strictly incorrect, it
won't pass the full header set, just the first header-value pair.

Is this right? I'm fairly new at this, so if anyone else would mind
checking this out, I'd appreciate it.

Thanks.

-mike

-- 
Michael Styer           [EMAIL PROTECTED]
phone: 020 7603 5723    107 Shepherd's Bush Rd
fax: 020 7603 2504      London W6 7LP

Reply via email to