Skip to content

Instantly share code, notes, and snippets.

View gfx's full-sized avatar

FUJI Goro gfx

View GitHub Profile
diff --git a/lib/Test/Class.pm b/lib/Test/Class.pm
index 6591dee..3081e73 100644
--- a/lib/Test/Class.pm
+++ b/lib/Test/Class.pm
@@ -6,8 +6,7 @@ package Test::Class;
use Attribute::Handlers;
use Carp;
-use Class::ISA;
-use Devel::Symdump;
Perl/5.10.1 on i686-linux
Text::ClearSilver/0.10.5.1
HTML::Template::Pro/0.94
MobaSiF::Template/0.02
Persistent processes:
Rate H::T::Pro T::CS MobaSiF::T
H::T::Pro 10368/s -- -46% -51%
T::CS 19029/s 84% -- -11%
MobaSiF::T 21295/s 105% 12% --
#!perl -w
use strict;
use Text::Xslate::Compiler;
use Text::ClearSilver;
use Text::MicroTemplate;
use Benchmark qw(:all);
use Config; printf "Perl/%vd %s\n", $^V, $Config{archname};
$ perl -Mblib benchmark/interpolate.pl
Perl/5.10.1 i686-linux
Text::Xslate/0.001
Text::MicroTemplate/0.11
Rate s///g mt xslate
s///g 7456/s -- -0% -77%
mt 7456/s 0% -- -77%
xslate 32880/s 341% 341% --
$perl -Mblib benchmark/for.pl
Perl/5.10.1 i686-linux
Text::Xslate/0.001
Text::MicroTemplate/0.11
HTML::Template::Pro/0.94
Rate mt ht xslate
mt 11270/s -- -20% -60%
ht 14092/s 25% -- -50%
xslate 28183/s 150% 100% --
#define PERL_NO_GET_CONTEXTはデフォ
unpack.c:
可能性のあるIVSIZEは4 or 8なので、
static INLINE int template_callback_int64(unpack_user* u, int64_t d, SV** o)
{ *o = sv_2mortal(newSViv(d)); return 0; }
はまずい。#ifdef IVSIZE == 4のときはnvにするか、stringifyする。
nilのunpackは&PL_sv_undefだとまずいかも。sv_newmortal()じゃないと。
(1) braces
: cascade foo { bar => 1, baz => 2 }
: cascade foo with bar { baz => 42 }
use ()?
: cascade foo ( baz => 42 )
(2) local block
: local 42 -> $bar { cascade foo }
this is not only for cascade :)
: local foo() -> $x { $x }
use strict;
use Text::MicroTemplate qw(render_mt);
print render_mt(<<'END');
?= $_[0] # this is a comment
END
use strict;
use Text::MicroTemplate qw(render_mt);
print render_mt(<<'END');
? if(1) {
Foo!
? } # end if
END
{ lang => "Xslate" }を与えたとして、以下のテンプレートは何を出力するべきか
[% FOR item IN [1] %]
[%- SET lang = "TTerse" -%]
Hello, [% lang %] world!
[% END -%]
Hello, [% lang %] world!