Hello community, here is the log from the commit of package perl-Template-Toolkit for openSUSE:Factory checked in at 2018-11-10 17:01:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Template-Toolkit (Old) and /work/SRC/openSUSE:Factory/.perl-Template-Toolkit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Template-Toolkit" Sat Nov 10 17:01:11 2018 rev:32 rq:647288 version:2.28 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Template-Toolkit/perl-Template-Toolkit.changes 2017-05-16 14:33:46.823019270 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Template-Toolkit.new/perl-Template-Toolkit.changes 2018-11-10 17:02:25.095530718 +0100 @@ -1,0 +2,91 @@ +Thu Nov 8 06:58:36 UTC 2018 - Stephan Kulow <co...@suse.com> + +- updated to 2.28 + see /usr/share/doc/packages/perl-Template-Toolkit/Changes + + * Matthew Somerville stopped a list import from printing an ARRAY(...) string. + https://github.com/abw/Template2/issues/33 + + + #----------------------------------------------------------------------- + # Unreleased + #------------------------------------------------------------------------ + + #----------------------------------------------------------------------- + # Version 2.28 - 11th October 2018 + #------------------------------------------------------------------------ + + * Add and enable Travis CI to track GitHub Pull Requests + + * Template is now using GitHub as the official Bug Tracker + + * Nicolas R. fixed a circular reference in Template::Plugin::Filter + https://github.com/abw/Template2/issues/152 + + * Nicolas R. adjusted group regexes to not be greedy + https://github.com/abw/Template2/issues/94 + + * Nicolas R. added unit tests to cover regression from RT 91172 + https://github.com/abw/Template2/issues/122 + + * Nicolas R. added support for template files having mtime=0 + https://github.com/abw/Template2/issues/102 + + * Todd Rinaldo fixed rand calls with no args in Math plugin + https://github.com/abw/Template2/issues/155 + + * Todd Rinaldo corrected ttree 2.22 logic change + https://github.com/abw/Template2/issues/148 + + * Todd Rinaldo turned off automated testing for tests using optional modules + https://github.com/abw/Template2/issues/156 + + * Nicolas R. adjusted unit tests to not force Stash::XS + + * Nicolas R. added a pre allocated buffer in Stash.xs to avoid malloc/free + https://github.com/abw/Template2/issues/82 + + * Nicolas R. optmized Template::Parser by avoiding a dummy sub + https://github.com/abw/Template2/issues/83 + + * Nicolas R. optimized Template:Directive by using index + https://github.com/abw/Template2/issues/84 + + * Nicolas R. adjust _dotop logic in Stash for perl 5.28 and earlier + https://github.com/abw/Template2/issues/81 + + * Todd Rinaldo documented VMethod method called 'item' + https://github.com/abw/Template2/issues/90 + + * Nicolas R. adjusted t/filter.t after recent switch to RFC3986 + https://github.com/abw/Template2/issues/179 + + * Nicolas R. fixed warnings from t/cgi.t + https://github.com/abw/Template2/issues/178 + + * Ivan Krylov added STRICT option to ttree + https://github.com/abw/Template2/issues/81 + + * Kent Fredric fixed relative path handling in templates on Perl 5.26+ + https://github.com/abw/Template2/issues/80 + + * Tom Delmas fixed some typo from documentation + https://github.com/abw/Template2/issues/76 + + * Matthew Somerville switched uri/url to use RFC3986 + updated the documentation to match the history. + https://github.com/abw/Template2/issues/35 + + * Sebastien Deseille used remove_tree helper to remove directories + https://github.com/abw/Template2/issues/67 + + * Nick Hibma - Add Sortkeys to DUMPER_ARGS + https://github.com/abw/Template2/issues/64 + + * E. Choroba added a warn on duplicate block name + https://github.com/abw/Template2/issues/61 + + * Jason Lewis fixed some typo in ttree.pod + https://github.com/abw/Template2/issues/58 + +------------------------------------------------------------------- Old: ---- Template-Toolkit-2.27.tar.gz New: ---- Template-Toolkit-2.28.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Template-Toolkit.spec ++++++ --- /var/tmp/diff_new_pack.C7t9tN/_old 2018-11-10 17:02:25.559530152 +0100 +++ /var/tmp/diff_new_pack.C7t9tN/_new 2018-11-10 17:02:25.559530152 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Template-Toolkit # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,19 +12,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: perl-Template-Toolkit -Version: 2.27 +Version: 2.28 Release: 0 %define cpan_name Template-Toolkit Summary: Template Processing System -License: Artistic-1.0 or GPL-1.0+ +License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/Template-Toolkit/ -Source0: https://cpan.metacpan.org/authors/id/A/AB/ABW/%{cpan_name}-%{version}.tar.gz +Url: https://metacpan.org/release/%{cpan_name} +Source0: https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl @@ -43,7 +43,7 @@ find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" +perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %{__make} %{?_smp_mflags} %check ++++++ Template-Toolkit-2.27.tar.gz -> Template-Toolkit-2.28.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/Changes new/Template-Toolkit-2.28/Changes --- old/Template-Toolkit-2.27/Changes 2016-12-13 09:02:25.000000000 +0100 +++ new/Template-Toolkit-2.28/Changes 2018-10-12 00:46:12.000000000 +0200 @@ -10,6 +10,91 @@ # #======================================================================== +* Matthew Somerville stopped a list import from printing an ARRAY(...) string. + https://github.com/abw/Template2/issues/33 + + +#----------------------------------------------------------------------- +# Unreleased +#------------------------------------------------------------------------ + +#----------------------------------------------------------------------- +# Version 2.28 - 11th October 2018 +#------------------------------------------------------------------------ + +* Add and enable Travis CI to track GitHub Pull Requests + +* Template is now using GitHub as the official Bug Tracker + +* Nicolas R. fixed a circular reference in Template::Plugin::Filter + https://github.com/abw/Template2/issues/152 + +* Nicolas R. adjusted group regexes to not be greedy + https://github.com/abw/Template2/issues/94 + +* Nicolas R. added unit tests to cover regression from RT 91172 + https://github.com/abw/Template2/issues/122 + +* Nicolas R. added support for template files having mtime=0 + https://github.com/abw/Template2/issues/102 + +* Todd Rinaldo fixed rand calls with no args in Math plugin + https://github.com/abw/Template2/issues/155 + +* Todd Rinaldo corrected ttree 2.22 logic change + https://github.com/abw/Template2/issues/148 + +* Todd Rinaldo turned off automated testing for tests using optional modules + https://github.com/abw/Template2/issues/156 + +* Nicolas R. adjusted unit tests to not force Stash::XS + +* Nicolas R. added a pre allocated buffer in Stash.xs to avoid malloc/free + https://github.com/abw/Template2/issues/82 + +* Nicolas R. optmized Template::Parser by avoiding a dummy sub + https://github.com/abw/Template2/issues/83 + +* Nicolas R. optimized Template:Directive by using index + https://github.com/abw/Template2/issues/84 + +* Nicolas R. adjust _dotop logic in Stash for perl 5.28 and earlier + https://github.com/abw/Template2/issues/81 + +* Todd Rinaldo documented VMethod method called 'item' + https://github.com/abw/Template2/issues/90 + +* Nicolas R. adjusted t/filter.t after recent switch to RFC3986 + https://github.com/abw/Template2/issues/179 + +* Nicolas R. fixed warnings from t/cgi.t + https://github.com/abw/Template2/issues/178 + +* Ivan Krylov added STRICT option to ttree + https://github.com/abw/Template2/issues/81 + +* Kent Fredric fixed relative path handling in templates on Perl 5.26+ + https://github.com/abw/Template2/issues/80 + +* Tom Delmas fixed some typo from documentation + https://github.com/abw/Template2/issues/76 + +* Matthew Somerville switched uri/url to use RFC3986 + updated the documentation to match the history. + https://github.com/abw/Template2/issues/35 + +* Sebastien Deseille used remove_tree helper to remove directories + https://github.com/abw/Template2/issues/67 + +* Nick Hibma - Add Sortkeys to DUMPER_ARGS + https://github.com/abw/Template2/issues/64 + +* E. Choroba added a warn on duplicate block name + https://github.com/abw/Template2/issues/61 + +* Jason Lewis fixed some typo in ttree.pod + https://github.com/abw/Template2/issues/58 + #----------------------------------------------------------------------- # Version 2.27 - 13th December 2016 #------------------------------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/HACKING new/Template-Toolkit-2.28/HACKING --- old/Template-Toolkit-2.27/HACKING 2016-12-13 08:39:01.000000000 +0100 +++ new/Template-Toolkit-2.28/HACKING 2018-10-12 00:33:16.000000000 +0200 @@ -1,11 +1,11 @@ Template Toolkit - Version 2.27 + Version 2.28 - December 2016 + October 2018 - Copyright (C) 1996-2016 Andy Wardley. All Rights Reserved + Copyright (C) 1996-2018 Andy Wardley. All Rights Reserved This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -48,7 +48,7 @@ COPYRIGHT --------- -Copyright (C) 1996-2016 Andy Wardley. All Rights Reserved. +Copyright (C) 1996-2018 Andy Wardley. All Rights Reserved. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/INSTALL new/Template-Toolkit-2.28/INSTALL --- old/Template-Toolkit-2.27/INSTALL 2016-12-13 08:39:23.000000000 +0100 +++ new/Template-Toolkit-2.28/INSTALL 2018-10-12 00:33:16.000000000 +0200 @@ -1,11 +1,11 @@ Template Toolkit - Version 2.27 + Version 2.28 - December 2016 + October 2018 - Copyright (C) 1996-2016 Andy Wardley. All Rights Reserved + Copyright (C) 1996-2018 Andy Wardley. All Rights Reserved This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -30,8 +30,8 @@ To install the Template Toolkit from the command line: - $ tar zxf Template-Toolkit-2.27.tar.gz - $ cd Template-Toolkit-2.27 + $ tar zxf Template-Toolkit-2.28.tar.gz + $ cd Template-Toolkit-2.28 $ perl Makefile.PL $ make $ make test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/MANIFEST new/Template-Toolkit-2.28/MANIFEST --- old/Template-Toolkit-2.27/MANIFEST 2017-04-15 09:29:06.000000000 +0200 +++ new/Template-Toolkit-2.28/MANIFEST 2018-10-12 00:48:23.000000000 +0200 @@ -74,8 +74,8 @@ lib/Template/View.pm lib/Template/VMethods.pm Makefile.PL -MANIFEST -META.yml Module meta-data (added by MakeMaker) +MANIFEST This list of files +META.yml parser/Grammar.pm.skel parser/Parser.yp parser/README @@ -87,6 +87,7 @@ t/base.t t/binop.t t/block.t +t/block_duplicate.t t/blocks.t t/capture.t t/case.t @@ -127,6 +128,8 @@ t/list.t t/macro.t t/math.t +t/math_rand.t +t/mtime-zero.t t/object.t t/outline.t t/output.t @@ -137,6 +140,7 @@ t/pod.t t/prefix.t t/proc.t +t/process-relative.t t/process.t t/process_dir.t t/provider.t @@ -221,7 +225,6 @@ t/try.t t/unicode.t t/url.t -t/url2.t t/vars.t t/varsv1.t t/view.t @@ -232,6 +235,8 @@ t/while.t t/wrap.t t/wrapper.t +t/zz-plugin-cycle.t +t/zz-plugin-leak-rt-46691.t t/zz-plugin-leak.t t/zz-pmv.t t/zz-pod-coverage.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/META.json new/Template-Toolkit-2.28/META.json --- old/Template-Toolkit-2.27/META.json 2017-04-15 09:29:06.000000000 +0200 +++ new/Template-Toolkit-2.28/META.json 2018-10-12 00:48:22.000000000 +0200 @@ -4,7 +4,7 @@ "Andy Wardley <a...@wardley.org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -22,9 +22,7 @@ "prereqs" : { "build" : { "requires" : { - "CGI" : "0", - "ExtUtils::MakeMaker" : "0", - "Test::LeakTrace" : "0" + "ExtUtils::MakeMaker" : "0" } }, "configure" : { @@ -39,13 +37,26 @@ "File::Temp" : "0.12", "Scalar::Util" : "0" } + }, + "test" : { + "requires" : { + "CGI" : "0", + "Test::LeakTrace" : "0" + } } }, "release_status" : "stable", "resources" : { + "bugtracker" : { + "web" : "https://github.com/abw/Template2/issues" + }, + "homepage" : "http://www.template-toolkit.org", "repository" : { - "url" : "https://github.com/abw/Template2" + "type" : "git", + "url" : "https://github.com/abw/Template2.git", + "web" : "https://github.com/abw/Template2" } }, - "version" : "2.27" + "version" : "2.28", + "x_serialization_backend" : "JSON::PP version 2.27400_02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/META.yml new/Template-Toolkit-2.28/META.yml --- old/Template-Toolkit-2.27/META.yml 2017-04-15 09:29:06.000000000 +0200 +++ new/Template-Toolkit-2.28/META.yml 2018-10-12 00:48:22.000000000 +0200 @@ -3,27 +3,30 @@ author: - 'Andy Wardley <a...@wardley.org>' build_requires: - CGI: 0 - ExtUtils::MakeMaker: 0 - Test::LeakTrace: 0 + CGI: '0' + ExtUtils::MakeMaker: '0' + Test::LeakTrace: '0' configure_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: Template-Toolkit no_index: directory: - t - inc requires: - AppConfig: 1.56 - File::Spec: 0.8 - File::Temp: 0.12 - Scalar::Util: 0 + AppConfig: '1.56' + File::Spec: '0.8' + File::Temp: '0.12' + Scalar::Util: '0' resources: - repository: https://github.com/abw/Template2 -version: 2.27 + bugtracker: https://github.com/abw/Template2/issues + homepage: http://www.template-toolkit.org + repository: https://github.com/abw/Template2.git +version: '2.28' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/Makefile.PL new/Template-Toolkit-2.28/Makefile.PL --- old/Template-Toolkit-2.27/Makefile.PL 2016-12-13 08:36:08.000000000 +0100 +++ new/Template-Toolkit-2.28/Makefile.PL 2018-10-12 00:33:16.000000000 +0200 @@ -87,7 +87,7 @@ $TT_QUIET = 'n'; $TT_ACCEPT = 'n'; -my $DEFAULTS_FILE = '.defaults.cfg'; +my $DEFAULTS_FILE = './.defaults.cfg'; my $DEFAULTS = ''; if (-f $DEFAULTS_FILE) { @@ -156,9 +156,16 @@ 'Test::LeakTrace' => 0, }, 'META_MERGE' => { - 'resources' => { - 'repository' => 'https://github.com/abw/Template2', - }, + 'meta-spec' => { version => 2 }, + "resources" => { + "bugtracker" => { web => "https://github.com/abw/Template2/issues" }, + "homepage" => "http://www.template-toolkit.org", + "repository" => { + "type" => "git", + "url" => "https://github.com/abw/Template2.git", + "web" => "https://github.com/abw/Template2" + }, + } }, 'dist' => { 'COMPRESS' => 'gzip', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/README new/Template-Toolkit-2.28/README --- old/Template-Toolkit-2.27/README 2016-12-13 08:38:08.000000000 +0100 +++ new/Template-Toolkit-2.28/README 2018-10-12 00:33:16.000000000 +0200 @@ -1,11 +1,11 @@ Template Toolkit - Version 2.27 + Version 2.28 - December 2016 + October 2018 - Copyright (C) 1996-2016 Andy Wardley. All Rights Reserved + Copyright (C) 1996-2018 Andy Wardley. All Rights Reserved This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -44,6 +44,9 @@ WHAT'S NEW? ----------- +Version 2.28 is a maintenance release fixing some minor bugs and warnings. +GitHub is now the official bug tacker tool for the project. + Version 2.27 is a maintenance release fixing some minor bugs and warnings. Version 2.26 adds the new outline tag style and fixes various minor bugs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/bin/ttree new/Template-Toolkit-2.28/bin/ttree --- old/Template-Toolkit-2.27/bin/ttree 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/bin/ttree 2018-10-11 23:49:04.000000000 +0200 @@ -292,16 +292,6 @@ } } - # check against acceptance list - if (@$accept) { - unless ((-d $abspath && $recurse) || grep { $path =~ /$_/ } @$accept) { - printf yellow(" - %-32s (not accepted)\n"), $path - if $verbose > 1; - $n_skip++; - next FILE; - } - } - if (-d $abspath) { if ($recurse) { my ($uid, $gid, $mode); @@ -391,6 +381,16 @@ } } + # check against acceptance list + if (not $copy_file and @$accept) { + unless (grep { $filename =~ /$_/ } @$accept) { + printf yellow(" - %-32s (not accepted)\n"), $file + if $verbose > 1; + $n_skip++; + return; + } + } + # stat the source file unconditionally, so we can preserve # mode and ownership ( undef, undef, $mode, undef, $uid, $gid, undef, @@ -632,6 +632,7 @@ 'template_default|default=s', 'template_error|error=s', 'template_debug|debug=s', + 'template_strict|strict', 'template_start_tag|start_tag|starttag=s', 'template_end_tag|end_tag|endtag=s', 'template_tag_style|tag_style|tagstyle=s', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Config.pm new/Template-Toolkit-2.28/lib/Template/Config.pm --- old/Template-Toolkit-2.27/lib/Template/Config.pm 2017-04-15 09:29:06.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Config.pm 2018-10-12 00:48:18.000000000 +0200 @@ -36,7 +36,7 @@ $PLUGINS = 'Template::Plugins'; $PROVIDER = 'Template::Provider'; $SERVICE = 'Template::Service'; -$STASH = 'Template::Stash'; +$STASH = 'Template::Stash::XS'; $CONSTANTS = 'Template::Namespace::Constants'; @PRELOAD = ( $CONTEXT, $FILTERS, $ITERATOR, $PARSER, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Context.pm new/Template-Toolkit-2.28/lib/Template/Context.pm --- old/Template-Toolkit-2.27/lib/Template/Context.pm 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Context.pm 2018-10-11 23:48:59.000000000 +0200 @@ -761,11 +761,11 @@ my @args = @_; if (@args) { - if ($args[0] =~ /^on|1$/i) { + if ($args[0] =~ /^(on|1)$/i) { $self->{ DEBUG_DIRS } = 1; shift(@args); } - elsif ($args[0] =~ /^off|0$/i) { + elsif ($args[0] =~ /^(off|0)$/i) { $self->{ DEBUG_DIRS } = 0; shift(@args); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Directive.pm new/Template-Toolkit-2.28/lib/Template/Directive.pm --- old/Template-Toolkit-2.27/lib/Template/Directive.pm 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Directive.pm 2018-10-11 23:48:59.000000000 +0200 @@ -209,7 +209,13 @@ # handler defined? if (@$ident > 2 && ($ns = $self->{ NAMESPACE })) { my $key = $ident->[0]; - $key =~ s/^'(.+)'$/$1/s; + + # a faster alternate to $key =~ s/^'(.+)'$/$1/s + if ( index( $key, q[']) == 0 ) { + substr( $key, 0, 1, '' ); + substr( $key, -1, 1, '' ); # remove the last char blindly + } + if ($ns = $ns->{ $key }) { return $ns->ident($ident); } @@ -679,7 +685,7 @@ }; if (\$@) { \$_tt_error = \$context->catch(\$@, \\\$output); - die \$_tt_error if \$_tt_error->type =~ /^return|stop\$/; + die \$_tt_error if \$_tt_error->type =~ /^(return|stop)\$/; \$stash->set('error', \$_tt_error); \$stash->set('e', \$_tt_error); if (defined (\$_tt_handler = \$_tt_error->select_handler($handlers))) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Filters.pm new/Template-Toolkit-2.28/lib/Template/Filters.pm --- old/Template-Toolkit-2.27/lib/Template/Filters.pm 2015-03-08 15:26:06.000000000 +0100 +++ new/Template-Toolkit-2.28/lib/Template/Filters.pm 2018-10-05 23:06:30.000000000 +0200 @@ -264,10 +264,10 @@ #----------------------------------------------------------------------- our $UNSAFE_SPEC = { - RFC2732 => q{A-Za-z0-9\-_.!~*'()}, - RFC3986 => q{A-Za-z0-9\-\._~}, + RFC2732 => q{A-Za-z0-9\-_.~!*'()}, + RFC3986 => q{A-Za-z0-9\-_.~}, }; -our $UNSAFE_CHARS = $UNSAFE_SPEC->{ RFC2732 }; +our $UNSAFE_CHARS = $UNSAFE_SPEC->{ RFC3986 }; our $URI_REGEX; our $URL_REGEX; our $URI_ESCAPES; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Manual/Filters.pod new/Template-Toolkit-2.28/lib/Template/Manual/Filters.pod --- old/Template-Toolkit-2.27/lib/Template/Manual/Filters.pod 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Manual/Filters.pod 2018-10-05 23:06:30.000000000 +0200 @@ -262,11 +262,14 @@ fixed it in 2.16 and provided the url filter to implement the old behaviour of not encoding reserved characters. -As of version 2.26 of the Template Toolkit, the C<uri> and L<url> filters +As of version 2.28 of the Template Toolkit, the C<uri> and L<url> filters use the unsafe character set defined by RFC3986. This means that certain -characters ("(", ")", "~", "*", "!" and the single quote "'") are now deemed -unsafe and will be escaped as hex character sequences. The double quote -character ('"') is now deemed safe and will not be escaped. +characters ("(", ")", "*", "!", "'", and '"') are now deemed unsafe and +will be escaped as hex character sequences. + +The ability to use the RFC3986 character set was added in 2.26 but not +enabled by default; double quote was incorrectly deemed safe in 2.26 but +correctly escaped in 2.27. If you want to enable the old behaviour then call the C<use_rfc2732()> method in L<Template::Filters> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Manual/VMethods.pod new/Template-Toolkit-2.28/lib/Template/Manual/VMethods.pod --- old/Template-Toolkit-2.27/lib/Template/Manual/VMethods.pod 2015-03-08 15:21:11.000000000 +0100 +++ new/Template-Toolkit-2.28/lib/Template/Manual/VMethods.pod 2018-10-05 23:06:59.000000000 +0200 @@ -153,7 +153,7 @@ argument following the pattern. [% text = 'bandanna'; - text.match('an+', 1).join(', ) # an, ann + text.match('an+', 1).join(', ') # an, ann %] =head2 repeat(n) @@ -552,7 +552,7 @@ two = [ 4 5 6 ]; three = [ 7 8 9 ]; one.import(two, three); - one.join(', ); # 1, 2, 3, 4, 5, 6, 7, 8, 9 + one.join(', '); # 1, 2, 3, 4, 5, 6, 7, 8, 9 %] =head2 merge @@ -637,6 +637,12 @@ [% hash.1 %] # beer [% hash.2 %] # peanuts +=head2 item + +Returns an item from the list using an index passed as an argument. + + [% list.item(0) %] # same as list.0 + =head1 Automagic Promotion of Scalar to List for Virtual Methods In addition to the scalar virtual methods listed in the previous diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Parser.pm new/Template-Toolkit-2.28/lib/Template/Parser.pm --- old/Template-Toolkit-2.27/lib/Template/Parser.pm 2014-04-25 12:42:50.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Parser.pm 2018-10-09 20:57:13.000000000 +0200 @@ -744,6 +744,8 @@ $self->debug("compiled block '$name':\n$block") if $self->{ DEBUG } & Template::Constants::DEBUG_PARSER; + warn "Block redefined: $name\n" if exists $defblock->{ $name }; + $defblock->{ $name } = $block; return undef; @@ -952,22 +954,27 @@ or $status = ACCEPT; # use dummy sub if code ref doesn't exist - $code = sub { $_[1] } - unless $code; - - @codevars = $len - ? map { $_->[1] } @$stack[ -$len .. -1 ] - : (); + if ( !$code ) { + $coderet = $len ? $stack->[ -$len ]->[1] : undef; + } else { + # $code = sub { $_[1] } + # unless $code; + + @codevars = $len + ? map { $_->[1] } @$stack[ -$len .. -1 ] + : (); - eval { - $coderet = &$code( $self, @codevars ); - }; - if ($@) { - my $err = $@; - chomp $err; - return $self->_parse_error($err); + eval { + $coderet = &$code( $self, @codevars ); + }; + if ($@) { + my $err = $@; + chomp $err; + return $self->_parse_error($err); + } } + # reduce stack by $len splice(@$stack, -$len, $len); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Plugin/Dumper.pm new/Template-Toolkit-2.28/lib/Template/Plugin/Dumper.pm --- old/Template-Toolkit-2.27/lib/Template/Plugin/Dumper.pm 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Plugin/Dumper.pm 2018-10-05 23:06:30.000000000 +0200 @@ -27,7 +27,7 @@ our $VERSION = 2.70; our $DEBUG = 0 unless defined $DEBUG; our @DUMPER_ARGS = qw( Indent Pad Varname Purity Useqq Terse Freezer - Toaster Deepcopy Quotekeys Bless Maxdepth ); + Toaster Deepcopy Quotekeys Bless Maxdepth Sortkeys ); our $AUTOLOAD; #============================================================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Plugin/Filter.pm new/Template-Toolkit-2.28/lib/Template/Plugin/Filter.pm --- old/Template-Toolkit-2.27/lib/Template/Plugin/Filter.pm 2014-04-24 08:59:12.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Plugin/Filter.pm 2018-10-11 23:49:04.000000000 +0200 @@ -64,14 +64,8 @@ my $self = shift; my $this = $self; - # This causes problems: https://rt.cpan.org/Ticket/Display.html?id=46691 - # If the plugin is loaded twice in different templates (one INCLUDEd into - # another) then the filter gets garbage collected when the inner template - # ends (at least, I think that's what's happening). So I'm going to take - # the "suck it and see" approach, comment it out, and wait for someone to - # complain that this module is leaking memory. - - # weaken($this); + # avoid a memory leak + weaken( $this->{_CONTEXT} ) if ref $this->{_CONTEXT}; if ($self->{ _DYNAMIC }) { return [ sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Plugin/Math.pm new/Template-Toolkit-2.28/lib/Template/Plugin/Math.pm --- old/Template-Toolkit-2.27/lib/Template/Plugin/Math.pm 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Plugin/Math.pm 2018-10-09 20:57:13.000000000 +0200 @@ -52,10 +52,10 @@ sub int { shift; CORE::int($_[0]); } sub log { shift; CORE::log($_[0]); } sub oct { shift; CORE::oct($_[0]); } -sub rand { shift; CORE::rand($_[0]); } +sub rand { shift; @_ ? CORE::rand($_[0]) : CORE::rand(); } sub sin { shift; CORE::sin($_[0]); } sub sqrt { shift; CORE::sqrt($_[0]); } -sub srand { shift; CORE::srand($_[0]); } +sub srand { shift; @_ ? CORE::srand($_[0]) : CORE::srand(); } # Use the Math::TrulyRandom module # XXX This is *sloooooooowwwwwwww* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Provider.pm new/Template-Toolkit-2.28/lib/Template/Provider.pm --- old/Template-Toolkit-2.27/lib/Template/Provider.pm 2014-04-23 21:11:24.000000000 +0200 +++ new/Template-Toolkit-2.28/lib/Template/Provider.pm 2018-10-11 23:48:59.000000000 +0200 @@ -212,7 +212,7 @@ foreach my $dir (@$paths) { $path = File::Spec->catfile($dir, $name); last INCPATH - if $self->_template_modified($path); + if defined $self->_template_modified($path); } undef $path; # not found } @@ -562,13 +562,29 @@ sub _load_compiled { my ($self, $file) = @_; + + # Implicitly Relative paths are not supported + # by "require" and invoke @INC traversal, where relative + # paths only traditionally worked prior to Perl 5.26 + # due to the presence of '.' in @INC + # + # Given load_compiled never wants to traverse @INC, forcing + # an absolute path for the loaded file and the INC key is + # sensible. + # + # NB: %INC Keys are always identical to their respective + # "require" invocations regardless of OS, and the only time + # one needs to care about slash direction is when dealing + # with Module::Name -> Module/Name.pm translation. + my $fpath = File::Spec->rel2abs( $file ); + my $compiled; # load compiled template via require(); we zap any # %INC entry to ensure it is reloaded (we don't # want 1 returned by require() to say it's in memory) - delete $INC{ $file }; - eval { $compiled = require $file; }; + delete $INC{ $fpath }; + eval { $compiled = require $fpath; }; return $@ ? $self->error("compiled template $compiled: $@") : $compiled; @@ -627,7 +643,7 @@ } # Otherwise, it's the name of the template - if ( $self->_template_modified( $name ) ) { # does template exist? + if ( defined $self->_template_modified( $name ) ) { # does template exist? my ($text, $error, $mtime ) = $self->_template_content( $name ); unless ( $error ) { $text = $self->_decode_unicode($text) if $self->{ UNICODE }; @@ -845,7 +861,7 @@ $parsedoc->{ METADATA } = { 'name' => $data->{ name }, - 'modtime' => $data->{ time }, + 'modtime' => $data->{ 'time' }, %{ $parsedoc->{ METADATA } }, }; @@ -871,13 +887,13 @@ # set atime and mtime of newly compiled file, don't bother # if time is undef - if (!defined($error) && defined $data->{ time }) { + if (!defined($error) && defined $data->{ 'time' }) { my ($cfile) = $compfile =~ /^(.+)$/s or do { return("invalid filename: $compfile", Template::Constants::STATUS_ERROR); }; - my ($ctime) = $data->{ time } =~ /^(\d+)$/; + my ($ctime) = $data->{ 'time' } =~ /^(\d+)$/; unless ($ctime || $ctime eq 0) { return("invalid time: $ctime", Template::Constants::STATUS_ERROR); @@ -915,9 +931,15 @@ sub _compiled_is_current { my ( $self, $template_name ) = @_; - my $compiled_name = $self->_compiled_filename($template_name) || return; - my $compiled_mtime = (stat($compiled_name))[9] || return; - my $template_mtime = $self->_template_modified( $template_name ) || return; + + my $compiled_name = $self->_compiled_filename($template_name); + return unless defined $compiled_name; + + my $compiled_mtime = (stat($compiled_name))[9]; + return unless defined $compiled_mtime; + + my $template_mtime = $self->_template_modified( $template_name ); + return unless defined $template_mtime; # This was >= in the 2.15, but meant that downgrading # a source template would not get picked up. @@ -992,8 +1014,8 @@ sub _modified { my ($self, $name, $time) = @_; - my $load = $self->_template_modified($name) - || return $time ? 1 : 0; + my $load = $self->_template_modified($name); + return $time ? 1 : 0 unless defined $load; return $time ? $load > $time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/Stash.pm new/Template-Toolkit-2.28/lib/Template/Stash.pm --- old/Template-Toolkit-2.27/lib/Template/Stash.pm 2015-03-08 15:21:11.000000000 +0100 +++ new/Template-Toolkit-2.28/lib/Template/Stash.pm 2018-10-11 23:48:59.000000000 +0200 @@ -75,13 +75,13 @@ my $op; $type = lc $type; - if ($type =~ /^scalar|item$/) { + if ($type =~ /^(scalar|item)$/) { $op = $SCALAR_OPS; } elsif ($type eq 'hash') { $op = $HASH_OPS; } - elsif ($type =~ /^list|array$/) { + elsif ($type =~ /^(list|array)$/) { $op = $LIST_OPS; } else { @@ -497,7 +497,9 @@ # real throwing my $class = ref($root) || $root; - die $@ if ref($@) || ($@ !~ /Can't locate object method "\Q$item\E" via package "\Q$class\E"/); + + # Fail only if the function exists + die $@ if ( ref($@) || $root->can($item) ); # failed to call object method, so try some fallbacks if (reftype $root eq 'HASH') { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template/VMethods.pm new/Template-Toolkit-2.28/lib/Template/VMethods.pm --- old/Template-Toolkit-2.27/lib/Template/VMethods.pm 2015-03-08 15:21:11.000000000 +0100 +++ new/Template-Toolkit-2.28/lib/Template/VMethods.pm 2018-10-05 23:06:30.000000000 +0200 @@ -616,7 +616,7 @@ sub list_import { my $list = shift; push(@$list, grep defined, map ref eq 'ARRAY' ? @$_ : undef, @_); - return $list; + return ''; } sub list_merge { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/lib/Template.pm new/Template-Toolkit-2.28/lib/Template.pm --- old/Template-Toolkit-2.27/lib/Template.pm 2016-12-13 08:36:47.000000000 +0100 +++ new/Template-Toolkit-2.28/lib/Template.pm 2018-10-12 00:33:16.000000000 +0200 @@ -32,7 +32,7 @@ use File::Path; use Scalar::Util qw(blessed); -our $VERSION = '2.27'; +our $VERSION = '2.28'; our $ERROR = ''; our $DEBUG = 0; our $BINMODE = 0 unless defined $BINMODE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/block_duplicate.t new/Template-Toolkit-2.28/t/block_duplicate.t --- old/Template-Toolkit-2.27/t/block_duplicate.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/block_duplicate.t 2018-10-05 23:06:30.000000000 +0200 @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use Test::More tests => 1; + +use Template; + +my $warning_seen; +local $SIG{__WARN__} = sub { + my @warnings = @_; + if ($warnings[0] =~ /Block redefined: b1/) { + ++$warning_seen; + } else { + die "Unexpected warning: ", @warnings; + } +}; + +my $t = Template->new; +$t->process(\ << '__TEMPLATE__', {}, \ my $ignore_output); +[% BLOCK b1 %]first[% END %] +[% BLOCK b1 %]second[% END %] +__TEMPLATE__ + +is $warning_seen, 1, 'warning seen'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/cgi.t new/Template-Toolkit-2.28/t/cgi.t --- old/Template-Toolkit-2.27/t/cgi.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/cgi.t 2018-10-05 23:59:31.000000000 +0200 @@ -13,7 +13,7 @@ # under the same terms as Perl itself. # # $Id$ -# +# #======================================================================== use strict; @@ -31,46 +31,50 @@ skip_all("no CGI module"); } - my $cgi = CGI->new(''); -$cgi = join("\n", $cgi->checkbox_group( - -name => 'words', - -values => [ 'eenie', 'meenie', 'minie', 'moe' ], - -defaults => [ 'eenie', 'meenie' ], -)); +$cgi = join( + "\n", + $cgi->checkbox_group( + -name => 'words', + -values => [ 'eenie', 'meenie', 'minie', 'moe' ], + -defaults => [ 'eenie', 'meenie' ], + ) +); - -test_expect(\*DATA, undef, { cgicheck => $cgi, barf => \&barf }); +test_expect( \*DATA, undef, { cgicheck => $cgi, barf => \&barf } ); sub barf { carp('failed'); } - __END__ -- test -- +[% USE scalar -%] [% USE cgi = CGI('id=abw&name=Andy+Wardley'); global.cgi = cgi -%] -name: [% global.cgi.param('name') %] +name: [% global.cgi.scalar.param('name') %] -- expect -- name: Andy Wardley -- test -- -name: [% global.cgi.param('name') %] +[% USE scalar -%] +name: [% global.cgi.scalar.param('name') %] -- expect -- name: Andy Wardley -- test -- +[% USE scalar -%] [% FOREACH key = global.cgi.param.sort -%] - * [% key %] : [% global.cgi.param(key) %] + * [% key %] : [% global.cgi.scalar.param(key) %] [% END %] -- expect -- * id : abw * name : Andy Wardley -- test -- +[% USE scalar -%] [% FOREACH key = global.cgi.param().sort -%] - * [% key %] : [% global.cgi.param(key) %] + * [% key %] : [% global.cgi.scalar.param(key) %] [% END %] -- expect -- * id : abw diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/filter.t new/Template-Toolkit-2.28/t/filter.t --- old/Template-Toolkit-2.27/t/filter.t 2014-05-12 14:38:16.000000000 +0200 +++ new/Template-Toolkit-2.28/t/filter.t 2018-10-09 20:57:08.000000000 +0200 @@ -945,12 +945,12 @@ -- test -- [% "foo(bar)" | uri %] -- expect -- -foo(bar) +foo%28bar%29 -- test -- [% "foo(bar)" | url %] -- expect -- -foo(bar) +foo%28bar%29 -- test -- [% use_rfc3986; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/math_rand.t new/Template-Toolkit-2.28/t/math_rand.t --- old/Template-Toolkit-2.27/t/math_rand.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/math_rand.t 2018-10-09 20:57:13.000000000 +0200 @@ -0,0 +1,19 @@ +use strict; +use Test::More; +use Template; + +plan tests => 1; + +my @warnings; +local $SIG{__WARN__} = sub { push @warnings, @_ }; +my $t = Template->new; +my $out; +$t->process(\<<EOF, {}, \$out) or die $t->error; +[% USE Math -%] +rand with arg: [% Math.rand(1000000) %] +rand without arg: [% Math.rand %] +srand with arg: [% Math.srand(1000000) %] +srand without arg: [% Math.srand %] +EOF +#diag $out; +is_deeply \@warnings, [], 'No warnings when calling rand/srand without arg'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/mtime-zero.t new/Template-Toolkit-2.28/t/mtime-zero.t --- old/Template-Toolkit-2.27/t/mtime-zero.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/mtime-zero.t 2018-10-11 23:48:59.000000000 +0200 @@ -0,0 +1,45 @@ +#============================================================= -*-perl-*- +# +# t/mtime-zero.t +# +# Test template process with . in INCLUDE_PATH +# +# Written by Nicolas R. <atoo...@cpan.org> +# +# Copyright (C) 2018 cPanel Inc. All Rights Reserved. +# +# This is free software; you can redistribute it and/or modify it +# under the same terms as Perl itself. +# +# $Id$ +# +#======================================================================== + +use strict; +use warnings; + +use Template; + +use File::Temp qw(tempfile tempdir); + +use Test::More tests => 4; + +my $content = "hello, world\n"; + +my ( $tmpfh, $tmpfile ) = tempfile( UNLINK => 1 ); +print $tmpfh $content; +close $tmpfh or die $!; + +{ + my $out; + ok( Template->new( { ABSOLUTE => 1 } )->process( $tmpfile, {}, \$out ), "process tmpfile" ); + is( $out, $content, "content as expected" ); +} + +{ + utime 0, 0, $tmpfile or die $!; + + my $out; + ok( Template->new( { ABSOLUTE => 1 } )->process( $tmpfile, {}, \$out ), "process tmpfile [utime=0]" ); + is( $out, $content, "content as expected [utime=0]" ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/process-relative.t new/Template-Toolkit-2.28/t/process-relative.t --- old/Template-Toolkit-2.27/t/process-relative.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/process-relative.t 2018-10-11 23:48:59.000000000 +0200 @@ -0,0 +1,77 @@ +#============================================================= -*-perl-*- +# +# t/process-relative.t +# +# Test template process with . in INCLUDE_PATH +# +# Written by Nicolas R. <atoo...@cpan.org> +# +# Copyright (C) 2018 cPanel Inc. All Rights Reserved. +# +# This is free software; you can redistribute it and/or modify it +# under the same terms as Perl itself. +# +# $Id$ +# +#======================================================================== + +use strict; +use lib qw( ./lib ../lib ); +use Template; + +#use Template::Test; + +use Test::More tests => 8; + +#$Template::Test::DEBUG = 0; +#$Template::Context::DEBUG = 1; + +my $template_file = q[t/test/dir/file1]; + +plan( skip_all => "File $template_file missing" ) unless -e $template_file; + +foreach my $f ( $template_file, "./$template_file" ) { + note "processing $f with INCLUDE_PATH='.' ; RELATIVE => 1"; + my $out; + Template->new( { INCLUDE_PATH => ".", RELATIVE => 1 } )->process( $f, undef, \$out ); + is $out => q[This is file 1], "process file $f"; +} + +foreach my $f ( $template_file, "./$template_file" ) { + note "processing $f with RELATIVE => 1"; + my $out; + Template->new( { RELATIVE => 1 } )->process( $f, undef, \$out ); + is $out => q[This is file 1], "process file $f"; +} + +{ + my $f = $template_file; + note "processing $f with INCLUDE_PATH='.'"; + my $out; + Template->new( { INCLUDE_PATH => "." } )->process( $f, undef, \$out ); + is $out => q[This is file 1], "process file $f"; +} + +{ + my $f = "./$template_file"; + note "processing $f with INCLUDE_PATH='.'"; + my $out; + Template->new( { INCLUDE_PATH => "." } )->process( $f, undef, \$out ); + is $out => undef, "process file $f fails without setting RELATIVE"; +} + +{ + my $out; + my $f = $template_file; + note "processing $f without INCLUDE_PATH set"; + Template->new()->process( $f, undef, \$out ); + is $out => q[This is file 1], "process file $f"; +} + +{ + my $out; + my $f = "./$template_file"; + note "processing $f without INCLUDE_PATH set"; + Template->new()->process( $f, undef, \$out ); + is $out => undef, "process file $f"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/process_dir.t new/Template-Toolkit-2.28/t/process_dir.t --- old/Template-Toolkit-2.27/t/process_dir.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/process_dir.t 2018-10-09 20:57:09.000000000 +0200 @@ -21,11 +21,12 @@ use Template; use Test::More; +use File::Path qw (remove_tree); my $testdir = 'testdir'; my $CACHEDIR = 'ttcache'; -`rm -rf $CACHEDIR $testdir`; +remove_tree("$CACHEDIR", "$testdir"); my $config = {COMPILE_DIR => $CACHEDIR}; my $tt1 = Template->new($config); @@ -38,7 +39,7 @@ my $expected1 = "file error - $testdir: not found"; -my $expected2 = "file error - ./$testdir: not a file"; +my $expected2 = $^O ne 'MSWin32' ? "file error - ./$testdir: not a file" : "file error - $testdir: not a file"; my $expected3 = <<'EOF'; This is the first test @@ -77,4 +78,4 @@ done_testing(); -`rm -rf $CACHEDIR $testdir`; +remove_tree("$CACHEDIR", "$testdir"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/stash-xs-unicode.t new/Template-Toolkit-2.28/t/stash-xs-unicode.t --- old/Template-Toolkit-2.27/t/stash-xs-unicode.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/stash-xs-unicode.t 2018-10-09 20:57:13.000000000 +0200 @@ -20,6 +20,7 @@ use utf8; use Template; use Template::Test; +use Template::Config; BEGIN { unless ($] > 5.007) { @@ -27,17 +28,14 @@ } } -eval { - require Template::Stash::XS; -}; -if ($@) { - warn $@; - skip_all('cannot load Template::Stash::XS'); +# only run the test when compiled with Template::Stash +if ( $Template::Config::STASH ne 'Template::Stash::XS' ) { + skip_all('Template::Config is not using Template::Stash::XS'); } -binmode STDOUT, ':utf8'; +require Template::Stash::XS; -$Template::Config::STASH = 'Template::Stash::XS'; +binmode STDOUT, ':utf8'; my $data = { ascii => 'key', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/stash-xs.t new/Template-Toolkit-2.28/t/stash-xs.t --- old/Template-Toolkit-2.27/t/stash-xs.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/stash-xs.t 2018-10-09 20:57:13.000000000 +0200 @@ -20,15 +20,14 @@ use Template::Constants qw( :status ); use Template; use Template::Test; +use Template::Config; -eval { - require Template::Stash::XS; -}; -if ($@) { - warn $@; - skip_all('cannot load Template::Stash::XS'); +# only run the test when compiled with Template::Stash +if ( $Template::Config::STASH ne 'Template::Stash::XS' ) { + skip_all('Template::Config is not using Template::Stash::XS'); } +require Template::Stash::XS; #------------------------------------------------------------------------ # define some simple objects for testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/tiedhash.t new/Template-Toolkit-2.28/t/tiedhash.t --- old/Template-Toolkit-2.27/t/tiedhash.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/tiedhash.t 2018-10-09 20:57:13.000000000 +0200 @@ -18,24 +18,22 @@ use strict; use warnings; +# should not prove be responsible for this? use lib qw( blib/lib blib/arch lib ../blib/lib ../blib/arch ../lib ); use Template::Test; use Template::Stash; +use Template::Config; + our $DEBUG = grep(/-d/, @ARGV); +our $STORE_PREFIX = ''; +our $FETCH_PREFIX = ''; -eval { - require Template::Stash::XS; -}; -if ($@) { - warn $@; - skip_all('cannot load Template::Stash::XS'); +# only run the test when compiled with Template::Stash +if ( $Template::Config::STASH ne 'Template::Stash::XS' ) { + skip_all('Template::Config is not using Template::Stash::XS'); } -#print "stash: $Template::Config::STASH\n"; -#$Template::Config::STASH = 'Template::Stash::XS'; - -our $STORE_PREFIX = ''; -our $FETCH_PREFIX = ''; +require Template::Stash::XS; #------------------------------------------------------------------------ package My::Tied::Hash; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/vmethods/list.t new/Template-Toolkit-2.28/t/vmethods/list.t --- old/Template-Toolkit-2.27/t/vmethods/list.t 2015-03-08 15:21:11.000000000 +0100 +++ new/Template-Toolkit-2.28/t/vmethods/list.t 2018-10-09 20:57:09.000000000 +0200 @@ -286,7 +286,8 @@ -- name list import one -- [% list_one = [ 1 2 3 ]; list_two = [ 4 5 6 ]; - list_one.import(list_two).join(', ') %] + list_one.import(list_two); + list_one.join(', ') %] -- expect -- 1, 2, 3, 4, 5, 6 @@ -295,7 +296,8 @@ [% list_one = [ 1 2 3 ]; list_two = [ 4 5 6 ]; list_three = [ 7 8 9 0 ]; - list_one.import(list_two, list_three).join(', ') %] + list_one.import(list_two, list_three); + list_one.join(', ') %] -- expect -- 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/zz-plugin-cycle.t new/Template-Toolkit-2.28/t/zz-plugin-cycle.t --- old/Template-Toolkit-2.27/t/zz-plugin-cycle.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/zz-plugin-cycle.t 2018-10-11 23:49:04.000000000 +0200 @@ -0,0 +1,57 @@ +#============================================================= -*-perl-*- +# +# t/zz-plugin-cycle.t +# +# Check for memory leak when using Template::Plugin::Simple +# +# Written by Nicolas R. <atoo...@cpan.org> +# +# Copyright (C) 2018 cPanel Inc. All Rights Reserved. +# +# This is free software; you can redistribute it and/or modify it +# under the same terms as Perl itself. +# +#======================================================================== + +use strict; +use lib qw( t/lib ./lib ../lib ../blib/arch ); + +use Template; +use Template::Plugin::Simple; + +use Test::More; + +plan( skip_all => "Developer test" ) unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ); + +plan tests => 1; + +#use Test::LeakTrace; +eval { require Test::LeakTrace }; +if ($@) { + skip_all('Test::LeakTrace not installed'); +} + +note "Searching for leak using Test::LeakTrace..."; + +my $no_leaks = Test::LeakTrace::no_leaks_ok( \&plugin_simple_test, 'no leak from Template::Plugin' ); + +if ( !$no_leaks ) { + diag "Memory leak detected..."; + + if ( eval { require Devel::Cycle; 1 } ) { + Devel::Cycle::find_cycle( plugin_simple_test() ); + } + else { + diag "consider installing Devel::Cycle to detect leak"; + } +} + +exit; + +sub plugin_simple_test { + my $tpl = Template->new( PLUGIN_BASE => 'test' ); + $tpl->context->plugin( 'Simple', [] ); + + return $tpl; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/zz-plugin-leak-rt-46691.t new/Template-Toolkit-2.28/t/zz-plugin-leak-rt-46691.t --- old/Template-Toolkit-2.27/t/zz-plugin-leak-rt-46691.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Template-Toolkit-2.28/t/zz-plugin-leak-rt-46691.t 2018-10-11 23:49:04.000000000 +0200 @@ -0,0 +1,127 @@ +#!/usr/bin/perl + +#============================================================= -*-perl-*- +# +# t/zz-plugin-leak-rt-46691.t +# +# Testcase from RT #46691 aka GH #144 +# view https://github.com/abw/Template2/issues/144 +# +# Written by Nicolas R. <atoo...@cpan.org> +# +# Copyright (C) 2018 cPanel Inc. All Rights Reserved. +# +# This is free software; you can redistribute it and/or modify it +# under the same terms as Perl itself. +# +#======================================================================== + +use lib qw( t/lib ./lib ../lib ../blib/arch ./test ); + +use Template; +use Test::More; + +use File::Temp qw(tempfile tempdir); + +plan( skip_all => "Developer test only - set RELEASE_TESTING=1" ) unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ); + +plan tests => 2; + +# ------- t1.txt - checkleak template +my $t1 = <<'EOT'; +[% USE checkleak %] +test 1: [% name | checkleak %] +[% INCLUDE t2.txt %] +test 3: [% name3 | checkleak %] +EOT + +# ------- t2.txt - an included template +my $t2 = <<'EOT'; +[% USE checkleak %] +test 2: [% name2 | checkleak %] +EOT + +# ------- checkleak.pm a super checkleak custom filter +my $plugin_checkleak = <<'EOT'; + +package Template::Plugin::checkleak; + +use Template::Plugin::Filter; +use base qw( Template::Plugin::Filter ); + +no warnings; + +sub filter { + my ($self, $text, $args, $conf) = @_; + return qq|**|.$text.qq|**|; +} + +sub init { + my $self = shift; + $self->{'_DYNAMIC'}=1; + my $name = $self->{ _CONFIG }->{ name } || 'checkleak'; + $self->install_filter($name); + return $self; +} + +1; +EOT + +my $template_tmpdir = tempdir( CLEANUP => 1 ); + +write_text( qq[$template_tmpdir/t1.txt], $t1 ); +write_text( qq[$template_tmpdir/t2.txt], $t2 ); + +my $plugindir = tempdir( CLEANUP => 1 ); + +my $plugin_pm = qq[$plugindir/Template/Plugin/checkleak.pm]; + +# pretty ugly but only run by authors... +mkdir("$plugindir/Template") && mkdir("$plugindir/Template/Plugin"); +die q[Failed to create plugindir] unless -d "$plugindir/Template/Plugin"; + +write_text( $plugin_pm, $plugin_checkleak ); + +unshift @INC, $plugindir; +ok eval { do $plugin_pm; 1 }, "can load Template::Plugin::checkleak" + or die "Failed to load Template::Plugin::checkleak - $@"; + +# chdir to our temporary folder with templates +chdir($template_tmpdir) or die; + +my $tt = Template->new( { 'PLUGIN_BASE' => $plugindir } ); + +my $out; +$tt->process( + 't1.txt', + { + 'name' => 'jason', + 'name2' => 'fred', + 'name3' => 'jim', + }, + \$out +) || print STDERR $tt->error(); + +# make sure we can process the template without any issues +# the original bug was doing a weaken on the plugin itself.. +# resulting in not being able to load it a second time +is $out, <<'EXPECT', "Template processed correctly using Plugin checkleak twice"; + +test 1: **jason** + +test 2: **fred** + +test 3: **jim** +EXPECT + +done_testing; + +exit; + +sub write_text { # could also use File::Slurper::write_file .... + my ( $file, $content ) = @_; + + open( my $fh, '>', $file ) or die $!; + print {$fh} $content; + close($fh); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/zz-pod-coverage.t new/Template-Toolkit-2.28/t/zz-pod-coverage.t --- old/Template-Toolkit-2.27/t/zz-pod-coverage.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/zz-pod-coverage.t 2018-10-09 20:57:13.000000000 +0200 @@ -20,7 +20,7 @@ plan( skip_all => "Author tests not required for installation" ) unless $ENV{ RELEASE_TESTING } - or $ENV{ AUTOMATED_TESTING }; + or $ENV{ AUTHOR_TESTING }; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/zz-pod-kwalitee.t new/Template-Toolkit-2.28/t/zz-pod-kwalitee.t --- old/Template-Toolkit-2.27/t/zz-pod-kwalitee.t 2014-04-24 09:11:42.000000000 +0200 +++ new/Template-Toolkit-2.28/t/zz-pod-kwalitee.t 2018-10-09 20:57:13.000000000 +0200 @@ -20,7 +20,7 @@ plan( skip_all => "Author tests not required for installation" ) unless $ENV{ RELEASE_TESTING } - or $ENV{ AUTOMATED_TESTING }; + or $ENV{ AUTHOR_TESTING }; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/t/zz-stash-xs-leak.t new/Template-Toolkit-2.28/t/zz-stash-xs-leak.t --- old/Template-Toolkit-2.27/t/zz-stash-xs-leak.t 2014-04-24 11:34:15.000000000 +0200 +++ new/Template-Toolkit-2.28/t/zz-stash-xs-leak.t 2018-10-09 20:57:13.000000000 +0200 @@ -18,6 +18,8 @@ use lib qw( ./lib ../lib ../blib/lib ../blib/arch ./blib/lib ./blib/arch ); use Template::Constants qw( :status ); use Template; +use Template::Config; + use Test::More; # belt and braces @@ -29,6 +31,11 @@ plan( skip_all => "Developer tests not required for installation" ); } +# only run the test when compiled with Template::Stash +if ( $Template::Config::STASH ne 'Template::Stash::XS' ) { + skip_all('Template::Config is not using Template::Stash::XS'); +} + require Template::Stash::XS; my $stash = Template::Stash::XS->new( { x => 10, y => { } } ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Template-Toolkit-2.27/xs/Stash.xs new/Template-Toolkit-2.28/xs/Stash.xs --- old/Template-Toolkit-2.27/xs/Stash.xs 2014-05-12 14:25:10.000000000 +0200 +++ new/Template-Toolkit-2.28/xs/Stash.xs 2018-10-09 20:57:13.000000000 +0200 @@ -100,9 +100,13 @@ static SV* scalar_dot_defined(pTHX_ SV*, AV*); static SV* scalar_dot_length(pTHX_ SV*, AV*); +#if PERL_VERSION >= 19 + #define THROW_SIZE 64 static char throw_fmt[] = "Can't locate object method \"%s\" via package \"%s\""; +#endif + /* dispatch table for XS versions of special "virtual methods", * names must be in alphabetical order */ @@ -342,7 +346,9 @@ SPAGAIN; if (SvTRUE(ERRSV)) { +#if PERL_VERSION >= 19 char throw_str[THROW_SIZE+1]; +#endif (void) POPs; /* remove undef from stack */ PUTBACK; result = NULL; @@ -365,10 +371,17 @@ * to fit into throw_str then snprintf() doesn't add the * terminating NULL */ +#if PERL_VERSION >= 19 snprintf(throw_str, THROW_SIZE, throw_fmt, item, HvNAME(stash)); throw_str[THROW_SIZE] = '\0'; - - if (! strstr( SvPV(ERRSV, PL_na), throw_str)) +#endif + if ( +#if PERL_VERSION >= 19 + ! strstr( SvPV(ERRSV, PL_na), throw_str) +#else + ! strstr( SvPV(ERRSV, PL_na), "Undefined subroutine") +#endif + ) die_object(aTHX_ ERRSV); } } else { @@ -758,15 +771,21 @@ return root; } - +#define TT_BUFF_SIZE 64 /* return [ map { s/\(.*$//; ($_, 0) } split(/\./, $str) ]; */ static AV *convert_dotted_string(pTHX_ const char *str, I32 len) { + char prealloc[64]; /* small pre allocated buffer */ AV *av = newAV(); char *buf, *b; int b_len = 0; - New(0, buf, len + 1, char); + if ( len + 1 < TT_BUFF_SIZE ) { /* use the pre allocated buffer */ + buf = prealloc; + } else { /* need a malloc */ + New(0, buf, len + 1, char); + } + if (!buf) croak(TT_STASH_PKG ": New() failed for convert_dotted_string"); @@ -786,7 +805,8 @@ } } - Safefree(buf); + if (buf != prealloc) Safefree(buf); + return (AV *) sv_2mortal((SV *) av); }