> Did you look in Template::Base code? This bug is not critical
> because BASEARGS array is empty for all descendants and _init
> method is called after constructing $self;
There's a bug, you're right! But it is not because of scalar context. The
"map" is in list context, but the following hash elements are treated as map
arguments too. So these lines:
> my $hash = {
> map { $_ => shift @args } @$argnames,
> _ERROR => '',
> DEBUG => 0,
> };
- are treated as:
my $hash = {
map { $_ => shift @args }
(@$argnames, '_ERROR', '', 'DEBUG', 0)
};
- so without $argnames this just creates hash:
$VAR1 = {
'DEBUG' => undef,
'' => undef,
'0' => undef,
'_ERROR' => undef
};
This works because 'undef' values for DEBUG and _ERROR behaves just like
zero and empty string :)
The fix is to add parenthesis on of two ways: (map { ... } ..) or map( { ...
} ... )
The other way to fix it is to put 'map' to the end of the hash construction
(I usually do so):
my $hash = {
_ERROR => '',
DEBUG => 0,
map { $_ => shift @args } @$argnames
};
Andy! Would you fix it please? :)
--
Sergey Martynoff
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates