From 57919bf75b3031f3abab6d697de2ce354588a38d Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 4 Jan 2010 20:54:32 +0100 Subject: [PATCH] Treat undefined variables as empty string in tests. This prevents warnings when using comparison attributes together with variables that are undefined. --- general/interpolate_fancy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/general/interpolate_fancy b/general/interpolate_fancy index c455769..4b8b759 100644 --- a/general/interpolate_fancy +++ b/general/interpolate_fancy @@ -155,6 +155,11 @@ sub do_interpolate { sub _test { my($variable, $attr) = @_; + # If the variable is not defined, treat it as the empty string in + # comparisons below + if (!defined $variable) { + $variable = ''; + } my $attributes = interpolate_fancy::_attributes($attr); defined $attributes->{eq} and return $variable eq $attributes->{eq}; -- 2.30.2