* Harry Jackson <h.jackson at acu.ac.uk> [2004/08/06 15:35]:
> I need some way to be able to do the following.

Pipe CONTENT_NAME through the eval filter:

  [% CONTENT_NAME | eval %]

perldoc Template::Filters sez:

  eval / evaltt

  The eval filter evaluates the block as template text, processing any
  directives embedded within it.  This allows template variables to
  contain template fragments, or for some method to be provided for
  returning tem- plate fragments from an external source such as a
  database, which can then be processed in the template as required.

      my $vars  = {
          fragment => "The cat sat on the [% place %]",
      };
      $template->process($file, $vars);

  The following example:

      [% fragment | eval %]

  is therefore equivalent to

      The cat sat on the [% place %]

  The evaltt filter is provided as an alias for eval.

(darren)

-- 
If we can't be free at least we can be cheap.

Attachment: pgpqknjnYp7xf.pgp
Description: PGP signature

Reply via email to