RE: [Templates] is it a feature or a bug?

[prev] [thread] [next] [Date index for 2005/03/17]

From: Jason Gottshall
Subject: RE: [Templates] is it a feature or a bug?
Date: 18:25 on 17 Mar 2005
In short:

Successful use of "side-effect" conditional notation in an assignment
statement mandates the inclusion of the (typically optional) SET
directive:=20

	[% SET foo =3D [] IF 1 %]

Ok, so maybe that wasn't so short, but you get the idea...

-Jason

Josh Rosenbaum wrote:
>=20
> See:
> http://www.template-toolkit.org/docs/plain/Manual/Syntax.html
>=20
> Section: Capturing Block Output
>=20
> Quote:
> --------------------------------
> Note one important caveat of using this syntax in conjunction with=20
> side-effect notation. The following directive does not behave=20
> as might=20
> be expected:
>=20
>      [% var =3D 'value' IF some_condition %]
> --------------------------------
>=20
> Check the page for the rest.
>=20
> -- Josh
>=20
> qbxk wrote:
> > so i was getting confused but i think i understand now,=20
> what i don't=20
> > understand is whether this is expected behavior:
> > ala:
> >=20
> > [% foo =3D [] IF 1 %]
> > [% USE Dumper; Dumper.dump(foo) %]
> > prints:  $VAR1 =3D 'ARRAY(0x206cd7f4)'  (prints some such, of=20
> course it=20
> > varies)
> >=20
> > when
> > [% baz =3D [] %]  (or perhaps: [% IF 1 %][% baz =3D [] %][% END %] )
> > [% USE Dumper; Dumper.dump(baz) %]
> > prints:  $VAR1 =3D []
> >=20
> > thanks.
> >=20
> > peace,
> > -b
> > qbxk@xxxxxx.xxx
> >=20
> > (shameless plug: template-toolkit in heavy use and advertised here:=20
> > http://www.uvm.edu/wruv/?action=3Dinfo&pg=3Dthanks )
> >=20
> > _______________________________________________
> > templates mailing list
> > templates@xxxxxxxxxxxxxxxx.xxx
> > http://lists.template-toolkit.org/mailman/listinfo/templates
> >=20
> > !DSPAM:42391d9050571740919489!
> >=20
>=20
>=20
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates
>=20

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] is it a feature or a bug?
qbxk 06:04 on 17 Mar 2005

Re: [Templates] is it a feature or a bug?
Josh Rosenbaum 06:07 on 17 Mar 2005

RE: [Templates] is it a feature or a bug?
Jason Gottshall 18:25 on 17 Mar 2005

Generated at 11:31 on 21 Mar 2005 by mariachi v0.52