Subject: | HTTP::Config->match generates "uninitialized value" in matching method |
Date: | Tue, 28 Jun 2016 15:24:37 +0200 |
To: | bug-HTTP-Message [...] rt.cpan.org |
From: | Branislav Zahradnik <branislav.zahradnik [...] gooddata.com> |
Use case: LWP::UserAgent response redirect handler with matching
specific response header, eg "Client-Warning"
Current code:
m_header__ => sub {
my($v, $k, $uri, $request, $response) = @_;
return unless $request;
return 1 if $request->header($k) eq $v;
return 1 if $response && $response->header($k) eq $v;
return 0;
},
Quick fix:
m_header__ => sub {
my($v, $k, $uri, $request, $response) = @_;
return unless $request;
return 1 if $request->header($k) && $request->header($k) eq $v;
return 1 if $response && $response->header($k) &&
$response->header($k) eq $v;
return 0;
},
or just disable warnings in those lamdas.