Greetings,

We have a situation where we needed to render a template where the
Template object was created with {TOLERANT => 0, EVAL_PERL => 0}. Our
problem comes in when we need to test if a nested hash is defined.

The test would be to see if fee.fi.fo.fum is defined

We thought we could do this:
fee.defined('fi.fo.fum')

This didn't work.

What we discovered we need to do is this
defined fee && fee.defined('fi') && fee.fi.defined('fo') &&
fee.fi.fo.defined('fum')

To make things more dificult, the length of the nest isn't always the
same. For instance, we might need to test if fee.fi.fo.fum.foo.bar is
defined.

My question: Is there any easy way to make a recursive block that can
test if an unpredictably deep hash is defined?

Thanks,
Todd

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to