【修正済み】Text::MicroTemplate::Extended の行数表示がおかしいので調べていたら仕様っていわれた件
以下のようなスクリプトを実行すると、
use strict;
use warnings;
use utf8;
use 5.010000;
use Text::MicroTemplate::Extended;
my $tmt = Text::MicroTemplate::Extended->new(
include_path => [ './' ],
extension => '',
use_cache => 1,
open_layer => ':utf8',
tag_start => '[?',
tag_end => '?]',
line_start => '?',
macro => { },
template_args => { },
);
open my $fh, '>', 'hoge.html';
print $fh qq{? die "oops";\n} for 1..10;
close $fh;
my $app = sub {
my $engine = $tmt;
local $engine->{template_args} = {
type => 'ster',
typo => 'ster',
typo => 'stor',
type => 'stor',
};
$engine->render_file( 'hoge.html', {} );
};
for (1..2) {
eval { $app->() };
print $@ if $@;
}
以下のようになって、アレレーってなりますが
oops at line 1 in template passed from /usr/local/perl/5.16.0/lib/site_perl/5.16.0/Text/MicroTemplate/File.pm at line 85.
----------------------------------------------------------------------------
1: ? die "oops";
2: ? die "oops";
3: ? die "oops";
----------------------------------------------------------------------------
Use of uninitialized value in addition (+) at /usr/local/perl/5.16.0/lib/site_perl/5.16.0/Text/MicroTemplate/Extended.pm line 124.
Use of uninitialized value $from in concatenation (.) or string at /usr/local/perl/5.16.0/lib/site_perl/5.16.0/Text/MicroTemplate.pm line 307.
oops at line 3 in template passed from .
----------------------------------------------------------------------------
1: ? die "oops";
2: ? die "oops";
3: ? die "oops";
4: ? die "oops";
5: ? die "oops";
----------------------------------------------------------------------------
とのことです!
【追記】
ちょさんがなおしてくれました。
Published: 2012-08-16(Thu) 08:22