HTML-Template-2.95 000755 001750 001750 0 12231261777 14317 5 ustar 00mpeters mpeters 000000 000000 README 100644 001750 001750 474 12231261777 15245 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95
This archive contains the distribution HTML-Template,
version 2.95:
Perl module to use HTML-like templating language
This software is copyright (c) 2012 by Michael Peters.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Changes 100644 001750 001750 36716 12231261777 15730 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 2.95 Mon Oct 21 2013
- Added support for "none" for default_escape [Mark Stosberg]
- Escape unicode new-line characters in JS escape [Michael Peters]
2.94 Thu Jan 17 2013
- Fixed bug where options were bleeding over into subsequent calls to new()
[Michael Peters]
2.93 Wed Jan 16 2013
- Feature: Added config() method to make setting global defaults
easy so that each call to new() has less boiler plate. [Michael
Peters]
- Bug Fix: t/05-force_untaint.t now passes when run with prove
[Michael Peters]
- Bug Fix: die_on_bad_params now controls whether we die if tmpl_vars
reuse names from tmpl_loops (which can be useful in some situations)
[Michael Peters]
2.91 Fri Mar 30 2012
- Feature: RT #18901 - Added new utf8 option to make it really simple
to use UTF-8 encoded templates [Michael Peters]
- Feature: RT #30586 - Added new open_mode option to allow for
Perl IO layers to interact when using open() on the template files
[moritz@faui2k3.org and Michael Peters]
- Feature: RT #38189 - Allow clean XML style tags ""
to be used as well. [allard@byte.nl]
- Feature: RT #46285 - Added support for lazily-evaluated coderefs
for TMPL_LOOPs. [Justin DeVuyst and Michael Peters]
- Feature: RT #64797 - Added new option die_on_missing_include (defaults
to true) that allows users to turn off the behavior of dieing when an
include can't be found [Zdenek Styblik and Michael Peters]
- Feature: Add new cache_lazy_vars option so that the values from coderefs
used for TMPL_VARs can be cached and the coderef not run multiple times
[Michael Peters]
- Feature: Add new cache_lazy_loops option so that the values from coderefs
used for TMPL_LOOPs can be cached and the coderef not run multiple times
[Michael Peters]
- Feature: Added __even__, __outer__ and __index__ loop context vars.
[Michael Peters]
- Bug Fix: RT #26456 - force_untaint can't work in Perl < 5.8.0
[admin@photoresearchers.com]
- Bug Fix: RT #67663 - remove warning under Perl > 5.14.0 about using tied
with a file handle without "*" [RENEEB, TODDR and Michael Peters]
- Bug Fix: RT #35534 - Using the same loop multiple times with
different vars will no longer cause an error if die_on_bad_params
is set. [Ron Savage & Michael Peters]
- Bug Fix: RT #38325 - Give a better error message if param() is set
with a reference to a reference. [Mark Stosberg & Michael Peters]
- Test Fix: RT #26103 - t/05-blind-cache.t no longer modifies the
distribution during the tests but instead uses temp files [Jan
Dubois and Michael Peters]
- Test Fix: Tests that create and modify files now use temp files
and file_cache_dir is always a temp directory [Michael Peters]
- Doc Fix: Using more POD formatting [Michael Peters]
- Doc Fix: RT #46244 - fix broken link to tutorial [Michael Peters]
- Doc Fix: RT #60282 - fix various mispellings [Florian Ernst]
- Doc Fix: RT #60283 - fix broken HTML example [Florian Ernst]
- Doc Fix: RT #60284 - fix broken POD [Florian Ernst and Michael Peters]
- Development: Moved development to GitHub
(https://github.com/mpeters/html-template)
- Development: Switched to using Dist::Zilla internally for release management
- Development: Added Michael Peters as co-maintainer
2.9 Mon Jan 29 15:54:03 EST 2007
- New Feature: the new force_untaint option makes sure you do not
pass tainted values to param(). [Sven Neuhaus]
- New Feature: Added ESCAPE=NONE as a synonym for ESCAPE=0. Fixed
both to work with default_escape. [cpan@punch.net]
- Bug Fix: DEFAULT didn't work with URL and JS escaping.
- Bug Fix: Long-standing bug where variables set in a loop weren't
available inside inner loops under global_vars if the variable
wasn't actually used in the outer loop. (Thanks to Richard Fein
for help debugging the fix.)
- Doc Fix: Changed references to CVS in the docs to Subversion now that
the switch is complete.
- Test Fix: At long last, the work from the Phalanx project has
been merged! The tests are now more complete and easier to work
on. Thanks Phalanx guys!
2.8 Wed Dec 21 18:37:39 EST 2005
- New Feature: the new default_escape option allows you to apply
escaping to all variables in a template. [Alex Kapranoff]
- Bug Fix: ESCAPE wasn't working on variables containing code-refs.
- Bug Fix: Changed HTML::Template to help sub-classes by called
_new_from_loop() via ref($self) rather than hard-coding the package
name. [Mark Stosberg]
- Bug Fix: Including more than one tag in or
now dies with an error message, instead of silently ignoring
one of the clauses. [Mitar and Mark Stosberg]
- Bug Fix: Fixed HTML::Template to re-evaluate conditions to handle
. This bug could cause HTML::Template to take both
branches of a conditional if a code-ref parameter returned a
different value when called a second time. [Emanuele Zeppieri]
2.7 Thu Jun 24 12:00:00 2004
- New Feature: Added javascript escaping with ESCAPE=JS. (Craig Manley)
- Bug Fix: Improved cache keying to be sensitive to options which
alter the compilation of templates (path, search_path,
loop_context_vars and global_vars). Calls to new() with
different settings for any of these options will no longer pull
incorrect cached objects.
- Bug Fix: Added code to detect broken Perl 5.8.0 installs
during installation (i.e. Redhat 8 and 9).
- Bug Fix: Fixed parsing of ESCAPE='URL' (Paul Baker)
- Bug Fix: Added check for empty filename passed to new().
- Test Fix: Migrated tests to Test::More. This will allow the
easier introduction of new tests and the use of
Devel::Cover. (Gabor Szabo)
2.6 Thu Aug 29 12:00:00 2002
- New Feature: HTML::Template will combine HTML_TEMPLATE_ROOT
environment variable and path option if both are
available. (Jesse Erlbaum)
- New Feature: __counter__ variable now available when
loop_context_vars is set (Simran Gambhir)
- New Feature: The default attribute allows you to specify
defaults for tags.
- Bug Fix: fixed parser to reject s with no names.
(crazyinsomniac)
- Doc Fix: fixed documentation to correctly describe the
interaction of case_sensitive and loop_context_vars.
(Peter Claus Lamprecht)
- Doc Fix: updated mailing-list information to reflect move from
vm.com to sourceforge.net
2.5 Fri Feb 01 12:00:00 2002
- Bug Fix: global_vars fixed for loops within loops
- Bug Fix: include paths were broken under Windows (David Ferrance)
- Bug Fix: nested include path handling was wrong (Gyepi Sam)
- Bug Fix: MD5 signatures for file cache corrected (Martin Schroth)
- Bug Fix: print_to was broken for tied filehandles (Darren Chamberlain)
- Doc Fix: added mailing-list archive URL to FAQ, added link to
tutorial, fixed typos and formatting
- Doc Fix: added reference to new HTML::Template website at
http://html-template.sourceforge.net/
2.4 Mon August 27 12:00:00 2001
- Bug Fix: case_sensitive option broke loops (Peter Leonard)
- Bug Fix: code-ref params now work with IF and UNLESS
2.3 Thu June 28 12:00:00 2001
- New Feature: template tags can now span lines. (Roland Giersig)
- New Feature: new() option 'filehandle'. (Roland Giersig)
- Bug Fix: includes were broken in some cases using scalarref
templates. (Lance Thomas)
- Bug Fix: recursive include detection was broken for scalarref
templates. (Mark Stosberg)
- Bug Fix: cleaned up more 5.004 warnings. (Jere Julian)
2.2 Sat December 23 12:00:00 2000
- Bug Fix: fixed memory leak in global_vars implementation
(Ade Olonoh)
- Bug Fix: fixed file_cache not reloading templates on changes
(T.J. Mather)
- Bug Fix: fixed broken error checking in param() (Mark Stosberg)
2.1 Sun December 18 12:00:00 2000
- New Feature: new 'file_cache' and 'double_file_cache' options
provide a file based caching method (T.J. Mather)
- New Feature: new 'print_to' option for output() allows
output() to print to a filehandle as it runs.
(Chris Nokleberg)
- New Feature: new 'case_sensitive' option to allow template
variable names to be case sensitive. (Matthew Wickline)
- New Feature: new 'filter' option allows pre-parse filtering of
template files.
- Bug Fix: added single-quote escaping to HTML escaping code
(Ralph Corderoy)
- Bug Fix: fixed a noisy bug in param() when used with 'associate'
(William Ward)
- Doc Fix: broke out FAQ into separate file.
2.0 Sun September 16 12:00:00 2000
- New Feature: new 'search_path_on_include' option (Jody Biggs)
- New Feature: much requested variable __ODD__ added to set of
loop_context_vars.
- New Feature: new 'no_includes' option (Scott Guelich)
- Doc Addition: Added link to Japanese translation (Kawai Takanori)
- Bug Fix: loop_context_vars was mostly broken (T.J. Mather,
Martin Schroth and Dave Wolfe)
- Bug Fix: vanguard_compatibility_mode was broken on first line of
included files. (uchum)
1.8 Sun June 25 12:00:00 2000
- New Feature: global_vars option makes outer variables visible
inside loops.
- Bug Fix: Use File::Spec to construct pathnames. This means
that HTML::Template should now work on VMS and MacOS.
(Larry Moore)
- Bug Fix: loop_context_vars were broken in an unusual case
(Todd Larason)
- Bug Fix: ESCAPE was broken in some cases.
- New License: switched to GPL/Artistic hybrid normally used
with Perl modules.
1.7 Fri March 24 12:00:00 2000
- New Feature: new method query() enables introspection into
loops (Chris Houser)
- New Feature: Better error handling with Carp
- Bug Fix: URLESCAPE was skipping some important escapes (Simran Gambhir)
- New FAQ: How can I execute a program from inside my template?
1.6 Sun March 05 12:00:00 2000
- New Feature: double_cache combines shared memory and local memory
caching for twice the speedup!
- New feature: ESCAPE=URL (added by Tobias Brox)
- Bug Fix: allow for blessed objects in calls to param()
(thanks to Michael Lloyd and David Glasser)
- Bug Fix: _mtime was broken in 1.5, fixed a typo.
1.5.1 Wed February 23 12:00:00 2000
- Bug Fix: 1.5 broke caching in some cases - thanks to Drew Taylor
for help solving this one.
1.5 Mon February 17 12:00:00 2000
- Shared cache now uses IPC::SharedCache and is much more stable.
- Fixed problem with mixed case associated CGI.pm parameters
- param() now accepts subroutine refs for TMPL_VARs.
1.4 Sat January 8 12:00:00 2000
- New feature: new() option 'shared_cache' enables experimental
IPC shared memory caching!
- TMPL_IF now works on TMPL_LOOP variables.
- Public CVS server available at www.sourceforge.net.
- Bug Fix from Doug Steinwand: loop_context_vars not working
on one-item loops.
1.3 Fri December 17 12:00:00 1999
- Omnibus regex patch from Matthew Wickline: a faster and more
robust parse().
- New tag: TMPL_UNLESS, the opposite of TMPL_IF.
- Numerous bug fixes: mixed-case filenames in includes,
recursive TMPL_INCLUDEs, reporting filename and line number
inside included files, better syntax-error detection.
- Optional loop context variables - __FIRST__, __LAST__ and
__INNER__.
1.2.1 Wed November 17 12:00:01 1999
- tiny bug fix
1.2 Wed November 17 12:00:00 1999
- Added multi-parameter and hash-ref syntax for param() calls.
- Added DTD-compliant syntax patch from
Matthew Wickline - Thanks!
- vanguard_compatibility_mode = 1 implies die_on_bad_params = 0
1.1 Fri November 05 12:00:00 1999
- Lifted requirement that s be alone on a line
- Added "path" option to new() to manipulate search path for
templates.
- bug fixes
1.0 Fri October 28 12:00:00 1999
- An HTML::Template mailing-list! Send a blank message to
htmltmpl-subscribe@lists.vm.com to join.
- bug fixes
- improved docs
0.96 October 14th 1999 15:49
- Added "ESCAPE=1" option to to HTML-escape
variable values. (Peter Marelas, thanks!)
- more bug fixes (David Glasses, James William Carlson -
thanks)
- even *more* code cleanup!
- new FAQ concerning pre-loading templates and mod_perl.
0.95 October 8th 1999 12:28
- bug fix: some lines were getting chomped (Eric Zylberstejn)
- *NUMEROUS* bug fixes (David Glasser - Thanks a lot!)
- new FAQ section in documentation
- code cleanup and improved comments
0.91 September 29th 1999 17:59
- bug fix: possible loss of text after a
(Thanks to Tom Huskins for alerting me to this one!)
0.9 September 28th 1999 17:46
- and
- near total rewrite - faster, smaller, more "compiler-esque" code.
- *MASSIVE* speedups in all modes - up to 10x faster!1
- bug fix : param() wasn't returning names of LOOPs
- This really is version 0.9 so 1.0 is coming up. Get those
bug reports in!
0.06 September 19th 1999 23:09
- added associate parameter to new() and obsoleted
associate_CGI() (still supported for now)
- added support for HTML_TEMPLATE_ROOT environment variable
- small performance improvements using typeglobs
- added a performance testing script: time_trial.pl
0.051 September 10th 1999 17:30
- small problem with make test fixed.
0.05 September 10th 1999 17:18
- Added functionality!
- Added associate_CGI() method - donated by Richard Dice
- Cleaned up internal access to new() options.
- more bug fixes from such notables as Kevin Puetz, and Steve
Reppucci.
0.04 Fri June 18 12:00:00 1999
- fixed cacheing - under certain conditions it was totally broken!
- changed {param} to {param_values} - some older perls complained.
- die_on_bad_params => 0 now also applied to loop body.
- added copious comments about how bad m//i is to avoid future
bug reports about [tT][hH][iI][sS]!
- added numerous bug fixes and optimizations submitted by Mike
Blazer, Adriano Nagelschmidt Rodrigues, Andrej Mikus and
Ilya Obshadko. Thanks!
0.03 Fri June 11 17:37:00 1999
- fixed a few irritating "undefined variable" errors in -w
- big speedup on large TMPL_LOOPs. They are at least one order of
magnitude faster now!
- die_on_bad_params => 0 never really worked! It does now.
0.02 Mon May 31 12:47:00 1999
- die on multiple source parameters in new()
- tries to preserve newlines in loop body
- copies in array contents from array refs on param call
i.e. allows for reuse of scratch arrays on calling side
- Added a CREDITS section to the docs, inaugurated it with
Richard Chen for his many fixes.
- Added type => 'sometype', source => 'source' new() syntax.
- made "NAME=" in tags optional. Added a test.pl to check for
this.
0.01 Mon May 17 15:17:00 1999
- added cacheing to module and perldoc
- moved .tmpl files used by 'make test' to /templates
- first release!
0.00 Fri May 14 14:59:06 1999
- original version; created by h2xs 1.18
LICENSE 100644 001750 001750 43661 12231261777 15437 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 This software is copyright (c) 2012 by Michael Peters.
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) 2012 by Michael Peters.
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, Suite 500, Boston, MA 02110-1335 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) 2012 by Michael Peters.
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 1307 12231261777 16045 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 name = HTML-Template
main_modules = lib/HTML/Template.pm
author = Michael Peters
license = Perl_5
copyright_holder = Michael Peters
copyright_year = 2012
abstract = Perl module to use HTML-like templating language
[@Basic]
[PruneFiles]
match = ^file_cache/*
[Prereqs]
Carp = 0
File::Spec = 0.82
Digest::MD5 = 0
Scalar::Util = 0
[Prereqs / TestRequires]
File::Temp = 0
Test::More = 0
[MetaResources]
bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Template
repository.url = git://github.com/mpeters/html-template.git
repository.web = https://github.com/mpeters/html-template
repository.type = git
[VersionFromModule]
[PodSyntaxTests]
META.yml 100644 001750 001750 1242 12231261777 15650 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 ---
abstract: 'Perl module to use HTML-like templating language'
author:
- 'Michael Peters '
build_requires:
File::Temp: 0
Test::More: 0
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.300029, CPAN::Meta::Converter version 2.120630'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: HTML-Template
requires:
Carp: 0
Digest::MD5: 0
File::Spec: 0.82
Scalar::Util: 0
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Template
repository: git://github.com/mpeters/html-template.git
version: 2.95
MANIFEST 100644 001750 001750 4407 12231261777 15536 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 Changes
LICENSE
MANIFEST
META.yml
Makefile.PL
README
bench/new.pl
bench/profile_large.pl
bench/profile_medium.pl
bench/profile_small.pl
bench/profile_var.pl
bench/vars.pl
dist.ini
lib/HTML/Template.pm
lib/HTML/Template/FAQ.pm
scripts/clean_shm.pl
scripts/time_trial.pl
t/01-bad-args.t
t/01-coderefs.t
t/02-parse.t
t/02-random.t
t/03-associate.t
t/03-else_else_bug.t
t/04-default-escape.t
t/04-default_with_escape.t
t/04-escape.t
t/04-no_taintmode.t
t/04-type-source.t
t/05-blind-cache.t
t/05-force_untaint.t
t/05-nested_global.t
t/06-file-cache-dir.t
t/07-double-file-cache.t
t/08-cache-debug.t
t/09-caching-precluded.t
t/10-param.t
t/11-non-file-templates.t
t/12-open_mode.t
t/12-query.t
t/12-utf8.t
t/13-loop-boolean.t
t/13-loop-context.t
t/13-loop-repeated.t
t/14-includes.t
t/15-comment.t
t/16-config.t
t/99-old-test-pl.t
t/release-pod-syntax.t
t/testlib/IO/Capture.pm
t/testlib/IO/Capture/ErrorMessages.pm
t/testlib/IO/Capture/Stderr.pm
t/testlib/IO/Capture/Stdout.pm
t/testlib/IO/Capture/Tie_STDx.pm
t/testlib/_Auxiliary.pm
templates/case_loop.tmpl
templates/context.tmpl
templates/counter.tmpl
templates/default.tmpl
templates/default_escape.tmpl
templates/default_escape_off.tmpl
templates/double_loop.tmpl
templates/escapes.tmpl
templates/global-loops.tmpl
templates/globals.tmpl
templates/html-escape.tmpl
templates/if.tmpl
templates/ifelse.tmpl
templates/include.tmpl
templates/include_path/a.tmpl
templates/include_path/b.tmpl
templates/include_path/inner.tmpl
templates/include_path/one.tmpl
templates/include_path2/inner.tmpl
templates/included.tmpl
templates/included2.tmpl
templates/included3.tmpl
templates/js.tmpl
templates/long_loops.tmpl
templates/loop-context.tmpl
templates/loop-if.tmpl
templates/loop.tmpl
templates/medium.tmpl
templates/multiline_tags.tmpl
templates/newline_test1.tmpl
templates/newline_test2.tmpl
templates/other-loop.tmpl
templates/outer.tmpl
templates/query-test.tmpl
templates/query-test2.tmpl
templates/recursive.tmpl
templates/searchpath/included.tmpl
templates/searchpath/three.tmpl
templates/searchpath/two.tmpl
templates/simple-loop-nonames.tmpl
templates/simple-loop.tmpl
templates/simple.tmpl
templates/simplemod.tmpl
templates/unless.tmpl
templates/urlescape.tmpl
templates/utf8-test.tmpl
templates/vanguard1.tmpl
templates/vanguard2.tmpl
templates/var.tmpl
t 000755 001750 001750 0 12231261777 14503 5 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 12-utf8.t 100644 001750 001750 3433 12231261777 16141 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use warnings;
use File::Temp qw(tempdir);
use Test::More ($] < 5.007001 ? (skip_all => 'utf8 needs at least perl 5.7.1') : (tests => 5));
use_ok('HTML::Template');
# make sure we can't use along with open_mode
eval { HTML::Template->new(path => 'templates', filename => 'utf8-test.tmpl', utf8 => 1, open_mode => 1)};
like($@, qr/utf8 and open_mode cannot be used/i, 'cant use uft8 and open_mode at the same time');
my $tmpl = HTML::Template->new(
path => 'templates',
filename => 'utf8-test.tmpl',
utf8 => 1,
);
my $output = $tmpl->output;
chomp $output;
is($output, chr(228), 'correct UTF8 encoded character');
my $cache_dir = tempdir(CLEANUP => 1);
# same as before, this time we test file_cache
$tmpl = HTML::Template->new(
path => 'templates',
filename => 'utf8-test.tmpl',
utf8 => 1,
cache => 0,
file_cache => 1,
file_cache_dir => $cache_dir,
);
# trigger cache storage:
$output = $tmpl->output;
# this time it will implicitly read from the cache
$tmpl = HTML::Template->new(
path => 'templates',
filename => 'utf8-test.tmpl',
utf8 => 1,
cache => 0,
file_cache => 1,
file_cache_dir => $cache_dir,
);
$output = $tmpl->output;
chomp $output;
is($output, chr(228), 'correct UTF8 encoded character from cache');
# this time it will implicitly read from the cache w/out open_mode
# which means it won't be correct UTF8.
$tmpl = HTML::Template->new(
path => 'templates',
filename => 'utf8-test.tmpl',
cache => 0,
file_cache => 1,
file_cache_dir => $cache_dir,
);
$output = $tmpl->output;
chomp $output;
is(sprintf('%vd', $output), "195.164", 'correct non-UTF8 bytes: different open_mode, no cache');
Makefile.PL 100644 001750 001750 2151 12231261777 16351 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95
use strict;
use warnings;
use ExtUtils::MakeMaker 6.30;
my %WriteMakefileArgs = (
"ABSTRACT" => "Perl module to use HTML-like templating language",
"AUTHOR" => "Michael Peters ",
"BUILD_REQUIRES" => {
"File::Temp" => 0,
"Test::More" => 0
},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30"
},
"DISTNAME" => "HTML-Template",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "HTML::Template",
"PREREQ_PM" => {
"Carp" => 0,
"Digest::MD5" => 0,
"File::Spec" => "0.82",
"Scalar::Util" => 0
},
"VERSION" => "2.95",
"test" => {
"TESTS" => "t/*.t"
}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
}
else {
$pp->{$mod} = $br->{$mod};
}
}
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
bench 000755 001750 001750 0 12231261777 15317 5 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95 new.pl 100755 001750 001750 522 12231261777 16567 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/bench #!/usr/bin/env perl
use strict;
use warnings;
use Benchmark 'timethese';
use lib '../lib';
use HTML::Template;
timethese(
1_000,
{
small_template => sub { HTML::Template->new(filename => 'templates/default.tmpl') },
big_template => sub { HTML::Template->new(filename => 'templates/long_loops.tmpl') }
}
);
02-parse.t 100644 001750 001750 4672 12231261777 16372 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use warnings;
use Test::More (tests => 9);
use_ok('HTML::Template');
# testing line 1978
my $tmpl_text = <
Name:
Job:
EOT
eval { HTML::Template->new_scalar_ref(\$tmpl_text) };
like($@, qr/ESCAPE option invalid/, "Escape not in TMPL_VAR");
# testing line 1981
$tmpl_text = <
Name:
Job:
EOT
eval { HTML::Template->new_scalar_ref(\$tmpl_text) };
like($@, qr/DEFAULT option invalid/, "Escape not in TMPL_VAR");
# testing line 1984 else
# not quite checking 1984, deserves some sober attention
$tmpl_text = <
Name:
Job:
EOT
ok(HTML::Template->new_scalar_ref(\$tmpl_text, strict => 0), "Ignores invalid TMPL tags with strict off");
# now with strict on
eval { HTML::Template->new_scalar_ref(\$tmpl_text, strict => 1) };
like($@, qr/Syntax error/, "Spits at invalid TMPL tag with strict on");
# make sure we can use and syntax
my $tmpl = HTML::Template->new(scalarref => \':');
$tmpl->param(foo => 'a');
my $output = $tmpl->output;
is($output, 'a:a', 'both var forms worked');
# attempting to check lines 1540-44
# test using HTML_TEMPLATE_ROOT with path
{
my $file = 'four.tmpl'; # non-existent file
local $ENV{HTML_TEMPLATE_ROOT} = "templates";
eval { HTML::Template->new(path => ['searchpath'], filename => $file) };
like($@, qr/Cannot open included file $file/, "Template file not found");
}
{
my $file = 'four.tmpl'; # non-existent file
local $ENV{HTML_TEMPLATE_ROOT} = "templates";
eval { HTML::Template->new(filename => $file); };
like($@, qr/Cannot open included file $file/, "Template file not found");
}
{
my ($template, $output);
local $ENV{HTML_TEMPLATE_ROOT} = "templates";
$template = HTML::Template->new(filename => 'searchpath/three.tmpl');
$output = $template->output;
ok($output =~ /THREE/, "HTML_TEMPLATE_ROOT working without 'path' option being set");
}
=head1 NAME
t/02-parse.t
=head1 OBJECTIVE
Test previously untested code inside C. Much
remains to be done.
=cut
12-query.t 100644 001750 001750 4247 12231261777 16424 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use Test::More qw(no_plan);
use_ok('HTML::Template');
my $template = HTML::Template->new(
path => 'templates',
filename => 'query-test.tmpl',
);
my @results = sort $template->query();
is_deeply(\@results, [qw(example_loop var)], 'no args, returns top level items');
is($template->query(name => 'var'), 'VAR', 'name for a variable');
ok(!$template->query(name => 'var2'), 'no name for a non existent var');
is($template->query(name => 'example_loop'), 'LOOP', 'name for a loop');
is($template->query(name => ['example_loop', 'bop']), 'VAR', 'name for a var inside a loop');
is($template->query(name => ['example_loop', 'example_inner_loop']), 'LOOP', 'name for a loop inside a loop');
is($template->query(name => ['example_loop', 'example_inner_loop', 'inner_bee']),
'VAR', 'name for a var inside a loop inside a loop');
@results = sort $template->query(loop => 'example_loop');
is_deeply(\@results, [qw(bee bop example_inner_loop)], 'loop on an outer loop');
@results = sort $template->query(loop => ['example_loop', 'example_inner_loop']);
is_deeply(\@results, [qw(inner_bee inner_bop)], 'loop on an inner loop');
eval { $template->query(loop => 'var') };
ok($@ =~ /error/, 'loop on a var fails');
# another template
$template = HTML::Template->new(path => 'templates', filename => 'query-test2.tmpl');
@results = sort $template->query();
is_deeply(\@results, [qw(loop_foo)], 'no args, returns only top level item');
is($template->query(name => 'loop_foo'), 'LOOP', 'name for a loop');
is($template->query(name => ['loop_foo', 'loop_bar']), 'LOOP', 'name for a loop inside a loop');
is($template->query(name => ['loop_foo', 'loop_bar', 'foo']), 'VAR', 'name for a var inside loop inside a loop');
is($template->query(name => ['loop_foo', 'loop_bar', 'bar']), 'VAR', 'name for a var inside loop inside a loop');
is($template->query(name => ['loop_foo', 'loop_bar', 'bash']), 'VAR', 'name for a var inside loop inside a loop');
@results = sort $template->query(loop => 'loop_foo');
is_deeply(\@results, [qw(loop_bar)], 'loop on a loop');
@results = sort $template->query(loop => ['loop_foo', 'loop_bar']);
is_deeply(\@results, [qw(bar bash foo)], 'loop on an innner loop');
10-param.t 100644 001750 001750 4365 12231261777 16356 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use warnings;
use Test::More (tests => 10);
use_ok('HTML::Template');
my $tmpl_string = "";
my $template = HTML::Template->new_scalar_ref(\$tmpl_string);
# test for non existing param
eval { my $value = $template->param('FOOBAR') };
like(
$@,
qr/HTML::Template : Attempt to get nonexistent parameter/,
"attempt to get nonexistent parameter caught with die_on_bad_params == 1"
);
$template = HTML::Template->new_scalar_ref(\$tmpl_string, die_on_bad_params => 0);
ok(!defined($template->param('FOOBAR')), "if bad params permitted, bad param results in undef");
$template->param('FOOBAR' => undef);
ok(!defined($template->param('FOOBAR')), "undef param results in undef");
# test for bad call to ->param with non scalar/non-hashref arg
# dha wants to send it a puppy
eval { my $value = $template->param(bless ['FOOBAR'], "Puppy") };
like($@, qr/Single reference arg to param\(\) must be a hash-ref/, "Single reference arg to param() must be a hash-ref!");
# test for passing
eval { $template->param(bless {'FOOBAR' => 42}, "Puppy") };
ok(!$@, "param() doesn't die with blessed hash as first arg");
# make sure we can't pass a reference to a reference
eval { $template->param(\{}) };
like($@, qr/must be a hash-ref/i, 'reference to a hash-ref is still bad');
# odd number of params
eval { my $value = $template->param('foo' => 1, 'bar') };
like($@, qr/You gave me an odd number of parameters to param/, "odd number of args to param");
# value is a reference to a reference
$template = HTML::Template->new_scalar_ref(\'');
eval { $template->param(foo => \{}) };
like($@, qr/a reference to a reference/i, 'trying to use a reference to a reference');
# setting multiple values, multiple calls
$template = HTML::Template->new_scalar_ref(\'-');
$template->param(foo => 1, baz => 2);
$template->param(bar => 2, baz => 3, frob => [{fooey => 'a', blah => 'b'}, {fooey => 'c', blah => 'd'}]);
is($template->output, '1 2 3 a-b c-d ', 'can set multiple params at once');
=head1 NAME
t/10-param.t
=head1 OBJECTIVE
Test edge cases in use of C. More tests will
probably be added as we understand this function better.
=cut
vars.pl 100755 001750 001750 24267 12231261777 17025 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/bench #!/usr/bin/env perl
use strict;
use warnings;
use Benchmark 'timethese';
use lib '../lib';
use HTML::Template;
timethese(
1_000,
{
small_template => sub {
my $tmpl = HTML::Template->new(filename => 'templates/default.tmpl');
$tmpl->param(
a => 'foo',
cl => 'bar',
start => 'baz',
sh => 'blah',
);
$tmpl->output;
},
medium_template => sub {
my $tmpl = HTML::Template->new(filename => 'templates/medium.tmpl');
$tmpl->param(
'alert' => 'I am alert.',
'company_name' => "MY NAME IS",
'company_id' => "10001",
'office_id' => "10103214",
'name' => 'SAM I AM',
'address' => '101011 North Something Something',
'city' => 'NEW York',
'state' => 'NEw York',
'zip' => '10014',
'phone' => '212-929-4315',
'phone2' => '',
'subcategories' => 'kfldjaldsf',
'description' =>
"dsa;kljkldasfjkldsajflkjdsfklfjdsgkfld\nalskdjklajsdlkajfdlkjsfd\n\talksjdklajsfdkljdsf\ndsa;klfjdskfj",
'website' => 'http://www.assforyou.com/',
'intranet_url' => 'http://www.something.com',
'remove_button' => "",
'company_admin_area' =>
"Manage Office Administrators",
'casestudies_list' =>
"adsfkljdskldszfgfdfdsgdsfgfdshghdmfldkgjfhdskjfhdskjhfkhdsakgagsfjhbvdsaj hsgbf jhfg sajfjdsag ffasfj hfkjhsdkjhdsakjfhkj kjhdsfkjhdskfjhdskjfkjsda kjjsafdkjhds kjds fkj skjh fdskjhfkj kj kjhf kjh sfkjhadsfkj hadskjfhkjhs ajhdsfkj akj fkj kj kj kkjdsfhk skjhadskfj haskjh fkjsahfkjhsfk ksjfhdkjh sfkjhdskjfhakj shiou weryheuwnjcinuc 3289u4234k 5 i 43iundsinfinafiunai saiufhiudsaf afiuhahfwefna uwhf u auiu uh weiuhfiuh iau huwehiucnaiuncianweciuninc iuaciun iucniunciunweiucniuwnciwe",
'number_of_contacts' => "aksfjdkldsajfkljds",
'country_selector' => "klajslkjdsafkljds",
'logo_link' => "dsfpkjdsfkgljdsfkglj",
'photo_link' => "lsadfjlkfjdsgkljhfgklhasgh",
);
$tmpl->output;
},
large_template => sub {
my $tmpl = HTML::Template->new(filename => 'templates/long_loops.tmpl');
$tmpl->param(
propname => 'foo',
javascript => '',
hotel_key => 'bar&>?/',
alert => 'Danger!&!',
new_comment_button => 'Click Me!',
comments => [
{
color => 'black',
posted_by => 'me & you',
posted_on => '',
stars => '10',
comment => 'Super & duper cool stuff!',
approval_button =>
'No, Click Me!',
edit_button =>
'Hey, what about me!',
delete_button =>
'Why am I always last?',
},
{
color => 'blue',
posted_by => 'you & I',
posted_on => '2 days ',
stars => '5',
comment => 'It is ok ',
approval_button =>
'No, Click Me!',
edit_button =>
'Hey, what about me!',
delete_button =>
'Why am I always last?',
},
{
color => 'yellow',
posted_by => 'someone & someone else',
posted_on => '4 days ',
stars => '4',
comment => 'It would not kill me to go back & spend more time there',
approval_button =>
'No, Click Me!',
edit_button =>
'Hey, what about me!',
delete_button =>
'Why am I always last?',
},
{
color => 'blue',
posted_by => 'someone else!&!',
posted_on => '<4 days ago>',
stars => '6',
comment => 'I enjoyed the ',
approval_button =>
'No, Click Me!',
edit_button =>
'Hey, what about me!',
delete_button =>
'Why am I always last?',
},
{
color => 'red',
posted_by => 'someone else <&>',
stars => '6',
approval_button =>
'No, Click Me!',
},
{},
],
comment_editor => [
{
color => 'black',
posted_by => 'me',
posted_on => 'yesterday',
stars => '10',
comment => 'Super duper cool stuff!',
ok_button =>
'I am totally fine with that.',
cancel_button =>
'No you are not.',
},
{
color => 'blue',
posted_by => 'you',
posted_on => '2 days ago',
stars => '5',
comment => 'It is ok',
ok_button =>
'I am totally fine with that.',
cancel_button =>
'No you are not.',
},
{
color => 'yellow',
posted_by => 'someone',
posted_on => '4 days ago',
stars => '4',
comment => 'It would not kill me to go back',
ok_button =>
'I am totally fine with that.',
cancel_button =>
'No you are not.',
},
{
color => 'blue',
posted_by => 'someone else',
posted_on => '4 days ago',
stars => '6',
comment => 'I enjoyed the bed',
ok_button =>
'I am totally fine with that.',
cancel_button =>
'No you are not.',
},
{
color => 'red',
posted_by => 'someone else',
stars => '6',
cancel_button =>
'No you are not.',
},
{},
],
comment_created => [
{posted_by => 'Fred'},
{posted_by => 'George'},
{posted_by => 'Thomas'},
{posted_by => 'Dan'},
{posted_by => 'Henry'},
{posted_by => 'Michael'},
{posted_by => 'Nelson'},
{posted_by => 'Brad'},
{posted_by => 'Rodney'},
{posted_by => 'Jose'},
{posted_by => 'Marie'},
{posted_by => 'Eric'},
{posted_by => 'Isaac'},
{posted_by => 'Rusty'},
{posted_by => 'Jacob'},
{posted_by => 'Alice'},
{posted_by => 'Kelly'},
{posted_by => 'Juan'},
{posted_by => 'Lewis'},
{posted_by => 'Fredrick'},
{posted_by => 'Manny'},
{posted_by => 'Dee'},
{posted_by => 'Nort'},
{posted_by => 'Jeanne'},
{posted_by => 'Oscar'},
{posted_by => 'Peter'},
{posted_by => 'Russel'},
{posted_by => 'Steve'},
{posted_by => 'Timmy'},
{posted_by => 'Vance'},
{},
],
);
},
}
);
16-config.t 100644 001750 001750 15751 12231261777 16552 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use warnings;
use Test::More ('no_plan');
use_ok('HTML::Template');
my %config = HTML::Template->config();
is_deeply(
\%config,
{
'associate' => [],
'blind_cache' => 0,
'cache' => 0,
'cache_debug' => 0,
'cache_lazy_loops' => 0,
'cache_lazy_vars' => 0,
'case_sensitive' => 0,
'debug' => 0,
'die_on_bad_params' => 1,
'die_on_missing_include' => 1,
'double_cache' => 0,
'double_file_cache' => 0,
'file_cache' => 0,
'file_cache_dir' => '',
'file_cache_dir_mode' => 448,
'filter' => [],
'force_untaint' => 0,
'global_vars' => 0,
'ipc_key' => 'TMPL',
'ipc_max_size' => 0,
'ipc_mode' => 438,
'ipc_segment_size' => 65536,
'loop_context_vars' => 0,
'max_includes' => 10,
'memory_debug' => 0,
'no_includes' => 0,
'open_mode' => '',
'path' => [],
'search_path_on_include' => 0,
'shared_cache' => 0,
'shared_cache_debug' => 0,
'stack_debug' => 0,
'strict' => 1,
'timing' => 0,
'utf8' => 0,
'vanguard_compatibility_mode' => 0
},
'correct defaults'
);
# no path so we shouldn't be able to find it
my $tmpl = eval { HTML::Template->new(filename => 'utf8-test.tmpl') };
ok($@, 'exception thrown for not finding filename');
like($@, qr/file not found/, 'file not found');
# now try again after setting path via config
HTML::Template->config(path => 'templates');
$tmpl = eval { HTML::Template->new(filename => 'utf8-test.tmpl') };
ok(!$@, 'no exception thrown');
isa_ok($tmpl, 'HTML::Template');
my $output = $tmpl->output;
chomp($output);
is(sprintf('%vd', $output), "195.164", 'no utf8 config set, so just bytes');
# now try again after setting utf8 via config()
HTML::Template->config(utf8 => 1);
$tmpl = eval { HTML::Template->new(filename => 'utf8-test.tmpl') };
ok(!$@, 'no exception thrown');
isa_ok($tmpl, 'HTML::Template');
$output = $tmpl->output;
chomp($output);
is($output, chr(228), 'correct UTF8 encoded character');
# make sure options pass down into loops
HTML::Template->config(global_vars => 1, die_on_bad_params => 0);
$tmpl = HTML::Template->new_scalar_ref(\'::: ');
$tmpl->param(foo => 'A', bar => [{baz => 'B', fiz => [{fuz => 'Z'},{fuz => 'Y'}]},{baz => 'C', flop => 'D', fiz => [{fuz => 'X', flo => 'D'}]}]);
$output = $tmpl->output;
is($output, 'A B:A B:A:ZB:A:Y C:A C:A:X ', 'options passed down into loops');
is($output, $tmpl->output, 'calling it twice results in the same thing');
# make sure the config hash has changed
%config = HTML::Template->config();
is_deeply(
\%config,
{
'associate' => [],
'blind_cache' => 0,
'cache' => 0,
'cache_debug' => 0,
'cache_lazy_loops' => 0,
'cache_lazy_vars' => 0,
'case_sensitive' => 0,
'debug' => 0,
'die_on_bad_params' => 0,
'die_on_missing_include' => 1,
'double_cache' => 0,
'double_file_cache' => 0,
'file_cache' => 0,
'file_cache_dir' => '',
'file_cache_dir_mode' => 448,
'filter' => [],
'force_untaint' => 0,
'global_vars' => 1,
'ipc_key' => 'TMPL',
'ipc_max_size' => 0,
'ipc_mode' => 438,
'ipc_segment_size' => 65536,
'loop_context_vars' => 0,
'max_includes' => 10,
'memory_debug' => 0,
'no_includes' => 0,
'open_mode' => '',
'path' => ['templates'],
'search_path_on_include' => 0,
'shared_cache' => 0,
'shared_cache_debug' => 0,
'stack_debug' => 0,
'strict' => 1,
'timing' => 0,
'utf8' => 1,
'vanguard_compatibility_mode' => 0
},
'correct changed defaults'
);
# make sure that options passed to new() don't effect the global configs
$tmpl = eval { HTML::Template->new(filename => 'utf8-test.tmpl', utf8 => 0) };
ok(!$@, 'no exception thrown');
isa_ok($tmpl, 'HTML::Template');
$output = $tmpl->output;
chomp($output);
is(sprintf('%vd', $output), "195.164", 'no utf8 config set, so just bytes');
# make sure the config hash hasn't changed
%config = HTML::Template->config();
is_deeply(
\%config,
{
'associate' => [],
'blind_cache' => 0,
'cache' => 0,
'cache_debug' => 0,
'cache_lazy_loops' => 0,
'cache_lazy_vars' => 0,
'case_sensitive' => 0,
'debug' => 0,
'die_on_bad_params' => 0,
'die_on_missing_include' => 1,
'double_cache' => 0,
'double_file_cache' => 0,
'file_cache' => 0,
'file_cache_dir' => '',
'file_cache_dir_mode' => 448,
'filter' => [],
'force_untaint' => 0,
'global_vars' => 1,
'ipc_key' => 'TMPL',
'ipc_max_size' => 0,
'ipc_mode' => 438,
'ipc_segment_size' => 65536,
'loop_context_vars' => 0,
'max_includes' => 10,
'memory_debug' => 0,
'no_includes' => 0,
'open_mode' => '',
'path' => ['templates'],
'search_path_on_include' => 0,
'shared_cache' => 0,
'shared_cache_debug' => 0,
'stack_debug' => 0,
'strict' => 1,
'timing' => 0,
'utf8' => 1,
'vanguard_compatibility_mode' => 0
},
'defaults unchanged'
);
04-escape.t 100644 001750 001750 22101 12231261777 16525 0 ustar 00mpeters mpeters 000000 000000 HTML-Template-2.95/t use strict;
use Test::More (tests => 117);
use_ok('HTML::Template');
while () {
chomp;
next if /^$/;
next if /^#/;
my ($text, $given, $wanted) = split /\|/;
my $template = HTML::Template->new(
scalarref => \$text,
default_escape => "HTML"
);
undef $given if $given eq 'undef';
$template->param(foo => $given);
my $output = $template->output;
is($output, $wanted, $text);
}
# use pipe as the seperator between fields.
# the TMPL_VAR name should always be 'foo'
# fields: TMPL_VAR|given string|escaped string
__DATA__
# use default escaping
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
|this is bold\n|<b>this is bold\n
# use js escaping
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
|this is bold\n|this is bold\\n
#use url escaping
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
|this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn
# no escaping
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
# no escaping
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
|this is bold\n|this is bold\n
#no escaping and default escaping
|