Created
November 18, 2010 06:26
-
-
Save xaicron/704691 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Hoge; | |
use strict; | |
use warnings; | |
sub new { | |
bless {}, shift; | |
} | |
sub all { | |
return qw(tokuhirom nekokak chiba gfx); | |
} | |
package main; | |
use Text::Xslate; | |
my $tx = Text::Xslate->new( | |
syntax => 'TTerse', | |
); | |
my $hoge = Hoge->new; | |
print $tx->render_string(<< 'TEMPLATE', { hoge => $hoge }); | |
[%- FOR foo IN [ hoge.all() ] %] | |
[% foo %] | |
[%- END %] | |
TEMPLATE | |
__END__ | |
gfx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Hoge; | |
use strict; | |
use warnings; | |
sub new { | |
bless {}, shift; | |
} | |
sub all { | |
return [ qw(tokuhirom nekokak chiba gfx) ]; | |
} | |
package main; | |
use Text::Xslate; | |
my $tx = Text::Xslate->new( | |
syntax => 'TTerse', | |
); | |
my $hoge = Hoge->new; | |
print $tx->render_string(<< 'TEMPLATE', { hoge => $hoge }); | |
[%- FOR foo IN hoge.all() %] | |
[% foo %] | |
[%- END %] | |
TEMPLATE | |
__END__ | |
tokuhirom | |
nekokak | |
chiba | |
gfx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Hoge; | |
use strict; | |
use warnings; | |
sub new { | |
bless {}, shift; | |
} | |
sub all { | |
my @ret = qw(tokuhirom nekokak chiba gfx); | |
return @ret; | |
} | |
package main; | |
use Text::Xslate; | |
my $tx = Text::Xslate->new( | |
syntax => 'TTerse', | |
); | |
my $hoge = Hoge->new; | |
print $tx->render_string(<< 'TEMPLATE', { hoge => $hoge }); | |
[%- FOR foo IN [ hoge.all() ] %] | |
[% foo %] | |
[%- END %] | |
TEMPLATE | |
__END__ | |
4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment