Skip to content

Instantly share code, notes, and snippets.

@nihen
Created October 8, 2010 09:24
Show Gist options
  • Save nihen/616549 to your computer and use it in GitHub Desktop.
Save nihen/616549 to your computer and use it in GitHub Desktop.
Template----
1-122
2-
3-123
Xslate/TTerse----
Text::Xslate: Can't locate object method "moge" via package "Hash::MultiValue" at test.pl line 25.
(/home/chiba/tmp/tmpl/test.tt:1:&main[3]) at test.pl line 25
eval {...} called at test.pl line 25
----------------------------------------------------------------------------
1-[% req.moge %]
2-[% req.get %]
----------------------------------------------------------------------------
... exception cought on accessor ... (/home/chiba/tmp/tmpl/test.tt:1:&main[3]) at test.pl line 25
----------------------------------------------------------------------------
1-[% req.moge %]
2-[% req.get %]
----------------------------------------------------------------------------
1-
2-
3-123
Xslate/Kolon----
Text::Xslate: Can't locate object method "moge" via package "Hash::MultiValue" at test.pl line 27.
("<string>":1:&main[3]) at test.pl line 27
eval {...} called at test.pl line 27
... exception cought on accessor ... ("<string>":1:&main[3]) at test.pl line 27
1-
2-
3-123
use 5.12.1;
use warnings;
use utf8;
use Text::Xslate;
use Template;
use Hash::MultiValue;
my $var = { req => Hash::MultiValue->new(get => '123', 'moge' => '122') };
my $tt = Template->new({
INCLUDE_PATH => 'tmpl',
});
my $tx_tt = Text::Xslate->new(
path => 'tmpl',
syntax => 'TTerse',
);
my $tx_kolon = Text::Xslate->new(
path => 'tmpl',
);
say 'Template----';
$tt->process('test.tt', $var);
say 'Xslate/TTerse----';
say $tx_tt->render('test.tt', $var);
say 'Xslate/Kolon----';
say $tx_kolon->render('test.tx', $var);
1-[% req.moge %]
2-[% req.get %]
3-[% req.get('get') %]
1-<: $req.moge :>
2-<: $req.get :>
3-<: $req.get('get') :>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment