r53221 - in /trunk/libtemplate-tiny-perl: Changes MANIFEST META.yml Makefile.PL README debian/changelog debian/control debian/copyright lib/Template/Tiny.pm t/02_trivial.t t/03_samples.t t/05_preparse.t t/97_meta.t t/98_pod.t t/99_pmv.t xt/

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Mon Feb 22 21:11:17 UTC 2010


Author: angelabad-guest
Date: Mon Feb 22 21:11:03 2010
New Revision: 53221

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53221
Log:
New upstream release 0.11

Added:
    trunk/libtemplate-tiny-perl/t/05_preparse.t
      - copied unchanged from r53219, branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t
    trunk/libtemplate-tiny-perl/xt/
      - copied from r53219, branches/upstream/libtemplate-tiny-perl/current/xt/
Removed:
    trunk/libtemplate-tiny-perl/t/97_meta.t
    trunk/libtemplate-tiny-perl/t/98_pod.t
    trunk/libtemplate-tiny-perl/t/99_pmv.t
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/control
    trunk/libtemplate-tiny-perl/debian/copyright
    trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm
    trunk/libtemplate-tiny-perl/t/02_trivial.t
    trunk/libtemplate-tiny-perl/t/03_samples.t

Modified: trunk/libtemplate-tiny-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/Changes?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/Changes (original)
+++ trunk/libtemplate-tiny-perl/Changes Mon Feb 22 21:11:03 2010
@@ -1,4 +1,8 @@
 Changes for Perl extension Template-Tiny
+
+0.11 Mon 22 Feb 2010
+	- Adding preparse-specific test script
+	- Add compatibility with the horrible TT process()  signature (MSTROUT)
 
 0.10 Sun 24 Jan 2010
 	- The use of the constructor is now compulsory, as per Template.pm

Modified: trunk/libtemplate-tiny-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/MANIFEST?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/MANIFEST (original)
+++ trunk/libtemplate-tiny-perl/MANIFEST Mon Feb 22 21:11:03 2010
@@ -8,9 +8,7 @@
 t/02_trivial.t
 t/03_samples.t
 t/04_compat.t
-t/97_meta.t
-t/98_pod.t
-t/99_pmv.t
+t/05_preparse.t
 t/samples/01_hello.tt
 t/samples/01_hello.txt
 t/samples/01_hello.var
@@ -38,4 +36,7 @@
 t/samples/09_trim.tt
 t/samples/09_trim.txt
 t/samples/09_trim.var
+xt/meta.t
+xt/pmv.t
+xt/pod.t
 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=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/META.yml (original)
+++ trunk/libtemplate-tiny-perl/META.yml Mon Feb 22 21:11:03 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Template-Tiny
-version:            0.10
+version:            0.11
 abstract:           Template Toolkit reimplemented in as little code as possible
 author:
     - Adam Kennedy <adamk at cpan.org>
@@ -11,8 +11,9 @@
 build_requires:
     ExtUtils::MakeMaker:  0
 requires:
-    perl:        5.00503
-    Test::More:  0.47
+    Capture::Tiny:  0.07
+    perl:           5.00503
+    Test::More:     0.47
 resources:
     repository:  http://svn.ali.as/cpan/trunk/Template-Tiny
 no_index:

Modified: trunk/libtemplate-tiny-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/Makefile.PL?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/Makefile.PL (original)
+++ trunk/libtemplate-tiny-perl/Makefile.PL Mon Feb 22 21:11:03 2010
@@ -2,7 +2,7 @@
 use vars qw{$VERSION};
 BEGIN {
 	require 5.003_96;
-	$VERSION = '0.10';
+	$VERSION = '0.11';
 }
 use ExtUtils::MakeMaker;
 
@@ -17,6 +17,7 @@
 		# Skip on Windows to avoid breaking ActivePerl PPMs
 		# 0.47 means 5.6.2 or newer, which everyone on Win32 has.
 		($^O eq 'MSWin32' ? () : ('Test::More' => '0.47')),
+		'Capture::Tiny' => '0.07',
 	},
 	NAME      => 'Template::Tiny',
 	ABSTRACT  => 'Template Toolkit reimplemented in as little code as possible',

Modified: trunk/libtemplate-tiny-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/README?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/README (original)
+++ trunk/libtemplate-tiny-perl/README Mon Feb 22 21:11:03 2010
@@ -7,7 +7,8 @@
           TRIM => 1,
       );
       
