Apache2-JemplateFilter
view release on metacpan or search on metacpan
lib/Apache2/JemplateFilter.pm view on Meta::CPAN
$jemplate->_preamble
. $jemplate->compile_template_content( $buf, $tmpl_filename );
};
if ($@) {
my $msg = sprintf "%s compile error while processing %s. %s",
__PACKAGE__,
$f->r->uri,
$@;
$msg =~ s/\'/\\'/g; # '
$msg =~ s/[\x0A\x0D]/ /g;
$js = "throw('$msg')";
$f->r->log_error($msg);
}
$f->r->set_content_length( length $js );
$f->r->content_type('application/x-javascript');
$f->print($js);
$cache->{$filename} = { js => $js, mtime => $finfo->mtime };
}
return Apache2::Const::OK;
}
t/02-error.t view on Meta::CPAN
use strict;
use warnings FATAL => 'all';
use Apache::Test qw(plan ok have_lwp);
use Apache::TestRequest qw(GET);
plan tests => 2, have_lwp;
my $response = GET '/jmpl/error.tt';
ok( $response->content =~ /^throw\(/ );
ok( $response->content_type eq 'application/x-javascript' );
( run in 1.124 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )