r53218 - in /branches/upstream/libtemplate-tiny-perl/current: Changes MANIFEST META.yml Makefile.PL README 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/ xt/meta.t xt/pmv.t xt/pod.t

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Mon Feb 22 20:59:05 UTC 2010


Author: angelabad-guest
Date: Mon Feb 22 20:58:55 2010
New Revision: 53218

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53218
Log:
[svn-upgrade] Integrating new upstream version, libtemplate-tiny-perl (0.11)

Added:
    branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t
    branches/upstream/libtemplate-tiny-perl/current/xt/
    branches/upstream/libtemplate-tiny-perl/current/xt/meta.t
    branches/upstream/libtemplate-tiny-perl/current/xt/pmv.t
    branches/upstream/libtemplate-tiny-perl/current/xt/pod.t
Removed:
    branches/upstream/libtemplate-tiny-perl/current/t/97_meta.t
    branches/upstream/libtemplate-tiny-perl/current/t/98_pod.t
    branches/upstream/libtemplate-tiny-perl/current/t/99_pmv.t
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/02_trivial.t
    branches/upstream/libtemplate-tiny-perl/current/t/03_samples.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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/Changes (original)
+++ branches/upstream/libtemplate-tiny-perl/current/Changes Mon Feb 22 20:58:55 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: branches/upstream/libtemplate-tiny-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/MANIFEST?rev=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/MANIFEST (original)
+++ branches/upstream/libtemplate-tiny-perl/current/MANIFEST Mon Feb 22 20:58:55 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: 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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/META.yml (original)
+++ branches/upstream/libtemplate-tiny-perl/current/META.yml Mon Feb 22 20:58:55 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: 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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/Makefile.PL (original)
+++ branches/upstream/libtemplate-tiny-perl/current/Makefile.PL Mon Feb 22 20:58:55 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: branches/upstream/libtemplate-tiny-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/README?rev=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/README (original)
+++ branches/upstream/libtemplate-tiny-perl/current/README Mon Feb 22 20:58:55 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: 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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm (original)
+++ branches/upstream/libtemplate-tiny-perl/current/lib/Template/Tiny.pm Mon Feb 22 20:58:55 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: 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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/02_trivial.t Mon Feb 22 20:58:55 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: 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=53218&op=diff
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t (original)
+++ branches/upstream/libtemplate-tiny-perl/current/t/03_samples.t Mon Feb 22 20:58:55 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" );
 }
 

Added: branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t?rev=53218&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t (added)
+++ branches/upstream/libtemplate-tiny-perl/current/t/05_preparse.t Mon Feb 22 20:58:55 2010
@@ -1,0 +1,66 @@
+#!/usr/bin/perl
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+use Test::More tests => 3;
+use Template::Tiny ();
+
+sub preparse {
+	my $template = shift;
+	my $expected = shift;
+	my $message  = shift || 'Template preparsed ok';
+	Template::Tiny->new->_preparse( \$template );
+	is( $template, $expected, $message );
+}
+
+
+
+
+
+######################################################################
+# Main Tests
+
+preparse( <<'END_TEMPLATE', <<'END_EXPECTED', 'Simple IF' );
+foo
+[% IF foo %]
+foobar
+[% END %]
+bar
+END_TEMPLATE
+foo
+[% I1 foo %]
+foobar
+[% I1 %]
+bar
+END_EXPECTED
+
+preparse( <<'END_TEMPLATE', <<'END_EXPECTED', 'Simple UNLESS' );
+foo
+[% UNLESS foo %]
+foobar
+[% END %]
+bar
+END_TEMPLATE
+foo
+[% U1 foo %]
+foobar
+[% U1 %]
+bar
+END_EXPECTED
+
+preparse( <<'END_TEMPLATE', <<'END_EXPECTED', 'Simple FOREACH' );
+foo
+[% FOREACH element IN lists %]
+foobar
+[% END %]
+bar
+END_TEMPLATE
+foo
+[% F1 element IN lists %]
+foobar
+[% F1 %]
+bar
+END_EXPECTED

Added: branches/upstream/libtemplate-tiny-perl/current/xt/meta.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/xt/meta.t?rev=53218&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/xt/meta.t (added)
+++ branches/upstream/libtemplate-tiny-perl/current/xt/meta.t Mon Feb 22 20:58:55 2010
@@ -1,0 +1,27 @@
+#!/usr/bin/perl
+
+# Test that our META.yml file matches the current specification.
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+
+my $MODULE = 'Test::CPAN::Meta 0.12';
+
+# Don't run tests for installs
+use Test::More;
+unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) {
+	plan( skip_all => "Author tests not required for installation" );
+}
+
+# Load the testing module
+eval "use $MODULE";
+if ( $@ ) {
+	$ENV{RELEASE_TESTING}
+	? die( "Failed to load required release-testing module $MODULE" )
+	: plan( skip_all => "$MODULE not available for testing" );
+}
+
+meta_yaml_ok();

Added: branches/upstream/libtemplate-tiny-perl/current/xt/pmv.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/xt/pmv.t?rev=53218&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/xt/pmv.t (added)
+++ branches/upstream/libtemplate-tiny-perl/current/xt/pmv.t Mon Feb 22 20:58:55 2010
@@ -1,0 +1,32 @@
+#!/usr/bin/perl
+
+# Test that our declared minimum Perl version matches our syntax
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+
+my @MODULES = (
+	'Perl::MinimumVersion 1.20',
+	'Test::MinimumVersion 0.008',
+);
+
+# Don't run tests for installs
+use Test::More;
+unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) {
+	plan( skip_all => "Author tests not required for installation" );
+}
+
+# Load the testing modules
+foreach my $MODULE ( @MODULES ) {
+	eval "use $MODULE";
+	if ( $@ ) {
+		$ENV{RELEASE_TESTING}
+		? die( "Failed to load required release-testing module $MODULE" )
+		: plan( skip_all => "$MODULE not available for testing" );
+	}
+}
+
+all_minimum_version_from_metayml_ok();

Added: branches/upstream/libtemplate-tiny-perl/current/xt/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-tiny-perl/current/xt/pod.t?rev=53218&op=file
==============================================================================
--- branches/upstream/libtemplate-tiny-perl/current/xt/pod.t (added)
+++ branches/upstream/libtemplate-tiny-perl/current/xt/pod.t Mon Feb 22 20:58:55 2010
@@ -1,0 +1,32 @@
+#!/usr/bin/perl
+
+# Test that the syntax of our POD documentation is valid
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+
+my @MODULES = (
+	'Pod::Simple 3.07',
+	'Test::Pod 1.26',
+);
+
+# Don't run tests for installs
+use Test::More;
+unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) {
+	plan( skip_all => "Author tests not required for installation" );
+}
+
+# Load the testing modules
+foreach my $MODULE ( @MODULES ) {
+	eval "use $MODULE";
+	if ( $@ ) {
+		$ENV{RELEASE_TESTING}
+		? die( "Failed to load required release-testing module $MODULE" )
+		: plan( skip_all => "$MODULE not available for testing" );
+	}
+}
+
+all_pod_files_ok();




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