r51462 - in /trunk/libtemplate-tiny-perl: ./ debian/ lib/Template/ t/ t/samples/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Jan 24 17:35:41 UTC 2010


Author: jawnsy-guest
Date: Sun Jan 24 17:35:34 2010
New Revision: 51462

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51462
Log:
* New upstream release
* Update years of copyright

Added:
    trunk/libtemplate-tiny-perl/t/samples/09_trim.tt
      - copied unchanged from r51457, branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.tt
    trunk/libtemplate-tiny-perl/t/samples/09_trim.txt
      - copied unchanged from r51457, branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.txt
    trunk/libtemplate-tiny-perl/t/samples/09_trim.var
      - copied unchanged from r51457, branches/upstream/libtemplate-tiny-perl/current/t/samples/09_trim.var
Modified:
    trunk/libtemplate-tiny-perl/Changes
    trunk/libtemplate-tiny-perl/MANIFEST
    trunk/libtemplate-tiny-perl/META.yml
    trunk/libtemplate-tiny-perl/Makefile.PL
    trunk/libtemplate-tiny-perl/README
    trunk/libtemplate-tiny-perl/debian/changelog
    trunk/libtemplate-tiny-perl/debian/copyright
    trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm
    trunk/libtemplate-tiny-perl/t/01_compile.t
    trunk/libtemplate-tiny-perl/t/02_trivial.t
    trunk/libtemplate-tiny-perl/t/03_samples.t
    trunk/libtemplate-tiny-perl/t/04_compat.t

Modified: trunk/libtemplate-tiny-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/Changes?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/Changes (original)
+++ trunk/libtemplate-tiny-perl/Changes Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/MANIFEST?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/MANIFEST (original)
+++ trunk/libtemplate-tiny-perl/MANIFEST Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/META.yml?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/META.yml (original)
+++ trunk/libtemplate-tiny-perl/META.yml Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/Makefile.PL?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/Makefile.PL (original)
+++ trunk/libtemplate-tiny-perl/Makefile.PL Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/README?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/README (original)
+++ trunk/libtemplate-tiny-perl/README Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/debian/changelog?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/debian/changelog (original)
+++ trunk/libtemplate-tiny-perl/debian/changelog Sun Jan 24 17:35:34 2010
@@ -1,3 +1,10 @@
+libtemplate-tiny-perl (0.10-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Update years of copyright
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sun, 24 Jan 2010 12:43:55 -0500
+
 libtemplate-tiny-perl (0.09-1) unstable; urgency=low
 
   * Initial Release (Closes: #563133)

Modified: trunk/libtemplate-tiny-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/debian/copyright?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/debian/copyright (original)
+++ trunk/libtemplate-tiny-perl/debian/copyright Sun Jan 24 17:35:34 2010
@@ -4,11 +4,11 @@
 Name: Template-Tiny
 
 Files: *
-Copyright: 2009, Adam Kennedy <adamk at cpan.org>
+Copyright: 2009-2010, Adam Kennedy <adamk at cpan.org>
 License: Artistic or GPL-1+
 
 Files: debian/*
-Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
+Copyright: 2009-2010, Jonathan Yu <jawnsy at cpan.org>
 License: Artistic or GPL-1+
 
 License: Artistic

Modified: trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm (original)
+++ trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/t/01_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/t/01_compile.t?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/01_compile.t (original)
+++ trunk/libtemplate-tiny-perl/t/01_compile.t Sun Jan 24 17:35:34 2010
@@ -1,6 +1,10 @@
 #!/usr/bin/perl
 
 use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
 use Test::More tests => 1;
 
 use_ok( 'Template::Tiny' );

Modified: trunk/libtemplate-tiny-perl/t/02_trivial.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/t/02_trivial.t?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/02_trivial.t (original)
+++ trunk/libtemplate-tiny-perl/t/02_trivial.t Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/t/03_samples.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/t/03_samples.t?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/03_samples.t (original)
+++ trunk/libtemplate-tiny-perl/t/03_samples.t Sun Jan 24 17:35:34 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: trunk/libtemplate-tiny-perl/t/04_compat.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/t/04_compat.t?rev=51462&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/04_compat.t (original)
+++ trunk/libtemplate-tiny-perl/t/04_compat.t Sun Jan 24 17:35:34 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 = '';




More information about the Pkg-perl-cvs-commits mailing list