On Wed, 10 Jul 2002, Douglas S. Sparling wrote:

> [about crossrefercing two data structures]

Okay, why not use Perl for this in your handler (or in a plugin)

Your data structure looks like:

  push @features, { feature_code => 'ad',.....

If you changed it to 

  %features = ( 'ad' => { feature_code => 'ad',..... },
                'be' => { feature_code => 'be',..... },

with

%features =  map { $_->{feature_code} => $_ } @features; 

Then you'd be able to look things up by the feature_code and check for 
it's existence (infact, truth would do in this situation)

> With Perl, I'd normally use the hash "exists" function.

If you really want to do it in template space, does the Template Toolkit's 
"exists" virtual method help out here?

  defined, exists

  Returns a true or false value if an item in the hash denoted by the key
  passed as an argument is defined or exists, respectively.

      [% hash.defined('somekey') ? 'yes' : 'no' %]
      [% hash.exists('somekey') ? 'yes' : 'no' %]

(This was only introduced in 2.06e, so you might have missed its - if 
you pardon the terrible pun - existance)

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}





Reply via email to