template::param handles empty array/hash refs better

This commit is contained in:
Christopher Hall 2011-02-04 15:10:59 +13:00
parent 10807ef6c8
commit bd151a4fd8
1 changed files with 2 additions and 0 deletions

View File

@ -109,6 +109,8 @@ sub param{
my $key = shift;
my $val = shift;
utf8::encode($val) if utf8::is_utf8($val);
if( ref($val) eq 'ARRAY' && ! scalar @$val ){ $val = undef; }
elsif( ref($val) eq 'HASH' && ! scalar %$val ){ $val = undef; }
$self->{VARS}->{$key} = $val;
}
}