in reply to Re^4: Template::Toolkit: defined on aggregate item vs. defined on variable
in thread Template::Toolkit: defined on aggregate item vs. defined on variable
:D *awesome* now I'm getting it
Autovivification? This is the code
$stash->set('g', $stash->get(['group', 0, 1, 0]));
So testing it outside of tpage , it returns empty string instead of undef
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; use Template::Stash; use Template::Stash::XS; for my $stash ( Template::Stash::XS->new, Template::Stash->new ){ $stash->set('group', [ 'one' ]); $stash->set('g', $stash->get(['group', 0, 1, 0])); dd( $stash->get('g' ) ); $stash->set('g', $stash->get(['group', 0, 1, 0, 'defined', 0])); dd( $stash->get('g' ) ); $stash->set('g', $stash->get(['g', 0, 'defined', 0])); dd( $stash->get('g' ) ); dd( $stash->set('undy', undef ) ); dd( $stash->get('undy' ) ); dd( $stash ); } __END__ $ perl template-stash-bug.pl "" "" 1 "" "" bless({ _PARENT => undef, dec => sub { ... }, g => 1, global => {}, group => ["one"], inc => sub { ... }, undy => undef, }, "Template::Stash::XS") "" "" 1 "" "" bless({ _PARENT => undef, dec => sub { ... }, g => 1, global => {}, group => ["one"], inc => sub { ... }, undy => undef, }, "Template::Stash")
None of the various https://metacpan.org/source/ABW/Template-Toolkit-2.26/t/stash.t seem to test defined
But docs show https://metacpan.org/pod/Template::Stash#undefined-ident-args which links https://metacpan.org/pod/Template::Manual::Config#STRICT
Which says its a regrettable design decision, so I guess not a bug
tpage/ttree don't have / take a -template_strict option
|
|---|