From fcd581a553d3dc8264debc85d2d7fbf959d122e8 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 4 Jul 2009 14:27:17 +0200 Subject: Properly give undef as argument when a URL subpattern didn't match This gets rid of the following sequence of warnings: Use of uninitialized value in subtraction (-) at yawf/lib/YAWF.pm line 143. Use of uninitialized value in subtraction (-) at yawf/lib/YAWF.pm line 143. Use of uninitialized value in substr at yawf/lib/YAWF.pm line 143. --- lib/YAWF.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/YAWF.pm b/lib/YAWF.pm index b9fe7f8..062cae6 100644 --- a/lib/YAWF.pm +++ b/lib/YAWF.pm @@ -140,7 +140,7 @@ sub handle_request { my @args; for (@handlers ? 0..$#handlers/2 : ()) { if($loc =~ /^$handlers[$_*2]$/) { - @args = map { substr $loc, $-[$_], $+[$_]-$-[$_] } 1..$#- if $#-; + @args = map defined $-[$_] ? substr $loc, $-[$_], $+[$_]-$-[$_] : undef, 1..$#- if $#-; $han = $handlers[$_*2+1]; last; } -- cgit v1.2.3