You might try:

    $headers->scan(sub {
        $r->headers_out->add(@_);
        print STDERR join("=>", @_), "\n"
    });

The STDERR will output the seen headers to your logs.  

> the problem is that there are many Set-Cookie instructions 
> in $headers but mod_perl seems to use a tied hash to link 
> to the request table and so each set cookie replaces the 
> last as the hash key is seen to equal....?  How do I get 
> around this....I tried:
 
> $r->headers_out->add('Set-Cookie' => $cookieString);
 
This should work.  The add() method is part of the Apache::Table class,
which allows multiple key/value pairs with the same key. See the discussion
of Apache::Table in the eagle book for more details, and an exact example of
what you're trying to do here.  

If HTTP::Headers::scan() doesn't work, you might look into the HTTP::Cookies
module:

  $cookie_jar = HTTP::Cookies->new;
  $cookie_jar->extract_cookies($response);

  $cookie_jar->scan( sub {
        $r->headers_out->add(@_[1,2]);
  }); 

Hope that helps.

Chris

Reply via email to