> Hum, I'm doing:
>
> some_list = object.fetch_some_list;
>
> Then I'd like to do:
>
> some_list.push( object.fetch_other_list );
I think that is some_list.import([1, 2, 3]).
Here it is in Template::Alloy.
perl -e 'use Template::Alloy; Template::Alloy->new->process(\q{[% a = [1,2,3];
a.import([8,7,6]); DUMP a %]})'
DUMP: File "input text" line 1
a = [
'1',
'2',
'3',
'8',
'7',
'6'
];
Actually - Template doesn't quite do it nicely - you have to add a CALL:
perl -e 'use Template; Template->new->process(\q{[% a = [1,2,3]; CALL
a.import([8,7,6]); USE Dumper; Dumper.dump(a) %]})'
$VAR1 = [
1,
2,
3,
8,
7,
6
];
Unfortunately the LIST import vmethod that comes with TT also returns the
appended array. I'm sure there is some historical reason for doing so - but
I think that that is buggy (using CALL isn't too much of a hardship).
Paul
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates