in reply to Re^3: libwww-perl basics
in thread libwww-perl basics

I tried that, and I get:

Can't locate object method "headers" via package "LWP::UserAgent" at.. +.

I also tried:

for my $header (@{$response->headers->header_field_names}) { print $header, ": ", $response->header($header), "\n"; }
and I got:
Can't use string ("29") as an ARRAY ref while "strict refs" in use at. +..

Replies are listed 'Best First'.
Re^5: libwww-perl basics
by roboticus (Chancellor) on Aug 12, 2010 at 18:23 UTC

    OK, then try it like this:

    for my $header ($response->headers->header_field_names) { ... }

    ...roboticus

      That works (thank you), although (somewhat oddly) all of the cookies (multiple headers with the same field name) are run together.
      for my $header ($response->headers->header_field_names) { print $header, ": ", $response->header($header), "\n"; }
      That produces:
      [...] Set-Cookie: cookiea; expires=[time]; path=/; domain=.example.comcookie +b expires=[time]; path=/; domain=.example.comcookiec expires=[time]; +path=/; domain=.example.com; HttpOnly [...]
      I can live with that for now.