Here is the standard split virtual method. It appears that @args is getting 
evaluated in scalar context, because I cannot use the limit argument:

   'split'   => sub {
       my ($str, $split, @args) = @_;
       $str = '' unless defined $str;
       return [ defined $split ? split($split, $str, @args)
                               : split(' ', $str, @args) ];
   },


Here is my fixed version that DOES work. I just changed the @args to be 
$args[0]:

$Template::Stash::SCALAR_OPS->{ split2 } =
 sub {
   my ($str, $split, @args) = @_;
   $str = '' unless defined $str;
   return [ defined $split ? split($split, $str, $args[0])
            : split(' ', $str, $args[0]) ];
 };

Perl v5.8.7
Template Toolkit version 2.14

-- Josh

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to