-  $template->process( <<'END_TEMPLATE', { foo => 'World' } );
+  # Print the template results to STDOUT
+      $template->process( <<'END_TEMPLATE', { foo => 'World' } );
       Hello [% foo %]!
       END_TEMPLATE
 
@@ -74,12 +75,33 @@
     ignored.
 
   process
+      # DEPRECATED: Return template results
+      my $text = $template->process( \$input, $vars );
+      
+  # Print template results to STDOUT
       $template->process( \$input, $vars );
+      
+  # Generate template results into a variable
+      my $output = '';
+      $template->process( \$input, $vars, \$output );
 
-    The "process" method is called to process a template. The firsts
-    parameter is a reference to a text string containing the template text.
-    A reference to a hash may be passed as the second parameter containing
-    definitions of template variables.
+    The "process" method is called to process a template.
+
+    The first parameter is a reference to a text string containing the
+    template text. A reference to a hash may be passed as the second
+    parameter containing definitions of template variables.
+
+    If a third parameter is provided, it must be a scalar reference to be
+    populated with the output of the template.
+
+    For a limited amount of time, the old deprecated interface will continue
+    to be supported. If "process" is called without a third parameter, and
+    in scalar or list contest, the template results will be returned to the
+    caller.
+
+    If "process" is called without a third parameter, and in void context,
+    the template results will be print()ed to the currently selected file
+    handle (probably "STDOUT") for compatibility with Template.
 
 SUPPORT
     Bugs should be reported via the CPAN bug tracker at

Modified: trunk/libtemplate-tiny-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/debian/changelog?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/debian/changelog (original)
+++ trunk/libtemplate-tiny-perl/debian/changelog Mon Feb 22 21:11:03 2010
@@ -1,3 +1,11 @@
+libtemplate-tiny-perl (0.11-1) unstable; urgency=low
+
+  * New upstream release
+  * Add myself to uploaders
+  * Standards-Version: 3.8.4 (no changes needed)
+
+ -- Angel Abad <angelabad at gmail.com>  Mon, 22 Feb 2010 22:10:19 +0100
+
 libtemplate-tiny-perl (0.10-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libtemplate-tiny-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/debian/control?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/debian/control (original)
+++ trunk/libtemplate-tiny-perl/debian/control Mon Feb 22 21:11:03 2010
@@ -2,19 +2,21 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7.0.50)
-Build-Depends-Indep: perl, libtemplate-perl, libtest-cpan-meta-perl,
- libtest-pod-perl (>= 1.26), perl (>= 5.10.1) | libpod-simple-perl (>= 3.07),
- libperl-minimumversion-perl, libtest-minimumversion-perl
+Build-Depends-Indep: libcapture-tiny-perl, libperl-minimumversion-perl,
+ libtemplate-perl, libtest-cpan-meta-perl, libtest-minimumversion-perl,
+ libtest-pod-perl (>= 1.26), perl,
+ perl (>= 5.10.1) | libpod-simple-perl (>= 3.07)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.3
+Uploaders: Jonathan Yu <jawnsy at cpan.org>,
+ Angel Abad <angelabad at gmail.com>
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/Template-Tiny/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtemplate-tiny-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libtemplate-tiny-perl/
 
 Package: libtemplate-tiny-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}
+Depends: ${misc:Depends}, ${perl:Depends}
 Description: lightweight implementation of Template Toolkit
  Template::Tiny is a reimplementation of a partial subset of the Template
  Toolkit, in as few lines of code as possible.

Modified: trunk/libtemplate-tiny-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-tiny-perl/debian/copyright?rev=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/debian/copyright (original)
+++ trunk/libtemplate-tiny-perl/debian/copyright Mon Feb 22 21:11:03 2010
@@ -1,4 +1,4 @@
-Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
 Maintainer: Adam Kennedy <adamk at cpan.org>
 Source: http://search.cpan.org/dist/Template-Tiny/
 Name: Template-Tiny
