Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 50393
Status: rejected
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: justincase [...] yopmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: add_handler() doesn't appear to work when default_headers() is used
Apparently add_handler() is the new recommended way of debugging LWP- but it doesn't appear to work when default_headers are specified. Attached is a test script which demonstrates this.
Subject: try.pl
#!/usr/bin/env perl use strict; use warnings; use Compress::Zlib; use Data::Dump; use LWP::UserAgent; my $ua = LWP::UserAgent->new; #$ua->default_headers(accept_encoding => 'gzip,deflate'); $ua->default_headers(dingo => 123); $ua->add_handler(request_send => sub { shift->dump; return }); my $res = $ua->get('http://www.google.com/'); ddx $res->request;
You need to drop the 's' in the call to $ua->default_headers. That makes it $ua- Show quoted text
>default_header(dingo => 123).
The $ua->default_headers method (with an 's') take a HTTP::Headers object as argument. If you have tried to print the $res object returned you would have seen something like: 400 Can't locate object method "header_field_names" via package "dingo" (perhaps you forgot to load "dingo"?)