r51456 - in /branches/upstream/libtemplate-tiny-perl/current: Changes MANIFEST META.yml Makefile.PL README lib/Template/Tiny.pm t/01_compile.t t/02_trivial.t t/03_samples.t t/04_compat.t t/samples/09_trim.tt t/samples/09_trim.txt t/samples/09_trim.var
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Jan 24 17:34:16 UTC 2010
Author: jawnsy-guest
Date: Sun Jan 24 17:34:10 2010
New Revision: 51456
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51456
Log:
[svn-upgrade] Integrating new upstream version, libtemplate-tiny-perl (0.10)
Added:
branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt
branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt
branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var
Modified:
branches/upstream/libtemplate-tiny-perl/current/Changes
branches/upstream/libtemplate-tiny-perl/current/MANIFEST
branches/upstream/libtemplate-tiny-perl/current/META.yml
branches/upstream/libtemplate-tiny-perl/current/Makefile.PL
branches/upstream/libtemplate-tiny-perl/current/README
branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm
branches/upstream/libtemplate-tiny-perl/current/t/01_compile.t
branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t
branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t
branches/upstream/libtemplate-tiny-perl/current/t/04_compat.t
Modified: branches/upstream/libtemplate-tiny-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/Changes?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/Changes (original)
+++ branches/upstream/libtemplate-tiny-perl/current/Changes Sun Jan 24 17:34:10 2010
@@ -1,4 +1,10 @@
Changes for Perl extension Template-Tiny
+
+0.10 Sun 24 Jan 2010
+ - The use of the constructor is now compulsory, as per Template.pm
+ - Adding support for constructor params
+ - Adding support for constructor TRIM param
+ - The process method now works in both static and instance modes
0.09 Wed 16 Dec 2009
- Adding support for "private" _foo keys
Modified: branches/upstream/libtemplate-tiny-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/MANIFEST?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/MANIFEST (original)
+++ branches/upstream/libtemplate-tiny-perl/current/MANIFEST Sun Jan 24 17:34:10 2010
@@ -35,4 +35,7 @@
t/samples/08_foreach.tt
t/samples/08_foreach.txt
t/samples/08_foreach.var
+t/samples/09_trim.tt
+t/samples/09_trim.txt
+t/samples/09_trim.var
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libtemplate-tiny-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/META.yml?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/META.yml (original)
+++ branches/upstream/libtemplate-tiny-perl/current/META.yml Sun Jan 24 17:34:10 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Template-Tiny
-version: 0.09
+version: 0.10
abstract: Template Toolkit reimplemented in as little code as possible
author:
- Adam Kennedy <adamk at cpan.org>
Modified: branches/upstream/libtemplate-tiny-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/Makefile.PL?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/Makefile.PL (original)
+++ branches/upstream/libtemplate-tiny-perl/current/Makefile.PL Sun Jan 24 17:34:10 2010
@@ -2,7 +2,7 @@
use vars qw{$VERSION};
BEGIN {
require 5.003_96;
- $VERSION = '0.09';
+ $VERSION = '0.10';
}
use ExtUtils::MakeMaker;
@@ -32,9 +32,7 @@
my $eumm_version = $ExtUtils::MakeMaker::VERSION;
$eumm_version = eval $eumm_version;
die "License not specified" if not exists $params{LICENSE};
- if ($params{BUILD_REQUIRES}) { #and $eumm_version < 6.5503
- #Should be modified in future when EUMM will
- #correctly support BUILD_REQUIRES.
+ if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
#EUMM 6.5502 has problems with BUILD_REQUIRES
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
delete $params{BUILD_REQUIRES};
Modified: branches/upstream/libtemplate-tiny-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/README?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/README (original)
+++ branches/upstream/libtemplate-tiny-perl/current/README Sun Jan 24 17:34:10 2010
@@ -3,7 +3,9 @@
possible
SYNOPSIS
- my $template = Template::Tiny->new;
+ my $template = Template::Tiny->new(
+ TRIM => 1,
+ );
$template->process( <<'END_TEMPLATE', { foo => 'World' } );
Hello [% foo %]!
@@ -16,7 +18,7 @@
YOU HAVE BEEN WARNED!
Template::Tiny is a reimplementation of a partial subset of the Template
- Toolkit, in as few lines of code as possible.
+ Toolkit in as few lines of code as possible.
It is intended for use in light-usage, low-memory, or low-cpu templating
situations, where you may need to upgrade to the full feature set in the
@@ -58,10 +60,18 @@
METHODS
new
- my $template = Template::Tiny->new;
+ my $template = Template::Tiny->new(
+ TRIM => 1,
+ );
The "new" constructor is provided for compatibility with Template
- Toolkit, but is not strictly necesary.
+ Toolkit.
+
+ The only parameter it currently supports is "TRIM" (which removes
+ leading and trailing whitespace from processed templates).
+
+ Additional parameters can be provided without error, but will be
+ ignored.
process
$template->process( \$input, $vars );
@@ -86,7 +96,7 @@
Config::Simple
COPYRIGHT
- Copyright 2009 Adam Kennedy.
+ Copyright 2009 - 2010 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm (original)
+++ branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm Sun Jan 24 17:34:10 2010
@@ -5,7 +5,7 @@
use 5.00503;
use strict;
-$Template::Tiny::VERSION = '0.09';
+$Template::Tiny::VERSION = '0.10';
# Evaluatable expression
my $EXPR = qr/ [a-z_][\w.]* /xs;
@@ -69,7 +69,7 @@
/xs;
sub new {
- bless { }, $_[0];
+ bless { @_[1..$#_] }, $_[0];
}
sub process {
@@ -122,6 +122,9 @@
}
/gsex;
+ # Trim the document
+ $text =~ s/^\s*(.+?)\s*\z/$1/s if $self->{TRIM};
+
return $text;
}
@@ -177,7 +180,9 @@
=head1 SYNOPSIS
- my $template = Template::Tiny->new;
+ my $template = Template::Tiny->new(
+ TRIM => 1,
+ );
$template->process( <<'END_TEMPLATE', { foo => 'World' } );
Hello [% foo %]!
@@ -190,7 +195,7 @@
B<YOU HAVE BEEN WARNED!>
B<Template::Tiny> is a reimplementation of a partial subset of the
-L<Template> Toolkit, in as few lines of code as possible.
+L<Template> Toolkit in as few lines of code as possible.
It is intended for use in light-usage, low-memory, or low-cpu templating
situations, where you may need to upgrade to the full feature set in the
@@ -235,10 +240,16 @@
=head2 new
- my $template = Template::Tiny->new;
-
-The C<new> constructor is provided for compatibility with Template Toolkit,
-but is not strictly necesary.
+ my $template = Template::Tiny->new(
+ TRIM => 1,
+ );
+
+The C<new> constructor is provided for compatibility with Template Toolkit.
+
+The only parameter it currently supports is C<TRIM> (which removes leading
+and trailing whitespace from processed templates).
+
+Additional parameters can be provided without error, but will be ignored.
=head2 process
@@ -267,7 +278,7 @@
=head1 COPYRIGHT
-Copyright 2009 Adam Kennedy.
+Copyright 2009 - 2010 Adam Kennedy.
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
Modified: branches/upstream/libtemplate-tiny-perl/current/t/01_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/01_compile.t?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/01_compile.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/01_compile.t Sun Jan 24 17:34:10 2010
@@ -1,6 +1,10 @@
#!/usr/bin/perl
use strict;
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
use Test::More tests => 1;
use_ok( 'Template::Tiny' );
Modified: branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t Sun Jan 24 17:34:10 2010
@@ -1,6 +1,10 @@
#!/usr/bin/perl
use strict;
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
use Test::More tests => 1;
use Template::Tiny ();
@@ -9,7 +13,7 @@
my $input = shift;
my $expected = shift;
my $message = shift || 'Template processed ok';
- my $output = Template::Tiny->process( \$input, $stash );
+ my $output = Template::Tiny->new->process( \$input, $stash );
is( $output, $expected, $message );
}
Modified: branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t Sun Jan 24 17:34:10 2010
@@ -1,7 +1,11 @@
#!/usr/bin/perl
use strict;
-use vars qw{$VAR1};
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
+use vars qw{$VAR1 $VAR2};
use Test::More;
use File::Spec::Functions ':ALL';
use Template::Tiny ();
@@ -15,7 +19,7 @@
my @TEMPLATES = sort grep { /\.tt$/ } readdir(DIR);
closedir( DIR ) or die("closedir($SAMPLES): $!");
-plan( tests => scalar(@TEMPLATES) * 5 );
+plan( tests => scalar(@TEMPLATES) * 6 );
# Test the test classes
#SCOPE: {
@@ -49,8 +53,16 @@
eval $var; die $@ if $@;
is( ref($VAR1), 'HASH', "$template: Loaded stash from file" );
+ # Create the processor normally
+ my %params = (
+ INCLUDE_PATH => $SAMPLES,
+ );
+ %params = ( %params, %$VAR2 ) if $VAR2;
+ my $template = Template::Tiny->new(%params);
+ isa_ok( $template, 'Template::Tiny' );
+
# Execute the template
- my $out = Template::Tiny->process( \$tt, $VAR1 );
+ my $out = $template->process( \$tt, $VAR1 );
is( $out, $txt, "$template: Output matches expected" );
}
Modified: branches/upstream/libtemplate-tiny-perl/current/t/04_compat.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/04_compat.t?rev=51456&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/04_compat.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/04_compat.t Sun Jan 24 17:34:10 2010
@@ -1,7 +1,11 @@
#!/usr/bin/perl
use strict;
-use vars qw{$VAR1};
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
+use vars qw{$VAR1 $VAR2};
use Test::More;
use File::Spec::Functions ':ALL';
eval "require Template";
@@ -18,12 +22,7 @@
my @TEMPLATES = sort grep { /\.tt$/ } readdir(DIR);
closedir( DIR ) or die("closedir($SAMPLES): $!");
-plan( tests => scalar(@TEMPLATES) * 6 + 1 );
-
-my $template = Template->new(
- INCLUDE_PATH => $SAMPLES,
-);
-isa_ok( $template, 'Template' );
+plan( tests => scalar(@TEMPLATES) * 7);
@@ -48,6 +47,14 @@
my $txt = slurp($txt_file);
eval $var; die $@ if $@;
is( ref($VAR1), 'HASH', "$name: Loaded stash from file" );
+
+ # Create the template processor
+ my %params = (
+ INCLUDE_PATH => $SAMPLES,
+ );
+ %params = ( %params, %$VAR2 ) if $VAR2;
+ my $template = Template->new(%params);
+ isa_ok( $template, 'Template' );
# Execute the template
my $out = '';
Added: branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt?rev=51456&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt (added)
+++ branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt Sun Jan 24 17:34:10 2010
@@ -1,0 +1,2 @@
+
+Hello World!
Added: branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt?rev=51456&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt (added)
+++ branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt Sun Jan 24 17:34:10 2010
@@ -1,0 +1,1 @@
+Hello World!
Added: branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var?rev=51456&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var (added)
+++ branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var Sun Jan 24 17:34:10 2010
@@ -1,0 +1,2 @@
+$VAR1 = {};
+$VAR2 = { TRIM => 1 };
More information about the Pkg-perl-cvs-commits
mailing list