Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: Template::Toolkit: defined on aggregate item vs. defined on variable (STRICT)

by beech (Parson)
on Aug 06, 2016 at 00:57 UTC ( [id://1169235]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1169235]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-23 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found