From: Mischa POSLAWSKY Date: Mon, 2 Jun 2008 06:56:40 +0000 (+0000) Subject: fix delete %header X-Git-Tag: 3.22~5 X-Git-Url: http://git.shiar.nl/perl/plp/.git/commitdiff_plain/6c6d67b2fb0a2a211f3603edcb2d2f7609f51f4f fix delete %header Header value wasn't deleted case-insensitively. Because the alias was still removed correctly, it usually worked, but as of recently producing warnings in sendheaders(). Also, delete returned the original key (not documented anywhere). Change this to always return the deleted value, matching the behaviour of normal hashes and user expectation. --- diff --git a/Changes b/Changes index 346aa41..5c8b1d7 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ +- Fix delete %header - Fix breakage with old versions of Exporter - Tests emulating actual PLP usage diff --git a/lib/PLP/Tie/Headers.pm b/lib/PLP/Tie/Headers.pm index ea2f172..f0db968 100644 --- a/lib/PLP/Tie/Headers.pm +++ b/lib/PLP/Tie/Headers.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = '1.00'; +our $VERSION = '1.01'; =head1 PLP::Tie::Headers @@ -64,8 +64,8 @@ sub STORE { sub DELETE { my ($self, $key) = @_; $key =~ tr/_/-/; - delete $self->[0]->{$key}; - return delete $self->[1]->{lc $key}; + defined ($key = delete $self->[1]->{lc $key}) or return; + return delete $self->[0]->{$key}; } sub CLEAR {