On Tue, Feb 26, 2002 at 03:39:37PM +0400, BeerBong wrote:
> I think that Larry Wall implements 'exists' function not without
> reason...

You can add the 'exists' virtual hash method like so:

  $Template::Stash::HASH_OPS->{ exists } = sub { 
      my ($hash, $item) = @_;
      return exists $hash->{ $item };
  }

Then in your template:

  [% IF myhash.exists('keyname') %]
     ...
  [% END %]

This is probably one of those methods that should be pre-defined in the 
core.

HTH
A

        


Reply via email to