EXPR vrs NAME in HTML::Template::Expr

2007-02-22
2013-06-03
  • John Nelson
    John Nelson
    2007-02-22

    All,

    I work on a system that uses HTML::Template::Expr
    pretty liberally. Recently we upgraded a dev box to
    Centos 4.4, which upgraded our HTML::Template from 2.6
    to 2.8 and Expr from .4 to .7 . In doing so, we seem
    to have broken HTML::Template::Expr from evaluating
    simple text substitution using EXPR. I 'fixed' the
    templates by replacing EXPR with NAME for cases when
    we just do simple  replacement. Since the
    documentation indicates that the use of NAME should be
    equivalent of EXPR, I'd rather fix the configuration
    then the templates.

    Example:
    CODE:

    $functions->{simplepopupmenu} = \&simplepopupmenu;
    $params->{'foo'} = "bar";

    my $template = HTML::Template::Expr->new
            (filename => $name,
             path => \@template_path,
             die_on_bad_params => 0,
             loop_context_vars => 1,
             filter => sub { stash_filter($stash, @_) },
             functions => $functions,
             );

    $template->param($params) if $params;
      return $template->output();

    TEMPLATE:

    <TMPL_VAR EXPR="simplepopupmenu()"> <!-- Works -->
    <TMPL_VAR EXPR="foo"> <!-- Doesn't work -->
    <TMPL_VAR NAME="foo"> <!-- Works -->

    Has anyone else run into this?