HTML-Template-Compiled-1.003 000755 001750 001750 0 12712112457 14637 5 ustar 00tina tina 000000 000000 README 100644 001750 001750 625 12712112457 15563 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003
This archive contains the distribution HTML-Template-Compiled,
version 1.003:
Template System Compiles HTML::Template files to Perl code
This software is copyright (c) 2015 by Tina Müller.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This README file was generated by Dist::Zilla::Plugin::Readme v5.043.
Changes 100644 001750 001750 47353 12712112457 16247 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 Revision history for Perl module HTML::Template::Compiled.
1.003 2016-05-03 14:06:00
- Bugfix: prevent unexpected Data::Dumper config to mess with the output
(github issue #10 bittrine++)
- Fixed typos (github PR #9 zhouzhen1++)
- Storable >= 2.05 (CODE refs)
- fixed issue with parallel testing
1.002 Sun Jul 26 01:43:26 CEST 2015
- Regular release, see developer versions
1.001_002 Tue Jul 21 20:48:37 CEST 2015
- Bugfix: Issues with global_vars #6, #7 (rpv-tomsk++)
- Changed to Dist::Zilla
1.001_001 Tue May 21 00:50:22 CEST 2013
- New option: optimize
- Minor optimization
1.001 Sat May 4 12:49:44 CEST 2013
- Regular release, see developer versions for changes
1.000_006 Fri Jan 25 22:57:24 CET 2013
- Minor optimizations for file cache
- Remove ::Plugin::DHTML (own distribution)
1.000_004 Thu Jan 10 00:29:59 CET 2013
- New features: added options warnings and line_info
1.000_003 Mon Dec 31 19:05:54 CET 2012
- fix test
1.000_002 Sat Dec 1 21:06:57 CET 2012
- make parallel testing possible
- remove ::Plugin::NumberFormat (has its own distribution now)
1.000_001 Tue Nov 27 19:55:00 CET 2012
- Minor optimizations
- New Feature: attribute sortby for TMPL_EACH
1.000 Tue Nov 13 20:45:44 CET 2012
- regular release
0.99_001 Sat Aug 4 17:32:03 CEST 2012
- Bugfix: reloading changed includes didn't always work
0.99 Mon Jul 2 21:48:39 CEST 2012
- fixed tests (deprecation in perl 5.17 and Data::TreeDumper prereq)
- also see developer version changes
0.98_003 Sun Jun 10 19:25:15 CEST 2012
- removed test cache directory from distribution
- added some modules to recommends
0.98_002 Wed Jun 6 20:43:05 CEST 2012
- Workaround for using var names with dollars:
local $HTML::Template::Compiled::Compiler::DISABLE_NEW_ALIAS = 1;
0.98_001 Mon Jun 4 23:53:45 CEST 2012
- require perl 5.8.1
- Hotfix for include_var and file caching
0.98 Mon Jun 4 18:18:40 CEST 2012
- IMPORTANT: Change: use aliases (alias=..., SET_VAR) via $aliasname.
USE_VARS will be removed in the future. Old alias syntax still works
for now.
0.97_006 Sun Jun 3 19:26:50 CEST 2012
- new plugin HTML::Template::Compiled::Plugin::NumberFormat
0.97_005 Sat Jun 2 12:47:06 CEST 2012
- New feature: option cache_debug
- New feature: TMPL_WRAPPER
- Another bugfix for search_path_on_include
0.97_004 Sun May 20 18:38:32 CEST 2012
- Change: Implemented searching the path and search_path_on_include like
in HTML::Template (finally) and add an additional value. PLEASE TEST!
- Improved file cache performance
- Bugfix: old bug with invalid tags in noparse, verbatim, comment
- Remove old Storable workaround (0.94_002)
0.97_001 Thu May 17 14:54:30 CEST 2012
- fix HTML::Template::Compiled::Classic: allow every character in template
var names (RT 70676)
- New option expire_time instead of global HTML::Template::Compiled->ExpireTime
- Added loop context vars __even__, __outer__
- Change: removed documentation of class methods ->CaseSensitive,
->SearchPathOnInclude, ->UseQuery - will be deprecated
- Added strict option
0.97 Tue May 8 19:19:00 CEST 2012
- regular release, see changes from dev version below
0.96_005 Sun May 6 16:24:54 CEST 2012
- fix t/25_expr.t number of skip tests
0.96_004 Sat May 5 15:56:27 CEST 2012
- Minor bugfix USE_VARS, module version numbers
- Bugfix caching: under certain circumstances some template includes
were not added to memory cache and reloaded from file cache very time
0.96_003 Fri May 4 17:09:19 CEST 2012
- Improved Feature: expressions like .path.to.hash{var}
0.96_002 Sun Apr 22 19:23:33 CEST 2012
- Changed/New feature: chomp whitespaces globally or in tags
- New feature: SET_VAR (and USE_VARS)
0.96_001 Sat Apr 21 23:17:59 CEST 2012
- New feature: allow expressions like .path.to.hash{var}
- Bugfix: allow more than two binary operands in H::T::C::Expr
0.96 Mon Nov 21 20:37:22 CET 2011
- fixed 05_filter.t
- fixed t/01_HTML-Template-Compiled.t (problems when test takes longer then
cache expiration)
0.95_003 Sat Nov 12 15:12:02 CET 2011
- Bugfix: Reload includes of includes (required change of caching mechanism -
please report any issues if you have problems with caching)
- New Escape: 'IJSON'
- Deprecated the use options 'speed', 'compatible' and 'short'
0.95_002 Mon Oct 31 21:00:51 CET 2011
- HTML::Template Compatibility: lowercase instead of uppercase
parameters when case_sensitive 0
0.95_001 Sun Aug 28 19:02:00 CEST 2011
- Bugfix: escape=js escapes backslash now (RT 66463)
- Bugfix: H::T::C::Classic ignored case_sensitive (RT 70412)
- Added Template::AutoFilter to bench.pl
0.95 Wed Apr 27 20:48:13 CEST 2011
- Just moving developer release to regular release
0.94_002 Thu Aug 19 23:43:41 CEST 2010
- Fix for 5.12: ignore Storable fatal error abour regexp items.
thanks to Daniel Tašov for the hint. just a workaround for now
0.94_001 Wed Sep 16 19:41:01 CEST 2009
- Fix memory leak when compiling
Thanks to Henrik Tougaard
0.94 Thu Sep 10 19:55:04 CEST 2009
- Fix test
0.93_003
- remove HTML::Entities dependency
0.93_002 Fri Aug 21 14:47:09 CEST 2009
- Bugfix: Expressions were only activated when using default
tagstyle; using tagstyle would overwrite use_expression option
- New feaure: in TMPL_LOOP and TMPL_EACH you can set context="list"
This is necessary if you call a method that returns a list
instead of array- or hashref
0.93_001 Sun Jul 12 17:03:16 CEST 2009
- Bugfix: single quoted attributes did not allow double quotes in content
http://rt.cpan.org/Public/Bug/Display.html?id=43591
- Bugfix: global vars weren't fetched correctly if case_sensitive off
http://rt.cpan.org/Public/Bug/Display.html?id=43591
- Bugfix: add missing package line
http://rt.cpan.org/Public/Bug/Display.html?id=45081
- Bugfix: added md5sum of paths to cache key so different templates with
the same name are found
http://rt.cpan.org/Public/Bug/Display.html?id=28606
- Bugfix: expressions didn't work in every tag
0.93 Mon Nov 3 20:03:07 CET 2008
- New Feature: sort-Attribute for TMPL_EACH
- Change: Allow TMPL_LOOP over an overloaded @{} object
(and TMPL_EACH over %{})
- Bugfix: closing IF_DEFINED was not recognized
http://rt.cpan.org/Ticket/Display.html?id=40341
0.92_001 Sun Aug 10 18:53:48 CEST 2008
- Bugfix: ESCAPE didn't work always correctly since 0.92
0.92 Sat Jul 26 13:02:28 CEST 2008
- Change: code in TMPL_WITH is now only executed if the var is defined
- New Feature: Option no_includes like in HTML::Template
- For changes since 0.91 see 0.91_001, 0.91_002, 0.91_003
0.91_003 Mon Jun 16 23:03:46 CEST 2008
- New feature: Debug compiled code (see method debug_code)
- Bufix: __last__ and __inner__ in included templates (thanks
to Henrik Tougaard for the patch)
- Bugfix: Ternary operator didn't produce correct syntax always
(also thanks to Henrik Tougaard)
- New feature: Expressions like in HTML::Template::Expr
0.91_002
- Bugfix: option objects
- Bugfix: object plugins
0.91_001
- Bugfix: TMPL_IF_DEFINED without TMPL_ELSE
http://rt.cpan.org/Public/Bug/Display.html?id=33383
- New feature: filename debugging (option debug_file)
- New feature: option objects (strict, nostrict, 0)
0.91 Thu Jan 24 21:50:20 CET 2008
- Fixed tests: utf8 problems with perl 5.8.[0-7]
- Change: open_mode without leading '<'
0.90 Thu Nov 15 00:39:35 CET 2007
- New Feature: use objects as plugins
- New Feature: option open_mode (e.g. '<:utf8') (thanks to Moritz
Lenz and Chris Hagglund)
- Fixed tests: permission problems on Win32
0.89 Mon Oct 29 21:50:40 CET 2007
- New Feature: BREAK attribute for loops (see docs)
- Bugfix: utf8 in scalarrefs (thanks to Chris Hagglund)
- Experimental feature: chomp newlines before/after tags. See docs.
0.88 Mon Sep 10 22:05:44 CEST 2007
- Bugfix: file-caching and Storable need B::Deparse >= 0.61.
Checking for proper version now.
- Fix: broken test
- Bugfix: avoid warnings when using html escape
- Bugfix: using more than one plugin
http://rt.cpan.org/Ticket/Display.html?id=28764
- Bugfix Plugin::XMLEscape: use numeric entities
0.87 Mon Jul 30 22:46:31 CEST 2007
- Change: file-caching now stores as Storable. If you get problems
with file-caching please report and set $HTML::Template::Compiled::Storable to 0
as a workaround.
- Change: escape=HTML now only escapes '"&<>
http://rt.cpan.org/Public/Bug/Display.html?id=27446
- Change: allow every character for TMPL_* NAMEs
http://rt.cpan.org/Ticket/Display.html?id=28094
- Bugfix: ALIAS did only work for simple varnames
http://rt.cpan.org/Ticket/Display.html?id=28430
- Change: in future versions you should use file_cache and
file_cache_dir like in HTML::Template
0.86 Mon Jun 11 22:38:04 CEST 2007
- Experimental Feature: use Storable for filecaching (set
$HTML::Template::Compiled::Storable to 1 if you want to test it.
It should be 1.5-2 times as fast as normal filecaching)
- Fix: a test didn't skip if necessary
- utf8 in templates (you probably need Encode (and thus 5.8) for that)
- Fix: recursive includes didn't really work because of compile-time
instead of runtime check
0.85 Sun Apr 15 16:15:22 CEST 2007
- New Feature: JOIN attribute for loop-tag
- Fix: uri_escape_utf8 for parameters in utf8
- Fix for DBIx::Class objects ('can' method doesn't work here like expected)
- Fix: Allow <%= array_of_arrays[0][0] %>
- New Feature: get count of array elements <%= array# %>
0.84 Sun Feb 11 15:43:38 CET 2007
- Bugfix: includes in var includes didn't expire cache
- Bugfix: tagstyle and use_perl weren't correctly passed to includes
when using filecache
- Bugfix: plugins weren't safed in file cache
0.83 Tue Nov 28 22:59:06 CET 2006
- Added Feature: TMPL_EACH
- Added missing plugin feature
0.82 Mon Nov 6 21:25:23 CET 2006
- Added: shorter plugins (omit the HTML::Template::Compiled::Plugin)
- Added Feature: TMPL_INCLUDE_STRING
- Added Feature: TMPL_PERL for including perl-code
0.81 Fri Nov 3 22:48:05 CET 2006
- Minor change in plugin code
0.80 Sun Oct 15 16:39:02 CEST 2006
- Bugfix: characters like '-' in lead to
compilation errors
- Bugfix: accessing array elements like didn't work
0.79 Sat Oct 7 20:36:55 CEST 2006
- Change: instead of you must
now use query(name => ['FOO', 'BAR'])
- Bugfix: query() now also reports included vars like H::T does
0.78 Wed Oct 4 21:22:09 CEST 2006
- Bugfix: endless loop when using file cache
- Bugfix: correctly use cache attribute with filecache
0.77 Mon Oct 2 18:35:52 CEST 2006
- fixed META.yaml (was broken by E::MakeMaker)
0.76 Mon Oct 2 18:15:29 CEST 2006
- Change: HTC::Classic: TMPL_IF arrayref will be true if arrayref contains elements
- Change: __odd__, __first__, __count__ and __index__ work in TMPL_WHILE
- Bugfix: path attribute
- Change: deprecate option dumper (use plugin instead)
0.75 Thu Sep 14 22:42:19 CEST 2006
- Bugfix of bug in 0.74: search_path_on_include didn't work
0.74 Wed Sep 13 20:51:04 CEST 2006
- Internal Changes
- Security fix: Escape dangerous characters in template
- Change: default for search_path_on_include is now 0 like in H::T
- added examples/objects.pl
0.73 Sat Aug 26 16:07:57 CEST 2006
- Bugfix: in 0.72 only __first__ worked, but not __FIRST__
- Change: query() now also reports INCLUDE_VARs
- New feature: __index__ loop variable
- New feature: Plugins for escape-attribute
0.72 Fri Aug 18 22:16:35 CEST 2006
- Documentation: Debugging and Escaping functions are now documented
in HTML::Template::Compiled::Utils (Mark Stosberg)
- Change: Remove deprecated TMPL_IF DEFINED
- Change: HTC will die if you use wrong syntax in tags (like H::T)
- Bugfix: HTML::Template::Compiled::Lazy and query()
- Bugfix: loop variables should survive different template files
0.71 Thu Jul 13 20:54:44 CEST 2006
- Change: dropped TMPL_LOOP_CONTEXT (not really useful)
- Bug Fix: Filters didn't work correctly when used with file caching
- Change: deprecate options
method_call, deref and formatter_path. You must use inheritance
now instead
0.70 Wed Jul 5 21:12:05 CEST 2006
- Bug Fix: php-tag style wasn't parsed
- New Feature: lazy loading with HTML::Template::Compiled::Lazy
- various documentation fixes
- use ALIAS with TMPL_WHILE
0.69 Sun Jul 2 19:45:35 CEST 2006
- Bug Fix: Includes didn't work always correctly in scalarref
- Bug Fix: Allow 'absolute' filenames that are relative to attribute path
- Bug Fix: Empty path didn't work properly
- Bug Fix: make inheritance possible
- Change: new class HTML::Template::Compiled::Classic for features that
can't be used with HTML::Template::Compiled features at the same time
0.68 Wed Jun 21 20:38:05 CEST 2006
- New Feature: ESCAPE=JS was still missing
- Bug Fix: parameters stayed in memory cache
- Documentation fix
0.67 Wed Jun 7 22:19:05 CEST 2006
- Bug Fix: stack for global_vars wrong when using if-tag
http://rt.cpan.org/Ticket/Display.html?id=19662
- Bug Fix: preloading did not recompile outdated templates
- Change: undefined files via TMPL_INCLUDE_VAR don't let script die
- Change: Deprecated setting global variables directly, they must be changed
by class-methods:
$ENABLE_SUB => EnableSub(bool)
$CASE_SENSITIVE_DEFAULT => CaseSensitive(bool)
$SEARCHPATH => SearchPathOnInclude(bool)
$DEFAULT_QUERY => UseQuery(bool)
$NEW_CHECK => ExpireTime(seconds)
- Documentation: explain case_sensitive and use_query better
http://rt.cpan.org/Public/Bug/Display.html?id=19686
0.66 Sun Jun 4 03:49:58 CEST 2006
- Bug Fix: global_vars didn't work correctly with file-caching
- Bug Fix: there was no output when last characters in template are a tag.
- Bug Fix: calling param(%emptyhash) caused error-message
0.65 Fri Jun 2 10:10:06 CEST 2006
- Bug Fix: Documentation error broke pod
0.64 Thu Jun 1 23:54:32 CEST 2006
- Bug Fix: undefined filename and INCLUDE_VAR
- New Feature: alias
- Change: TMPL_IF DEFINED deprecated
- Change: TMPL_INCLUDE VAR from deprecated to forbidden
- New Feature: Define your own tagstyles
0.63 Sat Apr 29 02:39:30 CEST 2006
- Bug Fix: info for query() got lost with file caching
- New Feature: TMPL_WHILE
- Bug Fix: __vars__ when not using loop_context_vars
- Bug Fix: TMPL_CASE wasn't rendered correctly since 0.61
0.62 Wed Apr 26 23:36:13 CEST 2006
- New Feature: added method precompile
- New Feature: implemented query() (from HTML::Template)
0.61 Sat Apr 22 19:34:32 CEST 2006
- Bug Fix: global_vars and variables that are never set
http://rt.cpan.org/Public/Bug/Display.html?id=17851
- Change: allow CASE default in a list of other strings
- Bug Fix: weird endless loop when using wrong tags
0.60 Sun Feb 26 18:46:07 CET 2006
- Clarified docs for TMPL_WITH to explain interaction with global_vars
- New Feature: TMPL_VERBATIM
- Bug Fix: error when double TMPL_ELSE
- New feature: global_vars => 2
0.59 Tue Jan 3 19:40:46 CET 2006
- $UNTAINT
- All the "new_" constructor shortcuts were added from HTML::Template, with
tests for each. Also, the type/source option syntax to new() is now
supported. Tests were added for all these, which were generally missing from
the HTML::Template test suite.
- Bug Fix: Code and Tests were were added to make sure that calls to param()
accumulate data, like HTML::Template works.
- Bug Fix: embedded newlines
- New Feature: new 'default_escape' option for compatibility with HTML::Template 2.8
- Added query() tests from HTML::Template suite. (Currently TODO)
- Change: use dot notation for mehtod calls and dereference
- Change: literal dots in var names work now; you can't use -> for method calling
any more, just use the dot
0.58 Sun Dec 11 23:20:35 CET 2005
- fixed test with html entities
- use H::T::C speed => 1
- tmpl_include_var
- TMPL_LOOP_CONTEXT
0.57 Wed Dec 7 15:54:05 CET 2005
- tmpl_comment doesn't output
- tmpl_noparse does, though
- various pod- and test-fixes
0.56 Wed Dec 7 01:46:21 CET 2005
- some include and scalarref issues fixed
-
- ,
0.55 Wed Nov 23 22:36:58 CET 2005
- search_path_on_include
0.54 Wed Nov 23 21:21:49 CET 2005
- fixed path issues
- better handling of unbalanced tags
0.53 Thu Oct 6 22:12:53 CEST 2005
- fixed another issue with filter
- bugfix preload
0.52 Mon Oct 3 18:34:19 CEST 2005
- bugfix with nonexistant templates and deep recursion
- bugfix path and filecache
- bugfix with filter (subrefs)
- added tmpl_if defined
0.51 Mon Oct 3 00:43:31 CEST 2005
- clear_filecache
- fixed tmpl_elsif, line_numbers
- preload
0.50 Sat Oct 1 01:16:09 CEST 2005
- added formatter
- added global_vars
0.49 Sun Sep 25 23:04:38 CEST 2005
- fixed 05_out_fh.t
- dynamic includes
0.48 Tue Sep 20 23:54:56 CEST 2005
- compatible via use statement
0.47 Tue Sep 20 00:43:37 CEST 2005
- output($fh)
- filter
0.46 Sat Sep 17 17:01:01 CEST 2005
- minor internal issues
- enable subref vars
- fixed __odd__
- recursive include limit, thanks sam
0.45 Fri Sep 16 00:20:07 CEST 2005
- param("var")
0.44 Thu Sep 8 20:56:53 CEST 2005
- arrayref
0.43 Wed Sep 7 21:11:28 CEST 2005
- scalarref
- filehandle
0.42 Fri Sep 2 01:51:14 CEST 2005
- add: HTML::Template::Compiled::Plugin::DHTML
0.41 Sat Aug 27 12:07:08 CEST 2005
- test failed because of missing cache dir
0.40 Sat Aug 27 03:05:00 CEST 2005
- more internal changes
0.39 Mon Aug 22 22:27:52 CEST 2005
- bug with caching fixed
0.38 Mon Aug 22 21:02:30 CEST 2005
- __counter__ now correct
- more internal changes
0.37 Mon Aug 22 00:31:58 CEST 2005
- case_insensitive removed, use only case_sensitive
- internal changes
0.36 Sun Aug 21 03:41:45 CEST 2005
- newlines in tags
- ESCAPE=DUMP, chaining ESCAPE
- DEFAULT=...
- option dumper
0.34 Fri Aug 19 19:58:56 CEST 2005
- minor bugs, removed debugging statement
0.32 Thu Aug 18 23:52:33 CEST 2005
- fixed caching bug
0.31 Thu Aug 18 22:48:22 CEST 2005
- better object syntax
0.30 Mon Aug 15 01:55:29 CEST 2005
- some internal optimizations
- case_insensitive for those who want it
0.29 Sun Aug 14 22:51:30 CEST 2005
- examples directory with bechmark of 4 template modules
0.28 Fri Aug 12 23:32:44 CEST 2005
- case insensitive TMPL_*
0.27 Thu Aug 4 00:06:34 CEST 2005
- added <%tag%> feature
0.26 Thu Jul 28 22:11:48 CEST 2005
- some docs
- fixed regex and objects
0.25 Wed Jul 27 23:18:06 CEST 2005
- undefstring userdefined
- fixed TMPL_IF method
0.24 Wed Jul 20 20:57:00 CEST 2005
- fixed
0.23 Mon Jul 18 00:03:08 CEST 2005
- first step for rendering objects,
documentation will follow. (yes, promised =)
0.22 Sun Jul 17 19:15:22 CEST 2005
- bugfix TMPL_INCLUDE
0.21 Fri Jul 1 21:48:51 CEST 2005
- fixed ESCAPE=HTML|URI
- implemented
0.20 Sun Jun 26 18:04:11 CEST 2005
- Errors for wrong balanced tags
0.19 Sun Jun 26 15:02:37 CEST 2005
- bugfix NAME=ONE.TWO
- TMPL_WITH
- Dumper
0.18 Sun Jun 26 12:36:15 CEST 2005
- small bugfixes for older perl versions
- typos
- TMPL_ELSIF
0.17 Mon Jun 20 23:30:43 CEST 2005
- small bugfixes, warnings
- doc
0.16 Mon May 16 15:42:07 CEST 2005
- TMPL_WITH
- bugfix with .root
0.15 Mon May 16 15:18:42 CEST 2005
- bugfix
0.14 Mon May 16 14:27:31 CEST 2005
- bug in caching removed
- TMPL_VAR .root
- TMPL_VAR key.path.with.numbers.23
0.13 Mon May 2 23:49:08 CEST 2005
- clear_cache()
0.12 Mon May 2 22:18:35 CEST 2005
- remove warnings
0.10 Mon Apr 18 22:06:10 CEST 2005
- HTML_TEMPLATE_ROOT
- caching
- loop_context_vars
0.09 Fri Apr 15 00:31:23 CEST 2005
-
- caching improved (expire)
0.06 Sat Feb 26 00:45:31 CET 2005
- ESCAPE=HTML
0.05 Sat Feb 26 00:31:21 CET 2005
- TMPL_INCLUDE
0.04 Fri Feb 25 00:29:44 CET 2005
- caching improved
0.03 Thu Feb 24 23:17:10 CET 2005
- Quote Handling (NAME="var")
0.02 Tue Feb 22 01:18:23 CET 2005
- fixed bugs, caching half implemented
0.01 Sun Feb 20 17:44:07 2005
- original version; created by h2xs 1.23 with options
-AX -n HTML::Template::Compiled
LICENSE 100644 001750 001750 43655 12712112457 15762 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 This software is copyright (c) 2015 by Tina Müller.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2015 by Tina Müller.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2015 by Tina Müller.
This is free software, licensed under:
The Artistic License 1.0
The Artistic License
Preamble
The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.
Definitions:
- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.
6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
dist.ini 100644 001750 001750 422 12712112457 16342 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 name = HTML-Template-Compiled
author = Tina Müller
license = Perl_5
copyright_holder = Tina Müller
copyright_year = 2015
version = 1.003
[@Basic]
[AutoPrereqs]
[Prereqs]
Storable = 2.05
[Repository]
[OverridePkgVersion]
[MetaProvides::Package]
META.yml 100644 001750 001750 7640 12712112457 16200 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 ---
abstract: 'Template System Compiles HTML::Template files to Perl code'
author:
- 'Tina Müller '
build_requires:
File::Copy: '0'
Test::More: '0'
lib: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.043, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: HTML-Template-Compiled
provides:
HTML::Template::Compiled:
file: lib/HTML/Template/Compiled.pm
version: '1.003'
HTML::Template::Compiled::Classic:
file: lib/HTML/Template/Compiled/Classic.pm
version: '1.003'
HTML::Template::Compiled::Compiler:
file: lib/HTML/Template/Compiled/Compiler.pm
version: '1.003'
HTML::Template::Compiled::Compiler::Classic:
file: lib/HTML/Template/Compiled/Compiler/Classic.pm
version: '1.003'
HTML::Template::Compiled::Exception:
file: lib/HTML/Template/Compiled/Exception.pm
version: '1.003'
HTML::Template::Compiled::Expr:
file: lib/HTML/Template/Compiled/Expr.pm
version: '1.003'
HTML::Template::Compiled::Expression:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::Conditional:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::Defined:
file: lib/HTML/Template/Compiled/Expression/Expressions.pm
version: '1.003'
HTML::Template::Compiled::Expression::Elsif:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::Expressions:
file: lib/HTML/Template/Compiled/Expression/Expressions.pm
version: '1.003'
HTML::Template::Compiled::Expression::Function:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::Literal:
file: lib/HTML/Template/Compiled/Expression/Expressions.pm
version: '1.003'
HTML::Template::Compiled::Expression::Method:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::SubrefCall:
file: lib/HTML/Template/Compiled/Expression.pm
version: '1.003'
HTML::Template::Compiled::Expression::Ternary:
file: lib/HTML/Template/Compiled/Expression/Expressions.pm
version: '1.003'
HTML::Template::Compiled::Filter:
file: lib/HTML/Template/Compiled/Filter.pm
version: '1.003'
HTML::Template::Compiled::Formatter:
file: lib/HTML/Template/Compiled/Formatter.pm
version: '1.003'
HTML::Template::Compiled::Lazy:
file: lib/HTML/Template/Compiled/Lazy.pm
version: '1.003'
HTML::Template::Compiled::Parser:
file: lib/HTML/Template/Compiled/Parser.pm
version: '1.003'
HTML::Template::Compiled::Plugin::XMLEscape:
file: lib/HTML/Template/Compiled/Plugin/XMLEscape.pm
version: '1.003'
HTML::Template::Compiled::Token:
file: lib/HTML/Template/Compiled/Token.pm
version: '1.003'
HTML::Template::Compiled::Token::Text:
file: lib/HTML/Template/Compiled/Token.pm
version: '1.003'
HTML::Template::Compiled::Token::close:
file: lib/HTML/Template/Compiled/Token.pm
version: '1.003'
HTML::Template::Compiled::Token::open:
file: lib/HTML/Template/Compiled/Token.pm
version: '1.003'
HTML::Template::Compiled::Token::single:
file: lib/HTML/Template/Compiled/Token.pm
version: '1.003'
HTML::Template::Compiled::Utils:
file: lib/HTML/Template/Compiled/Utils.pm
version: '1.003'
requires:
B::Deparse: '0'
Carp: '0'
Data::Dumper: '0'
Digest::MD5: '0'
Encode: '0'
Exporter: '0'
Fcntl: '0'
File::Basename: '0'
File::Spec: '0'
HTML::Entities: '0'
Parse::RecDescent: '0'
Scalar::Util: '0'
Storable: '2.05'
URI::Escape: '0'
base: '0'
constant: '0'
overload: '0'
strict: '0'
vars: '0'
warnings: '0'
resources:
repository: git://github.com/perlpunk/HTML-Template-Compiled.git
version: '1.003'
MANIFEST 100644 001750 001750 5243 12712112457 16055 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.043.
Changes
LICENSE
MANIFEST
MANIFEST.SKIP
META.yml
Makefile.PL
README
dist.ini
examples/bench.pl
examples/bench_mem.pl
examples/included.htc
examples/included.htcc
examples/included.tst
examples/included.tt
examples/included.xslate
examples/objects.html
examples/objects.pl
examples/test.htc
examples/test.htc.20
examples/test.htcc
examples/test.tst
examples/test.tt
examples/test.xslate
lib/HTML/Template/Compiled.pm
lib/HTML/Template/Compiled/Classic.pm
lib/HTML/Template/Compiled/Compiler.pm
lib/HTML/Template/Compiled/Compiler/Classic.pm
lib/HTML/Template/Compiled/Exception.pm
lib/HTML/Template/Compiled/Expr.pm
lib/HTML/Template/Compiled/Expression.pm
lib/HTML/Template/Compiled/Expression/Expressions.pm
lib/HTML/Template/Compiled/Filter.pm
lib/HTML/Template/Compiled/Formatter.pm
lib/HTML/Template/Compiled/Lazy.pm
lib/HTML/Template/Compiled/Parser.pm
lib/HTML/Template/Compiled/Plugin/XMLEscape.pm
lib/HTML/Template/Compiled/Reference.pod
lib/HTML/Template/Compiled/Token.pm
lib/HTML/Template/Compiled/Utils.pm
t/01_HTML-Template-Compiled.t
t/03_param.t
t/04_out_fh.t
t/05_filter.t
t/06_dyn_include.t
t/07_formatter.t
t/08_global_vars.t
t/09_wrong.t
t/10_if_else.t
t/12_path.t
t/13_loop.t
t/14_scalarref.t
t/15_comment.t
t/16_switch.t
t/17_escape.t
t/18_objects.t
t/19_query.t
t/20_precompile.t
t/21_while.t
t/22_pod.t
t/23_tagstyles.t
t/24_pod_cover.t
t/26_expr.t
t/27_chomp.t
t/28_perl.t
t/29_encoding.t
t/30_arrays.t
t/31_recurse.t
t/32_compile_plugin.t
t/33_plugins.t
t/34_loop_context_vars.t
t/35_debug.t
t/36_default.t
t/37_with.t
t/38_vars.t
t/39_line_info.t
t/40_data_dumper.t
t/HTC_Plugin.pm
t/HTC_Utils.pm
t/new_shortcuts.t
t/templates/dyn_include.htc
t/templates/dyn_included1.htc
t/templates/dyn_included2.htc
t/templates/file_debug.html
t/templates/filter.htc
t/templates/filter_included.htc
t/templates/formatter.htc
t/templates/include.html
t/templates/include_perl.htc
t/templates/include_w_global.htc
t/templates/line_info1.html
t/templates/loop_included.tmpl
t/templates/out_fh.htc
t/templates/precompiled1.tmpl
t/templates/query-include.tmpl
t/templates/query-include2.tmpl
t/templates/query-test.tmpl
t/templates/query-test2.tmpl
t/templates/recurse.html
t/templates/simple.tmpl
t/templates/songs.html
t/templates/subdir/a/file1.html
t/templates/subdir/a/file2.html
t/templates/subdir/a/path.html
t/templates/subdir/a/path2.html
t/templates/subdir/a/path2_inc.html
t/templates/subdir/b.html
t/templates/subdir/file_debug.html
t/templates/subdir2/dummy.tmpl
t/templates/user_template.html
t/templates/var_include.html
t/templates/wrapped.html
t/templates/wrapper.html
t/templates/wrapper2.html
t/templates/wrong.html
t 000755 001750 001750 0 12712112457 15023 5 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 22_pod.t 100644 001750 001750 313 12712112457 16412 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use strict;
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
my @poddirs = qw( examples lib );
all_pod_files_ok( all_pod_files( @poddirs ) );
28_perl.t 100644 001750 001750 1630 12712112457 16623 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use lib 't';
use Test::More tests => 2;
use_ok('HTML::Template::Compiled');
use HTC_Utils qw($cache $tdir &cdir);
{
my $text = <<'EOM';
[%perl __OUT__ "template: __HTC__";
my $test = __ROOT__->{foo};
__OUT__ $test;
%]
[%loop loop%]
[%perl __OUT__ __INDEX__ . ": " . __CURRENT__->{a}; %]
[%/loop loop%]
[%include include_perl.htc %]
EOM
HTML::Template::Compiled->ExpireTime(0);
my $htc = HTML::Template::Compiled->new(
scalarref => \$text,
use_perl => 1,
path => $tdir,
debug => 0,
tagstyle => [qw(-classic -comment +asp +tt)],
cache => 0,
search_path_on_include => 1,
);
$htc->param(
foo => 23,
loop => [{ a => 'A' },{ a => 'B' }],
);
my $out = $htc->output;
#print "out: $out\n";
cmp_ok($out, '=~',
qr{template: HTML::Template::Compiled.*23.*0: A.*1: B}s, "perl-tag");
}
38_vars.t 100644 001750 001750 1644 12712112457 16642 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t
use Test::More tests => 3;
BEGIN { use_ok('HTML::Template::Compiled') };
use lib 't';
use
HTC_Utils qw($cache $tdir &cdir);
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%set_var FOO value=.root.foo %>
<%= FOO %>
<%include var_include.html %>
EOM
debug => 0,
loop_context_vars => 1,
path => $tdir,
);
$htc->param(
root => {
foo => 23,
},
);
my $out = $htc->output;
$out =~ s/\s+//g;
cmp_ok($out, "eq", "2323", "set_var, use_vars");
#print "out: $out\n";
}
{
eval {
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%set_var name="foo bar" value=.root %>
EOM
debug => 0,
loop_context_vars => 1,
path => $tdir,
);
};
my $error = $@;
# warn __PACKAGE__.':'.__LINE__.": $error\n";
cmp_ok($error, "=~", ".*Syntax error in .*", "invalid set_var");
}
13_loop.t 100644 001750 001750 10223 12712112457 16642 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use Test::More tests => 10;
BEGIN { use_ok('HTML::Template::Compiled') };
use lib 't';
use HTC_Utils qw($tdir &cdir &create_cache &remove_cache);
my $cache_dir = "cache13";
$cache_dir = create_cache($cache_dir);
for my $new_alias (0,1) {
local $HTML::Template::Compiled::Compiler::DISABLE_NEW_ALIAS = 1 unless ($new_alias);
my $htc = HTML::Template::Compiled->new(
scalarref => \<<"EOM",
EOM
debug => 0,
loop_context_vars => 1,
cache => 0,
);
my $array = [];
my $array2 = [];
if ($new_alias) {
$array = [qw(a b c)];
$array2 = [{ foo => 'a' }, { foo => 'b' }, { foo => 'c' }];
}
else {
$array = [{ '$iterator' => 'a' }, { '$iterator' => 'b' }, { '$iterator' => 'c' }];
$array2 = [{ '$iterator' => { foo => 'a' } }, { '$iterator' => { foo => 'b' } }, { '$iterator' => { foo => 'c' } }];
}
$htc->param(
array => $array,
array2 => $array2,
);
my $out = $htc->output;
$out =~ s/\s+//g;
if ($new_alias) {
cmp_ok($out, "eq", "aabbccaabbcc", "tmpl_loop array alias=iterator");
}
else {
cmp_ok($out, "=~", qr{HASH\(.*\)aHASH\(.*\)bHASH\(.*\)cabc}, "tmpl_loop array alias=iterator");
}
#print "out: $out\n";
}
my $text1 = <<'EOM';
|
(outer:)
(even:)
EOM
for (0,1) {
my $htc = HTML::Template::Compiled->new(
scalarref => \$text1,
debug => 0,
loop_context_vars => $_,
);
$htc->param(array => [
{x=>"a","__counter__"=>"A","__outer__"=>"OUTER"},
{x=>"b","__counter__"=>"B","__even__"=>"EVEN"},
{x=>"c","__counter__"=>"C",},
{x=>"d","__counter__"=>"D",,"__even__"=>"EVEN"},
{x=>"e","__counter__"=>"E","__outer__"=>"OUTER"},
]);
my $out = $htc->output;
$out =~ s/\s+//g;
my $exp;
if ($_ == 1) {
$exp = "|(outer:1)1a|(even:1)2b|3c|(even:1)4d|(outer:1)5e";
}
else {
$exp = "|(outer:OUTER)Aa|(even:EVEN)Bb|Cc|(even:EVEN)Dd|(outer:OUTER)Ee";
}
#print "($out)($exp)\n";
cmp_ok($out, "eq", $exp, "loop context");
}
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<%= _ %><%/loop list %>
EOM
debug => 0,
);
$htc->param(
list => [qw(a b c)]
);
my $out = $htc->output;
$out =~ s/^\s+//;
$out =~ s/\s+\z//;
#print $out, $/;
cmp_ok($out, 'eq','a, b, c', "loop join attribute");
}
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<%= _ %><%if __break__%>.<%/if %><%/loop list %>
EOM
debug => 0,
loop_context_vars => 1,
);
$htc->param(
list => [qw(a b c d e f g h)]
);
my $out = $htc->output;
$out =~ s/^\s+//;
$out =~ s/\s+\z//;
#print $out, $/;
cmp_ok($out, 'eq','abc.def.gh', "loop break attribute");
}
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%loop list %>
<%include loop_included.tmpl %>
<%/loop list %>
EOM
debug => 0,
loop_context_vars => 1,
path => $tdir,
);
$htc->param(
list => [qw(a b c d e f g h)]
);
my $out = $htc->output;
$out =~ s/\s+/ /g;
#print $out, $/;
cmp_ok($out, 'eq',' 0 1 2 3 4 5 6 7 h ', "loop context vars in include");
}
for (0, 1) {
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%loop foo.list %>
<%= a %>
<%/loop foo.list %>
EOM
debug => 0,
loop_context_vars => 1,
path => $tdir,
cache => 0,
file_cache => 1,
file_cache_dir => $cache_dir,
);
$htc->param(
foo => {
list => [{a => 1},{a => 2},{a => 3}],
},
);
my $out = $htc->output;
$out =~ s/\s+/ /g;
#print $out, $/;
cmp_ok($out, 'eq',' 1 2 3 ', "loop " . ($_ ? "after" : "before") . " caching");
}
HTML::Template::Compiled->clear_filecache($cache_dir);
remove_cache($cache_dir);
12_path.t 100644 001750 001750 4206 12712112457 16610 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t # Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl HTML-Template-Compiled.t'
use Test::More tests => 5;
BEGIN { use_ok('HTML::Template::Compiled') };
use File::Spec ();
use lib 't';
use HTC_Utils qw($tdir);
eval {
my $htc = HTML::Template::Compiled->new(
path => [
File::Spec->catfile(qw(t templates_foo)),
$tdir,
],
filename => File::Spec->catfile(qw(a file1.html)),
search_path_on_include => 0,
#debug => 1,
);
};
print "err: $@\n" unless $ENV{HARNESS_ACTIVE};
my $f = File::Spec->catfile(qw/ a file1.html /);
cmp_ok($@, '=~', qr{'\Q$f\E' not found}, "search_path_on_include off");
my $htc = HTML::Template::Compiled->new(
path => ["$tdir/subdir", "$tdir/subdir2"],
filename => File::Spec->catfile(qw(a file1.html)),
search_path_on_include => 1,
#debug => 1,
);
my $out = $htc->output;
$out =~ tr/\r\n//d;
ok(
$out =~ m{Template t/templates/subdir/a/file1.htmlTemplate t/templates/subdir/a/file2.html},
"include form current dir"
);
{
# local $TODO = "path not yet correctly implemented";
my $out = '';
eval {
my $htc = HTML::Template::Compiled->new(
path => File::Spec->catfile(qw(t templates)),
filename => 'subdir/a/path.html',
search_path_on_include => 1,
);
$out = $htc->output;
#warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$out], ['out']);
};
#warn __PACKAGE__.':'.__LINE__.": error? $@\n";
cmp_ok($out, '=~', 'this is t/templates/subdir/b.html', 'search path option on include');
}
{
my $out = '';
eval {
my $htc = HTML::Template::Compiled->new(
path => File::Spec->catfile(qw(t templates)),
filename => 'subdir/a/path2.html',
search_path_on_include => 2,
);
$out = $htc->output;
# warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$out], ['out']);
};
# warn __PACKAGE__.':'.__LINE__.": error? $@\n";
cmp_ok($out, '=~', qr{this is t/templates/subdir/b.html.*this is templates/subdir/a/path2_inc.html}s, 'search current path and path option on include');
}
37_with.t 100644 001750 001750 1267 12712112457 16642 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t # Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl HTML-Template-Compiled.t'
use Test::More tests => 2;
BEGIN { use_ok('HTML::Template::Compiled') };
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%with foo.bar %>
bar:<%= _[0] %>
<%/with foo.bar %>
<%with foo.baz %>
baz:<%= _[0] %>
<%/with foo.baz %>
EOM
debug => 0,
);
$htc->param(
foo => {
bar => [qw/ this and that /],
},
);
my $out = $htc->output;
$out =~ s/\s+//g;
#print $out, $/;
cmp_ok($out, "eq", "bar:this", "global_vars and unset variable");
}
26_expr.t 100644 001750 001750 10354 12712112457 16660 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use lib 't';
use constant TESTS => 28;
use Test::More tests => TESTS + 1;
eval { require Parse::RecDescent; };
my $prd = $@ ? 0 : 1;
use_ok('HTML::Template::Compiled');
use HTC_Utils qw($cache $tdir &cdir);
sub HT_Utils::list { my @a = qw/ a b c /; return @a }
sub HT_Utils::each { my %a = ( a => 1, b => 2 ); return %a }
SKIP: {
skip "No Parse::RecDescent installed", TESTS unless $prd;
use_ok('HTML::Template::Compiled::Expr');
my $htc;
eval {
$htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
[%= expr="(foo.count < 4) && ( foo.count > 2)" %]
EOM
use_expressions => 0,
tagstyle => [qw/ -classic -comment -asp +tt /],
loop_context_vars => 1,
);
};
my $error = $@;
#warn __PACKAGE__.':'.__LINE__.": $@\n";
cmp_ok($error, '=~', qr/\QSyntax error in tag/, "No expressions allowed");
my @tests = (
[ q#[%= expr="(foo.count < 4) && ( foo.count > 2)" %]#, 1],
[ q#[%= expr="(foo.count > 4) && ( foo.count % 2)" %]#, ''],
[ q#[%= expr="lcfirst( .string )" %]#, 'aBC'],
[ q#[%if expr="lcfirst( .string ) eq 'aBC'" %]23[%/if %]#, '23'],
[ q#[%if expr="'string\'' eq 'string\''" %]23[%/if %]#, '23'],
[ q#[%= expr="object.param('foo', .foo.count )" %]#, '424242'],
[ q#[%if expr="0" %]zero[%elsif expr="foo.count < 4" %]< 4[%/if %]#, '< 4'],
[ q#[%loop expr="list_object.list" context="list" %][%= _ %][%/loop %]#, 'abc'],
[ q#[%each expr="list_object.each" context="list" %]k:[%= __key__ %] [%/each %]#, 'k:a k:b '],
[ q#[%= expr=".foo{.name}" %]#, '3'],
[ q#[%= expr=".foo{'count'}" %]#, '3'],
[ q#[%= expr=".columns[.numbers[1]]" %]#, 'founded'],
[ q#[%= expr=".a{'b'}{'c'}" %]#, 'd'],
[ q#[%= expr=".bands[.numbers[1]]{'name'}" %]#, 'deine lakaien'],
[ q#[%with name %][%= expr=".foo{_}" %][%/with %]#, '3'],
[ q#[%= expr="'foo'.(2+5)" %]#, 'foo7'],
[ q#[%= expr=".foo{('count'.2)}" %]#, '22'],
[ q#[%= expr="3 * 4 / 2 + 7" %]#, '13'],
[ q#[%= expr="('2' . '5' ) / 5" %]#, '5'],
[ q#[%= expr="('2' . '4' ) % 20" %]#, '4'],
[ q#[%= expr=".foobar" default="default value" %]#, 'default value'],
[ q#[%loop list %][%= expr=".foo{_}" %] [%/loop %]#, 'foo a foo b foo c foo d '],
[ q#[%loop list alias=item %][%= expr=".foo{$item}" %] [%/loop %]#, 'foo a foo b foo c foo d '],
[ q#[%loop bands alias=band %][%= expr="$band{'name'}" %] [%/loop %]#, 'bauhaus deine lakaien '],
[ q#[%loop bands %][%= expr="_{'name'}" %] [%/loop %]#, 'bauhaus deine lakaien '],
[ q#[%loop bands alias=band %]
[%= __counter__ %].
[%loop .columns alias=column %]
[%= column %]: [%= expr="$band{column}" %]
[%/loop %]
[%/loop %]#, '1. name: bauhaus founded: 1978 2. name: deine lakaien founded: 1985 '],
);
for my $i (0 .. $#tests) {
my $test = $tests[$i];
my ($tmpl, $exp) = @$test;
$tmpl =~ tr/\r\n//d;
my $htc = HTML::Template::Compiled->new(
scalarref => \$tmpl,
use_expressions => 1,
debug => 0,
tagstyle => [qw/ -classic -comment -asp +tt /],
loop_context_vars => 1,
);
my $list_object = bless {}, 'HT_Utils';
$htc->param(
foo => {
count => '3',
count1 => '21',
count2 => '22',
count3 => '23',
a => 'foo a',
b => 'foo b',
c => 'foo c',
d => 'foo d',
},
object => bless ({ foo => 42 }, 'HTC::DUMMY'),
string => 'ABC',
list_object => $list_object,
name => 'count',
list => [qw/ a b c d /],
bands => [
{ name => 'bauhaus', founded => 1978 },
{ name => 'deine lakaien', founded => 1985 },
],
columns => [qw/ name founded /],
numbers => [0,1],
a => { b => { c => 'd' } },
);
my $out = $htc->output;
#print "out: $out\n";
cmp_ok($out, 'eq', $exp, "Expressions $i $tmpl");
}
}
sub HTC::DUMMY::param {
return $_[0]->{ $_[1] } x $_[2]
}
Makefile.PL 100644 001750 001750 3600 12712112457 16671 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.043.
use strict;
use warnings;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Template System Compiles HTML::Template files to Perl code",
"AUTHOR" => "Tina M\x{fc}ller ",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "HTML-Template-Compiled",
"LICENSE" => "perl",
"NAME" => "HTML::Template::Compiled",
"PREREQ_PM" => {
"B::Deparse" => 0,
"Carp" => 0,
"Data::Dumper" => 0,
"Digest::MD5" => 0,
"Encode" => 0,
"Exporter" => 0,
"Fcntl" => 0,
"File::Basename" => 0,
"File::Spec" => 0,
"HTML::Entities" => 0,
"Parse::RecDescent" => 0,
"Scalar::Util" => 0,
"Storable" => "2.05",
"URI::Escape" => 0,
"base" => 0,
"constant" => 0,
"overload" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"File::Copy" => 0,
"Test::More" => 0,
"lib" => 0
},
"VERSION" => "1.003",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"B::Deparse" => 0,
"Carp" => 0,
"Data::Dumper" => 0,
"Digest::MD5" => 0,
"Encode" => 0,
"Exporter" => 0,
"Fcntl" => 0,
"File::Basename" => 0,
"File::Copy" => 0,
"File::Spec" => 0,
"HTML::Entities" => 0,
"Parse::RecDescent" => 0,
"Scalar::Util" => 0,
"Storable" => "2.05",
"Test::More" => 0,
"URI::Escape" => 0,
"base" => 0,
"constant" => 0,
"lib" => 0,
"overload" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
35_debug.t 100644 001750 001750 6700 12712112457 16750 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use lib 't';
use Test::More tests => 9;
use_ok('HTML::Template::Compiled');
use HTC_Utils qw($tdir &cdir &create_cache &remove_cache);
my $cache_dir = "cache35";
$cache_dir = create_cache($cache_dir);
sub HTML::Template::Compiled::Test::bar {
return $_[0]->[0]
}
sub HTML::Template::Compiled::Test::baz {
return $_[0]->[1]
}
local $HTML::Template::Compiled::DEBUG = 0;
{
local $HTML::Template::Compiled::DEBUG = 1;
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%= /foo.bar %>
<%= /foo.boo %>
<%= /foo.baz %>
EOM
debug => 0,
);
my $obj = bless [23, 24], 'HTML::Template::Compiled::Test';
$htc->param(foo => $obj);
my $out;
eval {
$out = $htc->output;
};
ok($@, "Exception");
if ($@) {
#warn __PACKAGE__.':'.__LINE__.": $@\n";
my $msg = $htc->debug_code;
my $msg_html = $htc->debug_code(1);;
#print $msg, $/;
#print $msg_html, $/;
cmp_ok($msg, '=~', qr/ ERROR line (\d+)/, 'Error message');
}
else {
ok(0, 'Exception');
}
}
{
my %exp = (
mc => {
0 => {
count => {
1 => '### HTML::Template::Compiled Cache Debug ### FILE CACHE MISS: simple.tmpl',
2 => '### HTML::Template::Compiled Cache Debug ### FILE CACHE HIT: simple.tmpl',
},
},
1 => {
count => {
1 => '### HTML::Template::Compiled Cache Debug ### MEM CACHE MISS: simple.tmpl',
2 => '### HTML::Template::Compiled Cache Debug ### MEM CACHE HIT: simple.tmpl',
},
},
2 => {
count => {
1 => '### HTML::Template::Compiled Cache Debug ### MEM CACHE MISS: simple.tmpl'
. '### HTML::Template::Compiled Cache Debug ### FILE CACHE MISS: simple.tmpl',
2 => '### HTML::Template::Compiled Cache Debug ### MEM CACHE HIT: simple.tmpl',
},
},
},
);
for my $mc (0, 1, 2) {
my $memcache = 0;
my $file_cache = 1;
my $file_cache_dir = $cache_dir;
if ($mc == 1) {
$memcache = 1;
$file_cache = 0;
$file_cache_dir = '';
}
elsif ($mc == 2) {
$memcache = 1;
}
my %args = (
filename => "simple.tmpl",
path => $tdir,
cache => $memcache,
file_cache => $file_cache,
file_cache_dir => $file_cache_dir,
cache_debug => [qw/ mem_hit mem_miss file_hit file_miss /],
);
for my $count (1..2) {
my $warn = '';
{
local $SIG{__WARN__} = sub {
$warn .= shift;
};
my $htc = HTML::Template::Compiled->new(
%args,
);
if ($count == 2) {
$htc->clear_cache();
HTML::Template::Compiled->clear_filecache($cache_dir);
}
}
$warn =~ s/[\r\n]//g;
my $exp = $exp{mc}->{$mc}->{count}->{$count};
my $cache_string = $mc == 0 ? "file cache" : $mc == 1 ? "mem cache" : "file and mem cache";
cmp_ok($warn, 'eq', $exp, "cache=$cache_string count=$count");
}
}
}
HTML::Template::Compiled->clear_filecache($cache_dir);
remove_cache($cache_dir);
03_param.t 100644 001750 001750 4272 12712112457 16757 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t
use Test::More tests => 12;
BEGIN {
use_ok('HTML::Template::Compiled');
use_ok('HTML::Template::Compiled::Classic');
}
{
local $HTML::Template::Compiled::DEFAULT_QUERY = 1;
my $htc = HTML::Template::Compiled->new(
path => 't/templates',
scalarref => \' ',
);
$htc->param(
this => {
is => [qw(a test for param)],
returning => 'the value for a parameter',
},
);
my $test = $htc->param("this");
ok($test->{is}->[3] eq 'param', "param('var')");
my @param = sort $htc->param();
#print "(@param)\n";
cmp_ok(@param, "==", 2, "param() 1");
cmp_ok($param[0], "eq", 'bar', "param() 2");
cmp_ok($param[1]||'', "eq", 'foo', "param() 2");
eval {
my @query = sort $htc->query();
cmp_ok("@param", "eq", "@query", "query");
};
param_accumulates: {
$htc->clear_params;
$htc->param({ foo => 'foo value' });
like($htc->output, qr/foo value/);
$htc->param({ bar => 'bar value' });
like($htc->output, qr/foo value/);
}
literal_dot_is_ok: {
# To be compatible with H::T, we need
# to first check if a dot is literal
# part of the name before treating it magically.
# This is important for a smooth upgrade path.
my $htc = HTML::Template::Compiled::Classic->new(
path => 't/templates',
scalarref => \'',
);
$htc->param('foo.bar', 'WORKS');
like($htc->output, qr/WORKS/, "HTC::Classic literal dot is OK");
}
subref_variables: {
my $htc = HTML::Template::Compiled::Classic->new(
scalarref => \"",
global_vars => 1,
);
$htc->param(
foo => sub { return "bar" },
loop => [{a=>23}],
);
my $out = $htc->output;
#print "($out)\n";
cmp_ok($out, 'eq', "bar23bar", "HTC::Classic subref variables");
}
case_sensitive: {
my $htc = HTML::Template::Compiled::Classic->new(
scalarref => \" & ",
case_sensitive => 0,
);
$htc->param(
foo => 'Harold',
bar => 'Maude',
);
my $out = $htc->output;
#print "($out)\n";
cmp_ok($out, 'eq', "Harold & Maude", "HTC::Classic case_sensitive");
}
}
27_chomp.t 100644 001750 001750 1655 12712112457 16775 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use lib 't';
use Test::More tests => 3;
use_ok('HTML::Template::Compiled');
use HTC_Utils qw($cache $tdir &cdir);
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%var foo PRE_CHOMP=3 POST_CHOMP=3 %>
EOM
tagstyle => [qw(+classic +asp +comment )],
debug => 0,
);
$htc->param(foo => 23);
my $out = $htc->output;
#print "out: $out\n";
cmp_ok($out, 'eq', '23232323', "chomp");
}
{
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
<%loop foo %>
* <%= _ %>
<%/loop PRE_CHOMP=3 POST_CHOMP=3 %>
EOM
tagstyle => [qw(+asp)],
debug => 0,
);
my $exp = <<'EOM';
* 2
* 3
* 4
EOM
$htc->param(foo => [2..4]);
chomp($exp);
my $out = $htc->output;
#print "out: $out\n";
cmp_ok($out, 'eq', $exp, "chomp loop");
}
19_query.t 100644 001750 001750 6210 12712112457 17025 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use Test::More tests => 5;
use lib 't';
use HTC_Utils qw($tdir &cdir &create_cache &remove_cache);
my $cache_dir = "cache19";
$cache_dir = create_cache($cache_dir);
# test query() (From HTML::Template test suite)
use HTML::Template::Compiled;
use HTML::Template::Compiled::Lazy;
use File::Copy;
use Fcntl qw(:seek);
my $file_orig = File::Spec->catfile(qw(t templates query-test.tmpl));
my $file_copy = File::Spec->catfile(qw(t templates query-test-copy.tmpl));
copy($file_orig, $file_copy);
chmod 0644, $file_copy;
my $ok1 = query_template();
ok($ok1, "query 1");
#print `ls t/cache`;
if (1) {
my $htc = HTML::Template::Compiled::Lazy->new(
scalarref => \"<%= foo%>",
use_query => 1,
expire_time => 1,
);
my @params;
eval {
@params = $htc->query;
};
cmp_ok("@params", 'eq', 'foo', 'HTC::Lazy and query()');
}
sleep 3;
{
open my $fh, '+<', $file_copy or die $!;
local $/;
my $data = <$fh>;
seek $fh, SEEK_SET, 0;
truncate $fh, 0;
$data =~ s/EXAMPLE_INNER_LOOP/EXAMPLE_INNER_LOOP_TEST/;
print $fh $data;
close $fh;
}
my $ok2 = query_template();
ok(!$ok2, "query 2");
#exit;
sub query_template {
my $template = HTML::Template::Compiled->new(
path => 't/templates',
filename => 'query-test-copy.tmpl',
file_cache_dir => $cache_dir,
file_cache => 1,
expire_time => 1,
use_query => 1,
);
my %params;
eval {
%params = map {$_ => 1} $template->query(loop => 'EXAMPLE_LOOP');
};
my @result;
eval {
@result = $template->query(loop => ['EXAMPLE_LOOP', 'BEE']);
};
my $ok = (
$@ =~ /error/ and
$template->query(name => 'var') eq 'VAR' and
$template->query(name => 'included_var') eq 'VAR' and
#$template->query(name => 'included_var2') eq 'VAR' and
$template->query(name => 'EXAMPLE_LOOP') eq 'LOOP' and
exists $params{bee} and
exists $params{bop} and
exists $params{example_inner_loop} and
$template->query(name => ['EXAMPLE_LOOP', 'EXAMPLE_INNER_LOOP']) eq 'LOOP'
);
my $out = $template->output;
$template->clear_cache;
return $ok;
print "out: $out\n";
}
{
# test query() (From HTML::Template test suite)
my $template = HTML::Template::Compiled->new(
path => 't/templates',
filename => 'query-test2.tmpl',
use_query => 1,
);
my %p;
eval { %p = map {$_ => 1} $template->query(loop => ['LOOP_FOO', 'LOOP_BAR']); };
ok(exists $p{foo} and exists $p{bar} and exists $p{bash}, "foo bar");
$template->clear_cache;
}
{
my $template = HTML::Template::Compiled->new(
path => 't/templates',
filename => 'query-test2.tmpl',
use_query => 0,
);
my $warn = '';
{
local $SIG{__WARN__} = sub { $warn .= shift };
my $test = $template->query(loop => ['LOOP_FOO', 'LOOP_BAR']);
}
cmp_ok($warn, '=~', qr{\QYou are using query() but have not specified that you want to use it}, "no use_query but using query()");
}
unlink $file_copy;
HTML::Template::Compiled->clear_filecache($cache_dir);
remove_cache($cache_dir);
21_while.t 100644 001750 001750 5405 12712112457 16766 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t use warnings;
use strict;
use lib qw(t);
use Test::More tests => 7;
use_ok('HTML::Template::Compiled');
use HTC_Utils qw($cache $tdir &cdir);
{
my $class = 'HTML::Template::Compiled::__Test';
my $iterator = bless [undef,[23..25]], $class;
my $next = sub {
my ($self) = @_;
my $index = $self->[0];
my $array = $self->[1];
return unless @$array;
unless (defined $index) {
$self->[0] = $index = 0;
}
elsif ($index < $#$array) {
$self->[0] = ++$index;
}
else {
$self->[0] = undef;
return;
}
return $array->[$index];
};
{
no strict 'refs';
*{$class."::next"} = $next;
}
my $htc = HTML::Template::Compiled->new(
filehandle => \*DATA,
debug => 0,
loop_context_vars => 1,
);
#while (my $row = $iterator->next) {
#print "row $row\n";
#}
$htc->param(iterator => $iterator);
my $out = $htc->output;
cmp_ok($out,"=~", qr{
23.*1odd.*
24.*2.*
25.*3odd.*
23.*1odd.*
24.*2.*
25.*3odd}xs, "while");
#print "out: $out\n";
}
{
my $htc = HTML::Template::Compiled->new(
scalarref => \'
<%each letters%><%= __key__ %>=<%= __value__ %><%/each%>
<%each numbers sort=num %><%= __key__ %>=<%= __value__ %><%/each%>
<%each numbers sort=num reverse=1 %><%= __key__ %>=<%= __value__ %><%/each%>
<%each letters_nested sort=alpha sortby="[0]" %>sortby <%set_var val value=__value__ %>key<%= __key__ %>=<%= $val[0] %> <%/each%>
<%each letters_nested2 sort=alpha sortby="letter" %>sortby2 <%set_var val value=__value__ %>key<%= __key__ %>=<%= $val.letter %> <%/each%>',
debug => 0,
loop_context_vars => 1,
);
$htc->param(letters => { a => 1, b => 2, c => 3 });
$htc->param(numbers => { 21 => 'b', 2 => 'a', 100 => 'c' });
$htc->param(letters_nested => { 1 => ['b'], 2 => ['a'], 3 => ['c'] });
$htc->param(letters_nested2 => { 1 => {letter=>'b'}, 2 => {letter=>'a'}, 3 => {letter=>'c'} });
my $out = $htc->output;
#print "out: $out\n";
cmp_ok($out, '=~', 'a=1b=2c=3', 'each alpha sort');
cmp_ok($out, '=~', '2=a21=b100=c', 'each numeric sort');
cmp_ok($out, '=~', '100=c21=b2=a', 'each numeric sort reverse');
cmp_ok($out, '=~', 'sortby key2=a sortby key1=b sortby key3=c', 'each numeric sort reverse sortby');
cmp_ok($out, '=~', 'sortby2 key2=a sortby2 key1=b sortby2 key3=c', 'each numeric sort reverse sortby2');
}
__DATA__
<%with iterator%>
<%while next %>
<%VAR NAME="_" %>
<%= __counter__ %><%if __odd__ %>odd<%/if%>
<%/while%>
<%while next alias=hiThere%>
<%VAR NAME="$hiThere" %>
<%= __counter__ %><%if __odd__ %>odd<%/if%>
<%/while%>
<%/with iterator%>
09_wrong.t 100644 001750 001750 5111 12712112457 17012 0 ustar 00tina tina 000000 000000 HTML-Template-Compiled-1.003/t # Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl HTML-Template-Compiled.t'
use Test::More tests => 11;
BEGIN { use_ok('HTML::Template::Compiled') };
eval {
my $htc = HTML::Template::Compiled->new(
scalarref => \<<'EOM',
bar
<%if foo %>bar<%/if%>
<%if foo %>bar
EOM
debug => $ENV{HARNESS_ACTIVE} ? 0 : 1,
line_numbers => 1,
);
};
print "err: $@\n" unless $ENV{HARNESS_ACTIVE};
ok($@ =~ m/Missing closing tag for 'IF'/, "premature end of template");
# test wrong balanced tag
my $wrong;
eval {
$wrong = HTML::Template::Compiled->new(
path => 't/templates',
line_numbers => 1,
filename => 'wrong.html',
debug => $ENV{HARNESS_ACTIVE} ? 0 : 1,
);
};
print "err: $@\n" unless $ENV{HARNESS_ACTIVE};
ok($@ =~ m/does not match opening tag/ , "wrong template");
eval {
my $htc = HTML::Template::Compiled->new(
path => 't/templates',
filename => 'notexist.htc',
debug => $ENV{HARNESS_ACTIVE} ? 0 : 1,
);
};
print "err: $@\n" unless $ENV{HARNESS_ACTIVE};
ok($@ =~ m/not found/ , "template not found");
eval {
my $str = <<'EOM';
EOM
my $htc = HTML::Template::Compiled->new(
path => 't/templates',
scalarref => \$str,
debug => $ENV{HARNESS_ACTIVE} ? 0 : 1,
);
};
print "err: $@\n" unless $ENV{HARNESS_ACTIVE};
ok($@ =~ m/not found/ , "template from include not found");
{
my @wrong = (
"",
"",
"",
"foo",
);
for my $wrong (@wrong) {
eval {
my $htc = HTML::Template::Compiled->new(
scalarref => \$wrong,
debug => 0,
);
};
print STDERR "Error? $@\n" unless $ENV{HARNESS_ACTIVE};;
cmp_ok($@, "=~", qr{\Q: Syntax error in tag at }, "die when syntax is wrong");
}
}
{
my $tmpl = <<"EOM";
end
EOM
for my $strict (0, 1) {
my $out = '';
eval {
my $htc = HTML::Template::Compiled->new(
scalarref => \$tmpl,
strict => $strict,
);
$htc->param(foo => 23);
$out = $htc->output;
};
my $err = $@;
if ($strict) {
cmp_ok($err, '=~', qr{\Q Syntax error in tag at }, "unknown tag strict");
}
else {
$out =~ s/\s+/ /g;
my $exp = '23