From: Mischa POSLAWSKY Date: Sat, 31 May 2008 20:35:54 +0000 (+0000) Subject: undefined warnings while reading unknown headers X-Git-Tag: 3.21~5 X-Git-Url: http://git.shiar.nl/perl/plp/.git/commitdiff_plain/bf62119532c8dec24b9e534996fb2b8ba8448366 undefined warnings while reading unknown headers Return undef for unaliased headers right away, instead of trying to find $header{+undef}. Result is the same (the '' header never exists at this point), but without the warning. --- diff --git a/lib/PLP/Tie/Headers.pm b/lib/PLP/Tie/Headers.pm index 8e023fb..ea2f172 100644 --- a/lib/PLP/Tie/Headers.pm +++ b/lib/PLP/Tie/Headers.pm @@ -39,7 +39,8 @@ sub FETCH { $self->[2] = 0; } $key =~ tr/_/-/; - return $self->[0]->{ $self->[1]->{lc $key} }; + defined ($key = $self->[1]->{lc $key}) or return; + return $self->[0]->{$key}; } sub STORE {