From bf62119532c8dec24b9e534996fb2b8ba8448366 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 31 May 2008 20:35:54 +0000 Subject: [PATCH] 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. --- lib/PLP/Tie/Headers.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 { -- 2.30.0