@@ -1,5 +1,9 @@
Revision history for Perl extension Text::Xslate
+3.3.4 2015-03-24 23:21:57+0900
+ - Fix typos in document
+ - Introduce $Text::Xslate::DEFAULT_CACHE_DIR
+
3.3.3 2014-08-04 15:50:00+0900
- No code changes from 3.3.2, just re-packaging.
@@ -14,7 +14,7 @@ configure_requires:
ExtUtils::ParseXS: 3.18
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.10'
+generated_by: 'Module::Install version 1.14'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,11 +28,11 @@ no_index:
- t
- xt
requires:
- Data::MessagePack: '0.38'
- Mouse: '0.61'
- Scalar::Util: '1.14'
+ Data::MessagePack: 0.38
+ Mouse: 0.61
+ Scalar::Util: 1.14
XSLoader: 0.02
- parent: '0.221'
+ parent: 0.221
perl: 5.8.1
resources:
MailingList: http://groups.google.com/group/xslate
@@ -41,4 +41,4 @@ resources:
homepage: http://xslate.org/
license: http://dev.perl.org/licenses/
repository: https://github.com/xslate/p5-Text-Xslate
-version: 3.3.3
+version: 3.3.4
@@ -61,10 +61,9 @@ to read the documentation online with your favorite pager.
# RESOURCE
- web site: http://xslate.org/
- repositories: http://github.com/xslate
- mailing list: http://groups.google.com/group/xslate
- irc : irc://irc.perl.org/#xslate
+ web site: http://xslate.org/
+ repositories: http://github.com/xslate
+ issue tracking: http://github.com/xslate/issues
# LICENSE AND COPYRIGHT
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
}
# Suspend handler for "redefined" warnings
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -453,40 +453,24 @@ sub author_from {
#Stolen from M::B
my %license_urls = (
+ perl => 'http://dev.perl.org/licenses/',
+ apache => 'http://apache.org/licenses/LICENSE-2.0',
+ apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
+ artistic => 'http://opensource.org/licenses/artistic-license.php',
+ artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
+ lgpl => 'http://opensource.org/licenses/lgpl-license.php',
+ lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
+ lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
+ bsd => 'http://opensource.org/licenses/bsd-license.php',
+ gpl => 'http://opensource.org/licenses/gpl-license.php',
+ gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
+ gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
+ mit => 'http://opensource.org/licenses/mit-license.php',
+ mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
open_source => undef,
unrestricted => undef,
restrictive => undef,
unknown => undef,
-
-## from Software-License - should we be using S-L instead ?
-# duplicates commeted out, see hack above ^^
-# open_source => 'http://www.gnu.org/licenses/agpl-3.0.txt',
-# apache => 'http://www.apache.org/licenses/LICENSE-1.1',
- apache => 'http://www.apache.org/licenses/LICENSE-2.0.txt',
- artistic => 'http://www.perlfoundation.org/artistic_license_1_0',
- artistic_2 => 'http://www.perlfoundation.org/artistic_license_2_0',
- bsd => 'http://opensource.org/licenses/BSD-3-Clause',
-# unrestricted => 'http://creativecommons.org/publicdomain/zero/1.0/',
-# open_source => 'http://www.freebsd.org/copyright/freebsd-license.html',
-# open_source => 'http://www.gnu.org/licenses/fdl-1.2.txt',
-# open_source => 'http://www.gnu.org/licenses/fdl-1.3.txt',
-# gpl => 'http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt',
-# gpl => 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt',
- gpl => 'http://www.gnu.org/licenses/gpl-3.0.txt',
-# lgpl => 'http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt',
- lgpl => 'http://www.gnu.org/licenses/lgpl-3.0.txt',
- mit => 'http://www.opensource.org/licenses/mit-license.php',
-# mozilla => 'http://www.mozilla.org/MPL/MPL-1.0.txt',
-# mozilla => 'http://www.mozilla.org/MPL/MPL-1.1.txt',
- mozilla => 'http://www.mozilla.org/MPL/2.0/index.txt',
-# restrictive => '',
-# open_source => 'http://www.openssl.org/source/license.html',
- perl => 'http://dev.perl.org/licenses/',
-# open_source => 'http://www.opensource.org/licenses/postgresql',
-# open_source => 'http://trolltech.com/products/qt/licenses/licensing/qpl',
-# unrestricted => 'http://h71000.www7.hp.com/doc/83final/BA554_90007/apcs02.html',
-# open_source => 'http://www.openoffice.org/licenses/sissl_license.html',
-# open_source => 'http://www.zlib.net/zlib_license.html',
);
sub license {
@@ -527,43 +511,31 @@ sub __extract_license {
my @phrases = (
'(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1,
'(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
-
- # the following are relied on by the test system even if they are wrong :(
+ 'Artistic and GPL' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
+ 'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
+ 'GNU Free Documentation license' => 'unrestricted', 1,
+ 'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
'Artistic license 2\.0' => 'artistic_2', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'Apache (?:Software )?license' => 'apache', 1,
+ 'GPL' => 'gpl', 1,
'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
'MIT' => 'mit', 1,
-
-## from Software-License
- 'The GNU Affero General Public License, Version 3, November 2007' => 'open_source', 1,
- 'The Apache Software License, Version 1.1' => 'apache', 1,
- 'The Apache License, Version 2.0, January 2004' => 'apache', 1,
- 'The Artistic License 1.0' => 'artistic', 1,
- 'The Artistic License 2.0 (GPL Compatible)' => 'artistic_2', 1,
- 'The (three-clause) BSD License' => 'bsd', 1,
- 'CC0 License' => 'unrestricted', 1,
- 'The (two-clause) FreeBSD License' => 'open_source', 1,
- 'GNU Free Documentation License v1.2' => 'open_source', 1,
- 'GNU Free Documentation License v1.3' => 'open_source', 1,
- 'The GNU General Public License, Version 1, February 1989' => 'gpl', 1,
- 'The GNU General Public License, Version 2, June 1991' => 'gpl', 1,
- 'The GNU General Public License, Version 3, June 2007' => 'gpl', 1,
- 'The GNU Lesser General Public License, Version 2.1, February 1999' => 'lgpl', 1,
- 'The GNU Lesser General Public License, Version 3, June 2007' => 'lgpl', 1,
- 'The MIT (X11) License' => 'mit', 1,
- 'The Mozilla Public License 1.0' => 'mozilla', 1,
- 'The Mozilla Public License 1.1' => 'mozilla', 1,
- 'Mozilla Public License Version 2.0' => 'mozilla', 1,
- '"No License" License' => 'restrictive', 1,
- 'OpenSSL License' => 'open_source', 1,
- 'the same terms as the perl 5 programming language system itself' => 'perl', 1,
- 'The PostgreSQL License' => 'open_source', 1,
- 'The Q Public License, Version 1.0' => 'open_source', 1,
- 'Original SSLeay License' => 'unrestricted', 1,
- 'Sun Internet Standards Source License (SISSL)' => 'open_source', 1,
- 'The zlib License' => 'open_source', 1,
+ 'Mozilla Public License' => 'mozilla', 1,
+ 'Q Public License' => 'open_source', 1,
+ 'OpenSSL License' => 'unrestricted', 1,
+ 'SSLeay License' => 'unrestricted', 1,
+ 'zlib License' => 'open_source', 1,
+ 'proprietary' => 'proprietary', 0,
);
-
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s#\s+#\\s+#gs;
if ( $license_text =~ /\b$pattern\b/i ) {
@@ -748,7 +720,3 @@ sub _write_mymeta_data {
}
1;
-
-__END__
-
-#line 766
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -27,7 +27,3 @@ sub install_script {
}
1;
-
-__END__
-
-#line 45
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.14';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -61,7 +61,3 @@ sub WriteAll {
}
1;
-
-__END__
-
-#line 79
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.10';
+ $VERSION = '1.14';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -378,6 +378,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _read {
local *FH;
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -386,6 +387,7 @@ END_NEW
sub _read {
local *FH;
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -416,6 +418,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -425,6 +428,7 @@ END_NEW
sub _write {
local *FH;
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -467,7 +471,4 @@ sub _CLASS {
1;
-
-__END__
-
-#line 485
+# Copyright 2008 - 2012 Adam Kennedy.
@@ -10,14 +10,14 @@ The Xslate cookbook is a set of recipes showing Xslate features.
=head2 How to manage HTML forms
-Managing HTML forms is an important issue on web applications.
-You'd better to use modules that manage HTML forms, rather than do something
-with templates by yourself. This section proposes two basic solutions:
+Managing HTML forms is an important issue for web applications. You're better
+off using modules that manage HTML forms rather than managing this yourself
+in your templates. This section proposes two basic solutions:
using FillInForm and HTML form builders.
-In both solutions, one should not use the C<mark_raw filter> in templates,
-which easily makes B<security holes>. Instead, application code should be
-responsible to call the C<mark_raw function> that C<Text::Xslate> can export.
+In both solutions, you should not use the C<mark_raw> filter in templates,
+which easily creates B<security holes>. Instead, application code should be
+responsible for calling the C<mark_raw> function that C<Text::Xslate> can export.
=head3 Using FillInForm
@@ -66,8 +66,8 @@ Output:
<input type="text" name="foo" value="<filled value>" />
</form>
-Because L<HTML::FillInForm::Lite> provides C<fillinform> function,
-it becomes more simple:
+Because L<HTML::FillInForm::Lite> provides a C<fillinform> function,
+it becomes even simpler:
use HTML::FillInForm::Lite qw(fillinform);
@@ -75,7 +75,7 @@ it becomes more simple:
function => { fillinform => html_builder(\&fillinform) },
);
-From 1.5018 on, C<html_builder_module> are supported for HTML builder modules like C<HTML::FillInForm>. Just import HTML builder functions with C<html_builder_module> option.
+From 1.5018 on, C<html_builder_module> is supported for HTML builder modules like C<HTML::FillInForm>. Just import HTML builder functions with C<html_builder_module> option.
my $tx = Text::Xslate->new(
html_builder_module => [ 'HTML::FillInForm::Lite' => [qw(fillinform)] ],
@@ -221,12 +221,12 @@ Because Xslate escapes only HTML meta characters, you must escape
JavaScript meta characters by yourself when you put data into
C<< <script> ... </script> >> sections.
-C<JSON> module is not suitable because it doesn't escape some meta
+The C<JSON> module is not suitable because it doesn't escape some meta
characters such as C<< "</script>" >>.
It is better to use utilities proven to be secure for JavaScript escaping
to avoid XSS.
-L<JavaScript::Value::Escape> helps you for this aim.
+L<JavaScript::Value::Escape> helps you in this regard.
my $tx = Text::Xslate->new(
module => ['JavaScript::Value::Escape' => [qw(js)]],
@@ -2,7 +2,7 @@ package Text::Xslate::PP::Opcode;
use Mouse;
extends qw(Text::Xslate::PP::State);
-our $VERSION = '3.3.3';
+our $VERSION = '3.3.4';
use Carp ();
use Scalar::Util ();
@@ -3,7 +3,7 @@ package Text::Xslate::PP;
use 5.008_001;
use strict;
-our $VERSION = '3.3.3';
+our $VERSION = '3.3.4';
BEGIN{
$ENV{XSLATE} = ($ENV{XSLATE} || '') . '[pp]';
@@ -676,7 +676,7 @@ Text::Xslate::PP - Yet another Text::Xslate runtime in pure Perl
=head1 VERSION
-This document describes Text::Xslate::PP version 3.3.3.
+This document describes Text::Xslate::PP version 3.3.4.
=head1 DESCRIPTION
@@ -78,8 +78,8 @@ Hash:
: foo({ foo => "bar" })
-Note that C<{ ... }> is always parsed as hash literals, so you need not
-to use prefix:<+> as Perl sometimes requires:
+Note that C<{ ... }> is always parsed as hash literals, so you don't need
+to use the <+> prefix as Perl sometimes requires:
: {}.kv(); # ok
: +{}.kv(); # also ok
@@ -153,7 +153,7 @@ These two statements has the same semantics, so you cannot modify C<$foo>.
=head2 Loops
-There is C<for> loops that are like Perl's C<foreach>.
+There are C<for> loops that are like Perl's C<foreach>.
: # iterate over an ARRAY reference
: for $data -> $item {
@@ -166,7 +166,7 @@ There is C<for> loops that are like Perl's C<foreach>.
<: $key :>=<: $data[$key] :>
: }
-And the C<for> statement can take C<else> block:
+And the C<for> statement can take an C<else> block:
: for $data -> $item {
[<: $item.field :>]
@@ -349,6 +349,14 @@ Template inclusion is a traditional way to extend templates.
: include "foo.tx" { var1 => value1, var2 => value2, ... };
: include "foo.tx" {$vars}; # use $vars as the params
+if a var exist in the {$vars} and __ROOT__, the one in {$vars} will win.
+
+also, be careful about the order of vars.
+
+ : include "foo.tx" { var1 => $id, id => $var, var2 => $id }
+
+var1 and var2 will be replaced by $id, var2 will be replaced by $var, because the value of id is changed
+
As C<cascade> does, C<include> allows barewords:
: include foo # the same as 'foo.tx'
@@ -481,18 +489,18 @@ because template cascading is statically processed.
=head2 Macro blocks
Macros are supported, which are called in the same way as functions and
-return a C<raw> string. Macros returns what their bodies render, so
-they cannot return references nor objects including other macros.
+return a C<raw> string. Macros return what their bodies render, so
+they cannot return references or objects, including other macros.
: macro add ->($x, $y) {
: $x + $y;
: }
: add(10, 20)
- : macro signeture -> {
+ : macro signature -> {
This is foo version <: $VERSION :>
: }
- : signeture()
+ : signature()
: macro factorial -> $x {
: $x == 0 ? 1 : $x * factorial($x-1)
@@ -4,7 +4,7 @@ use 5.008_001;
use strict;
use warnings;
-our $VERSION = '3.3.3';
+our $VERSION = '3.3.4';
use Carp ();
use File::Spec ();
@@ -33,6 +33,8 @@ my $BYTECODE_VERSION = '1.6';
# $bytecode_version + $fullpath + $compiler_and_parser_options
my $XSLATE_MAGIC = qq{xslate;$BYTECODE_VERSION;%s;%s;};
+our $DEFAULT_CACHE_DIR;
+
# load backend (XS or PP)
my $use_xs = 0;
if(!exists $INC{'Text/Xslate/PP.pm'}) {
@@ -72,7 +74,9 @@ BEGIN {
*_SAVE_SRC = sub() { $save_src };
*_ST_MTIME = sub() { 9 }; # see perldoc -f stat
+}
+unless(defined $DEFAULT_CACHE_DIR) {
my $cache_dir = '.xslate_cache';
foreach my $d($ENV{HOME}, File::Spec->tmpdir) {
if(defined($d) and -d $d and -w _) {
@@ -80,7 +84,8 @@ BEGIN {
last;
}
}
- *_DEFAULT_CACHE_DIR = sub() { $cache_dir };
+
+ $DEFAULT_CACHE_DIR = $cache_dir;
}
# the real defaults are defined in the parser
@@ -140,7 +145,7 @@ sub options { # overridable
path => ['.'],
input_layer => $self->input_layer,
cache => 1, # 0: not cached, 1: checks mtime, 2: always cached
- cache_dir => _DEFAULT_CACHE_DIR,
+ cache_dir => $DEFAULT_CACHE_DIR,
module => undef,
function => undef,
html_builder_module => undef,
@@ -663,7 +668,7 @@ Text::Xslate - Scalable template engine for Perl5
=head1 VERSION
-This document describes Text::Xslate version 3.3.3.
+This document describes Text::Xslate version 3.3.4.
=head1 SYNOPSIS
@@ -769,8 +774,8 @@ engine and even add a new syntax via extending the parser.
=head3 B<< Text::Xslate->new(%options) >>
-Creates a new Xslate template engine with options. You can reuse the instance
-for multiple call of C<render()>.
+Creates a new Xslate template engine with options. You can reuse this instance
+for multiple calls to C<render()>.
Possible options are:
@@ -810,13 +815,13 @@ template names.
Specifies a function map which contains name-coderef pairs.
A function C<f> may be called as C<f($arg)> or C<$arg | f> in templates.
-Note that those registered function have to return a B<text string>,
+Note that these registered functions have to return a B<text string>,
not a binary string unless you want to handle bytes in whole templates.
-Make sure what you want to use returns whether text string or binary
-strings.
+Make sure what you want to use returns either a text string or a binary
+string.
For example, some methods of C<Time::Piece> might return a binary string
-which is encoded in UTF-8, so you'd like to decode their values.
+which is encoded in UTF-8, so you'll want to decode their values.
# under LANG=ja_JP.UTF-8 on MacOSX (Darwin 11.2.0)
use Time::Piece;
@@ -1064,11 +1069,11 @@ This function is available in templates as the C<unmark_raw> filter.
Escapes HTML meta characters in I<$str>, and returns it as a raw string (see above).
If I<$str> is already a raw string, it returns I<$str> as is.
-By default, this function will be automatically applied to all the template
+By default, this function will automatically be applied to all template
expressions.
-This function is available in templates as the C<html> filter, but you'd better
-to use C<unmark_raw> to ensure expressions to be html-escaped.
+This function is available in templates as the C<html> filter, but you're better
+off using C<unmark_raw> to ensure that expressions are html-escaped.
=head3 C<< uri_escape($str :Str) :Str >>
@@ -1226,20 +1231,13 @@ A "too-safe" HTML escaping filter which escape all the symbolic characters
WEB: L<http://xslate.org/>
-ML: L<http://groups.google.com/group/xslate>
-
-IRC: #xslate @ irc.perl.org
-
PROJECT HOME: L<http://github.com/xslate/>
REPOSITORY: L<http://github.com/xslate/p5-Text-Xslate/>
=head1 BUGS
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT. Patches are welcome :)
-
+Please make a file on L<http://github.com/xslate/>. Patches are always welcome.
=head1 SEE ALSO
Documents: