Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Andy Wardley
Todd Rinaldo wrote: > We have a situation where we needed to render a template where the > Template object was created with {TOLERANT => 0, EVAL_PERL => 0}. Hi Todd, Those are the default values for both those options, and they don't have any bearing on this issue anyway. So you don't need to wo

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Sean McAfee
On Thu, Nov 13, 2008 at 3:09 PM, Todd Rinaldo <[EMAIL PROTECTED]> wrote: > On Thu, Nov 13, 2008 at 2:05 PM, Sean McAfee <[EMAIL PROTECTED]> wrote: > > On Thu, Nov 13, 2008 at 10:58 AM, Todd Rinaldo <[EMAIL PROTECTED]> wrote: > >> > >> My question: Is there any easy way to make a recursive block th

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Todd Rinaldo
On Thu, Nov 13, 2008 at 2:05 PM, Sean McAfee <[EMAIL PROTECTED]> wrote: > On Thu, Nov 13, 2008 at 10:58 AM, Todd Rinaldo <[EMAIL PROTECTED]> wrote: >> >> My question: Is there any easy way to make a recursive block that can >> test if an unpredictably deep hash is defined? > > Perhaps, but it would

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Kelly Thompson
I think I remember something from the Perl book. for my $key (keys %hash){ while(ref $_ eq HASH){ do stuff... } } On Thu, Nov 13, 2008 at 3:42 PM, Josh Rosenbaum <[EMAIL PROTECTED]> wrote: > Todd Rinaldo wrote: > > What we discovered we need to do is this > > defined fee && fee.defined('fi') &

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Todd Rinaldo
On Thu, Nov 13, 2008 at 2:42 PM, Josh Rosenbaum <[EMAIL PROTECTED]> wrote: > Todd Rinaldo wrote: >> >> 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

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Josh Rosenbaum
Todd Rinaldo wrote: > 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

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Sean McAfee
On Thu, Nov 13, 2008 at 10:58 AM, Todd Rinaldo <[EMAIL PROTECTED]> wrote: > My question: Is there any easy way to make a recursive block that can > test if an unpredictably deep hash is defined? > Perhaps, but it would be easier to write a routine in Perl: sub nested { my ($hash, @keys) = @_;

[Templates] Tests for defined nested hash

2008-11-13 Thread Todd Rinaldo
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: