[Templates] LIST_OPT change in 2.15?

Bill Moseley moseley@hank.org
Thu, 3 Aug 2006 14:45:29 -0700


After updating my LIST_OPTs seem to no longer work.  Am I create the
vmethod incorrectly?

Here's the test script:

    $ cat date.pl
    #!/usr/bin/perl
    use strict;
    use warnings;
    use Template;
    use DateTime;

    print Template->VERSION,"\n";

    my $t = Template->new;

    $Template::Stash::LIST_OPS->{ mydate } = sub {
        return shift->[0]->strftime( '%m + %d + %y' );
    };


    my $vars = { now => DateTime->now  };

    $t->process( \*DATA, $vars);

    __END__
    This is the template
    DateTime = [% now %]
    Formatted mdy = [% now.mdy %]
    mydate = [% now.mydate %]


And running, note that now.mydate is blank:

    $ perl date.pl
    Name "Template::Stash::LIST_OPS" used only once: possible typo at date.pl line 11.
    2.15
    This is the template
    DateTime = 2006-08-03T21:42:26
    Formatted mdy = 08-03-2006
    mydate = 

But try on a different machine:

    $ scp date.pl ifp:
    date.pl                                                           100%  406     0.4KB/s   00:00    

    $ ssh ifp 'perl date.pl'
    Name "Template::Stash::LIST_OPS" used only once: possible typo at date.pl line 11.
    2.14
    This is the template
    DateTime = 2006-08-03T21:43:24
    Formatted mdy = 08-03-2006
    mydate = 08 + 03 + 06



-- 
Bill Moseley
moseley@hank.org