@@ -8,7 +8,8 @@
 License: Artistic or GPL-1+
 
 Files: debian/*
-Copyright: 2009-2010, Jonathan Yu <jawnsy at cpan.org>
+Copyright: 2010, Angel Abad <angelabad at gmail.com>
+ 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=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm (original)
+++ trunk/libtemplate-tiny-perl/lib/Template/Tiny.pm Mon Feb 22 21:11:03 2010
@@ -5,7 +5,7 @@
 use 5.00503;
 use strict;
 
-$Template::Tiny::VERSION = '0.10';
+$Template::Tiny::VERSION = '0.11';
 
 # Evaluatable expression
 my $EXPR = qr/ [a-z_][\w.]* /xs;
@@ -81,17 +81,36 @@
 	local $^W = 0;
 
 	# Preprocess to establish unique matching tag sets
+	$self->_preparse( \$copy );
+
+	# Process down the nested tree of conditions
+	my $result = $self->_process( $stash, $copy );
+	if ( @_ ) {
+		${$_[0]} = $result;
+	} elsif ( defined wantarray ) {
+		require Carp;
+		Carp::carp('Returning of template results is deprecated in Template::Tiny 0.11');
+		return $result;
+	} else {
+		print $result;
+	}
+}
+
+# The only reason this is a standalone is so we can
+# do more in-depth testing.
+sub _preparse {
+	my $self = shift;
+	my $copy = shift;
+
+	# Preprocess to establish unique matching tag sets
 	my $id = 0;
-	1 while $copy =~ s/
+	1 while $$copy =~ s/
 		$PREPARSE
 	/
 		my $tag = substr($1, 0, 1) . ++$id;
 		"\[\% $tag $2 \%\]$3\[\% $tag \%\]"
 		. (defined($4) ? "$4\[\% $tag \%\]" : '');
 	/sex;
-
-	# Process down the nested tree of conditions
-	$self->_process( $stash, $copy );
 }
 
 sub _process {
@@ -184,6 +203,7 @@
       TRIM => 1,
   );
   
+  # Print the template results to STDOUT
   $template->process( <<'END_TEMPLATE', { foo => 'World' } );
   Hello [% foo %]!
   END_TEMPLATE
@@ -253,12 +273,32 @@
 
 =head2 process
 
+  # DEPRECATED: Return template results
+  my $text = $template->process( \$input, $vars );
+  
+  # Print template results to STDOUT
   $template->process( \$input, $vars );
-
-The C<process> method is called to process a template. The firsts parameter
-is a reference to a text string containing the template text. A reference
-to a hash may be passed as the second parameter containing definitions of
-template variables.
+  
+  # Generate template results into a variable
+  my $output = '';
+  $template->process( \$input, $vars, \$output );
+
+The C<process> method is called to process a template.
+
+The first parameter is a reference to a text string containing the
+template text. A reference to a hash may be passed as the second
+parameter containing definitions of template variables.
+
+If a third parameter is provided, it must be a scalar reference to be
+populated with the output of the template.
+
+For a limited amount of time, the old deprecated interface will continue
+to be supported. If C<process> is called without a third parameter, and in
+scalar or list contest, the template results will be returned to the caller.
+
+If C<process> is called without a third parameter, and in void context, the
+template results will be print()ed to the currently selected file handle
+(probably C<STDOUT>) for compatibility with L<Template>.
 
 =head1 SUPPORT
 

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=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/02_trivial.t (original)
+++ trunk/libtemplate-tiny-perl/t/02_trivial.t Mon Feb 22 21:11:03 2010
@@ -5,16 +5,21 @@
 	$|  = 1;
 	$^W = 1;
 }
-use Test::More tests => 1;
+use Test::More tests => 2;
 use Template::Tiny ();
+use Capture::Tiny qw(capture);
 
 sub process {
 	my $stash    = shift;
 	my $input    = shift;
 	my $expected = shift;
 	my $message  = shift || 'Template processed ok';
-	my $output   = Template::Tiny->new->process( \$input, $stash );
+	Template::Tiny->new->process( \$input, $stash, \my $output );
 	is( $output, $expected, $message );
+	my ( $stdout, $stderr) = capture {
+		Template::Tiny->new->process( \$input, $stash );
+	};
+	is( $stdout, $expected, $message.' (to STDOUT)' );
 }
 
 

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=53221&op=diff
==============================================================================
--- trunk/libtemplate-tiny-perl/t/03_samples.t (original)
+++ trunk/libtemplate-tiny-perl/t/03_samples.t Mon Feb 22 21:11:03 2010
@@ -62,7 +62,7 @@
 	isa_ok( $template, 'Template::Tiny' );
 
 	# Execute the template
-	my $out = $template->process( \$tt, $VAR1 );
+	$template->process( \$tt, $VAR1, \my $out );
 	is( $out, $txt, "$template: Output matches expected" );
 }
 




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