On my current project, we've noticed, at quite an annoying time, that
the fat comma (=>) is treated differently than we initially expected
for calling methods.

 foo.bar(foo => 'bar') gets magically mutated into { foo => 'bar' }
 foo.bar('foo', 'bar') passes two elements, ( 'foo', 'bar' )

Which surprised me, as I was expecting the more perlish (foo => 'bar')
becomes ('foo', 'bar'), and so were the methods we'd written.

Is this intended, or just an implementation feature of the => operator
in TT?  Also, is there an easy way to switch the behaviour to what I
was expecting.

Attached is a short script which demonstrates this more fully

Oh, erm, TT2.06, xs stash, perl5.6.1, should any of those be relevant.

-- 
Richard Clamp <[EMAIL PROTECTED]>
#!perl -w
use strict;
use Data::Dumper;
use Template;

sub T::bar { shift; Dumper \@_ }
my $template = q{[% foo.bar(foo => 'bar') %] [% foo.bar('foo', 'bar') %]};

Template->new->process(\$template, { foo => bless {}, 'T' } );

Reply via email to