diff --git a/external/perl/Downloaded.txt b/external/perl/Downloaded.txt index 93b72b1372..dfb1f052cb 100644 --- a/external/perl/Downloaded.txt +++ b/external/perl/Downloaded.txt @@ -10,5 +10,5 @@ Here, we simply list those modules and where we got them from. Downloaded and bundled Perl modules ----------------------------------- -Text::Template 1.46 was downloaded from -http://search.cpan.org/CPAN/authors/id/M/MJ/MJD/Text-Template-1.46.tar.gz +Text::Template 1.56 was downloaded from +https://cpan.metacpan.org/authors/id/M/MS/MSCHOUT/Text-Template-1.56.tar.gz diff --git a/external/perl/MODULES.txt b/external/perl/MODULES.txt index 442b618f0c..799357f4d1 100644 --- a/external/perl/MODULES.txt +++ b/external/perl/MODULES.txt @@ -1 +1 @@ -Text-Template-1.46/lib +Text-Template-1.56/lib diff --git a/external/perl/Text-Template-1.46/Artistic b/external/perl/Text-Template-1.46/Artistic deleted file mode 100644 index 5f221241e8..0000000000 --- a/external/perl/Text-Template-1.46/Artistic +++ /dev/null @@ -1,131 +0,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 as specified below. - - "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 uunet.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) give non-standard executables non-standard names, and clearly - document 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. You may embed this Package's interpreter within -an executable of yours (by linking); this shall be construed as a mere -form of aggregation, provided that the complete Standard Version of the -interpreter is so embedded. - -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 whoever generated -them, and may be sold commercially, and may be aggregated with this -Package. If such scripts or library files are aggregated with this -Package via the so-called "undump" or "unexec" methods of producing a -binary executable image, then distribution of such an image shall -neither be construed as a distribution of this Package nor shall it -fall under the restrictions of Paragraphs 3 and 4, provided that you do -not represent such an executable image as a Standard Version of this -Package. - -7. C subroutines (or comparably compiled subroutines in other -languages) supplied by you and linked into this Package in order to -emulate subroutines and variables of the language defined by this -Package shall not be considered part of this Package, but are the -equivalent of input as in Paragraph 6, provided these subroutines do -not change the language in any way that would cause it to fail the -regression tests for the language. - -8. Aggregation of this Package with a commercial distribution is always -permitted provided that the use of this Package is embedded; that is, -when no overt attempt is made to make this Package's interfaces visible -to the end user of the commercial distribution. Such use shall not be -construed as a distribution of this Package. - -9. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -10. 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 diff --git a/external/perl/Text-Template-1.46/COPYING b/external/perl/Text-Template-1.46/COPYING deleted file mode 100644 index a3f6b12eec..0000000000 --- a/external/perl/Text-Template-1.46/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU 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. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), 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 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 show them these terms so they know 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. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - 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 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 derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 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 License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -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. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary 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 - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 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 Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing 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 for copying, distributing or modifying -the Program or works based on it. - - 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. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. 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 this 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 -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. 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 - - 11. 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. - - 12. 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 the public, 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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) 19yy 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 is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/external/perl/Text-Template-1.46/MANIFEST b/external/perl/Text-Template-1.46/MANIFEST deleted file mode 100644 index 22460fe8ba..0000000000 --- a/external/perl/Text-Template-1.46/MANIFEST +++ /dev/null @@ -1,25 +0,0 @@ -MANIFEST -COPYING -Artistic -Makefile.PL -INSTALL -README -lib/Text/Template.pm -lib/Text/Template/Preprocess.pm -t/00-version.t -t/01-basic.t -t/02-hash.t -t/03-out.t -t/04-safe.t -t/05-safe2.t -t/06-ofh.t -t/07-safe3.t -t/08-exported.t -t/09-error.t -t/10-delimiters.t -t/11-prepend.t -t/12-preprocess.t -t/13-taint.t -t/14-broken.t -META.yml Module meta-data (added by MakeMaker) -META.json Module JSON meta-data (added by MakeMaker) diff --git a/external/perl/Text-Template-1.46/META.json b/external/perl/Text-Template-1.46/META.json deleted file mode 100644 index 6b335eb948..0000000000 --- a/external/perl/Text-Template-1.46/META.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "abstract" : "unknown", - "author" : [ - "unknown" - ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120630", - "license" : [ - "unknown" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Text-Template", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "runtime" : { - "requires" : {} - } - }, - "release_status" : "stable", - "version" : "1.46" -} diff --git a/external/perl/Text-Template-1.46/META.yml b/external/perl/Text-Template-1.46/META.yml deleted file mode 100644 index a2e2715941..0000000000 --- a/external/perl/Text-Template-1.46/META.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -abstract: unknown -author: - - unknown -build_requires: - ExtUtils::MakeMaker: 0 -configure_requires: - ExtUtils::MakeMaker: 0 -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120630' -license: unknown -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -name: Text-Template -no_index: - directory: - - t - - inc -requires: {} -version: 1.46 diff --git a/external/perl/Text-Template-1.46/Makefile.PL b/external/perl/Text-Template-1.46/Makefile.PL deleted file mode 100644 index 491e03cb02..0000000000 --- a/external/perl/Text-Template-1.46/Makefile.PL +++ /dev/null @@ -1,7 +0,0 @@ -use ExtUtils::MakeMaker; -WriteMakefile( - NAME => 'Text::Template', - VERSION_FROM => 'lib/Text/Template.pm', -# 'linkext' => {LINKTYPE => ''}, - 'dist' => {COMPRESS => 'gzip', SUFFIX => 'gz'}, -); diff --git a/external/perl/Text-Template-1.46/README b/external/perl/Text-Template-1.46/README deleted file mode 100644 index e184d8cd2f..0000000000 --- a/external/perl/Text-Template-1.46/README +++ /dev/null @@ -1,339 +0,0 @@ - -Text::Template v1.46 - -This is a library for generating form letters, building HTML pages, or -filling in templates generally. A `template' is a piece of text that -has little Perl programs embedded in it here and there. When you -`fill in' a template, you evaluate the little programs and replace -them with their values. - -Here's an example of a template: - - Dear {$title} {$lastname}, - - It has come to our attention that you are delinquent in your - {$monthname[$last_paid_month]} payment. Please remit - ${sprintf("%.2f", $amount)} immediately, or your patellae may - be needlessly endangered. - - Love, - - Mark "{nickname(rand 20)}" Dominus - - -The result of filling in this template is a string, which might look -something like this: - - Dear Mr. Gates, - - It has come to our attention that you are delinquent in your - February payment. Please remit - $392.12 immediately, or your patellae may - be needlessly endangered. - - - Love, - - Mark "Vizopteryx" Dominus - -You can store a template in a file outside your program. People can -modify the template without modifying the program. You can separate -the formatting details from the main code, and put the formatting -parts of the program into the template. That prevents code bloat and -encourages functional separation. - -You can fill in the template in a `Safe' compartment. This means that -if you don't trust the person who wrote the code in the template, you -won't have to worry that they are tampering with your program when you -execute it. - ----------------------------------------------------------------- - -Text::Template was originally released some time in late 1995 or early -1996. After three years of study and investigation, I rewrote it from -scratch in January 1999. The new version, 1.0, was much faster, -delivered better functionality and was almost 100% backward-compatible -with the previous beta versions. - -I have added a number of useful features and conveniences since the -1.0 release, while still retaining backward compatibility. With one -merely cosmetic change, the current version of Text::Template passes -the test suite that the old beta versions passed. - -Questions or comments should be addressed to -mjd-perl-template+@plover.com. This address goes directly to me, and -not to anyone else; it is not a mailing list address. - -To receive occasional announcements of new versions of T::T, send an -empty note to mjd-perl-template-request@plover.com. This mailing list -is not for discussion; it is for announcements only. Therefore, there -is no address for sending messages to the list. - -You can get the most recent version of Text::Template, news, comments, -and other collateral information from -. - ----------------------------------------------------------------- - -What's new in v1.46 since v1.44: - - Thanks to Rik Signes, there is a new - Text::Template->append_text_to_output method, which - Text::Template always uses whenever it wants to emit output. - You can subclass this to get control over the output, for - example for postprocessing. - - A spurious warning is no longer emitted when the TYPE - parameter to ->new is omitted. - ----------------------------------------------------------------- -What's new in v1.44 since v1.43: - -This is a maintentance release. There are no feature changes. - - _scrubpkg, which was responsible for eptying out temporary - packages after the module had done with them, wasn't always - working; the result was memory-leaks in long-running - applications. This should be fixed now, and there is a test - in the test suite for it. - - Minor changes to the test suite to prevent spurious errors. - - Minor documentation changes. - ----------------------------------------------------------------- -What's new in v1.43 since v1.42: - - The ->new method now fails immediately and sets - $Text::Template::ERROR if the file that is named by a filename - argument does not exist or cannot be opened for some other - reason. Formerly, the constructor would succeed and the - ->fill_in call would fail. - ----------------------------------------------------------------- - -What's new in v1.42 since v1.41: - -This is a maintentance release. There are no feature changes. - - Fixed a bug relating to use of UNTAINT under perl 5.005_03 and - possibly other versions. - - Taint-related tests are now more comprehensive. ----------------------------------------------------------------- - -What's new in v1.41 since v1.40: - -This is a maintentance release. There are no feature changes. - - Tests now work correctly on Windows systems and possibly on - other non-unix systems. - ----------------------------------------------------------------- - -What's new in v1.40 since v1.31: - - New UNTAINT option tells the module that it is safe to 'eval' - code even though it has come from a file or filehandle. - - Code added to prevent memory leaks when filling many - templates. Thanks to Itamar Almeida de Carvalho. - - Bug fix: $OUT was not correctly initialized when used in - conjunction with SAFE. - - You may now use a glob ref when passing a filehandle to the - ->new funcion. Formerly, a glob was reuqired. - - New subclass: Text::Template::Preprocess. Just like - Text::Template, but you may supply a PREPROCESS option in the - constructor or the fill_in call; this is a function which - receives each code fragment prior to evaluation, and which may - modify and return the fragment; the modified fragment is what - is evaluated. - - Error messages passed to BROKEN subroutines will now report - the correct line number of the template at which the error - occurred: - - Illegal division by zero at template line 37. - - If the template comes from a file, the filename will be - reported as well: - - Illegal division by zero at catalog.tmpl line 37. - - - INCOMPATIBLE CHANGE: - - The format of the default error message has changed. It used - to look like: - - Program fragment at line 30 delivered error ``Illegal division by zero'' - - It now looks like: - - Program fragment delivered error ``Illegal division by zero at catalog.tmpl line 37'' - - Note that the default message used to report the line number - at which the program fragment began; it now reports the line - number at which the error actually occurred. - ----------------------------------------------------------------- -What's new in v1.31 since v1.23: - - Just bug fixes---fill_in_string was failing. Thanks to - Donald L. Greer Jr. for the test case. - ----------------------------------------------------------------- -What's new in v1.23 since v1.22: - - Small bug fix: DELIMITER and other arguments were being - ignored in calls to fill_in_file and fill_this_in. (Thanks to - Jonathan Roy for reporting this.) - ----------------------------------------------------------------- -What's new in v1.22 since v1.20: - - You can now specify that certain Perl statements be prepended - to the beginning of every program fragment in a template, - either per template, or for all templates, or for the duration - of only one call to fill_in. This is useful, for example, if - you want to enable `strict' checks in your templates but you - don't want to manually add `use strict' to the front of every - program fragment everywhere. - ----------------------------------------------------------------- -What's new in v1.20 since v1.12: - - You can now specify that the program fragment delimiters are - strings other than { and }. This has three interesting - effects: First, it changes the delimiter strings. Second, it - disables the special meaning of \, so you have to be really, - really sure that the delimiters will not appear in your - templates. And third, because of the simplifications - introduced by the elimination of \ processing, template - parsing is 20-25% faster. - - See the manual section on `Alternative Delimiters'. - - Fixed bug having to do with undefined values in HASH options. - In particular, Text::Template no longer generates a warning if - you try to give a variable an undefined value. - ----------------------------------------------------------------- - -What's new in v1.12 since v1.11: - - I forgot to say that Text::Template ISA Exporter, so the - exported functions never got exported. Duhhh! - - Template TYPEs are now case-insensitive. The `new' method now - diagnoses attempts to use an invalid TYPE. - - More tests for these things. - ----------------------------------------------------------------- - -What's new in v1.11 since v1.10: - - Fixed a bug in the way backslashes were processed. The 1.10 - behavior was incompatible with the beta versions and was also - inconvenient. (`\n' in templates was replaced with `n' before - it was given to Perl for evaluation.) The new behavior is - also incompatible with the beta versions, but it is only a - little bit incompatible, and it is probbaly better. - - Documentation for the new behavior, and tests for the bug. - ----------------------------------------------------------------- - -What's new in v1.10 since v1.03: - - New OUTPUT option delivers template results directly to a - filehandle instead of making them into a string. Saves space - and time. - - PACKAGE and HASH now work intelligently with SAFE. - - Fragments may now output data directly to the template, rather - than having to arrange to return it as a return value at the - end. This means that where you used to have to write this: - - { my $blist = ''; - foreach $i (@items) { - $blist .= qq{ * $i\n}; - } - $blist; - } - - You can now write this instead, because $OUT is special. - - { foreach $i (@items) { - $OUT.= " * $i\n"; - } - } - - (`A spoonful of sugar makes the medicine go down.') - - Fixed some small bugs. Worked around a bug in Perl that does - the wrong thing with $x = when $x contains a glob. - - More documentation. Errors fixed. - - Lots more tests. - ----------------------------------------------------------------- - -What's new in v1.03 since v1.0: - - Code added to support HASH option to fill_in. - (Incl. `_gensym' function.) - - Documentation for HASH. - - New test file for HASH. - - Note about failure of lexical variables to propagate into - templates. Why does this surprise people? - - Bug fix: program fragments are evaluated in an environment with - `no strict' by default. Otherwise, you get a lot of `Global - symbol "$v" requires explicit package name' failures. Why didn't - the test program pick this up? Because the only variable the test - program ever used was `$a', which is exempt. Duhhhhh. - - Fixed the test program. - - Various minor documentation fixes. - - - ----------------------------------------------------------------- - -Improvements of 1.0 over the old 0.1beta: - -New features: - - At least twice as fast - - Better support for filling out the same template more than once - - Now supports evaluation of program fragments in Safe - compartments. (Thanks, Jonathan!) - - Better argument syntax - - More convenience functions - - The parser is much better and simpler. - - Once a template is parsed, the parsed version is stored so that - it needn't be parsed again. - - BROKEN function behavior is rationalized. You can now pass an - arbitrary argument to your BROKEN function, or return a value - from it to the main program. - - Documentation overhauled. - diff --git a/external/perl/Text-Template-1.46/t/00-version.t b/external/perl/Text-Template-1.46/t/00-version.t deleted file mode 100644 index 5f9560f898..0000000000 --- a/external/perl/Text-Template-1.46/t/00-version.t +++ /dev/null @@ -1,11 +0,0 @@ -#!perl - -use Text::Template; -print "1..1\n"; - -if ($Text::Template::VERSION == 1.46) { - print "ok 1\n"; -} else { - print "not ok 1\n"; -} - diff --git a/external/perl/Text-Template-1.46/t/01-basic.t b/external/perl/Text-Template-1.46/t/01-basic.t deleted file mode 100644 index be43390c67..0000000000 --- a/external/perl/Text-Template-1.46/t/01-basic.t +++ /dev/null @@ -1,266 +0,0 @@ -#!perl -# -# Tests of basic, essential functionality -# - -use Text::Template; -$X::v = $Y::v = 0; # Suppress `var used only once' - -print "1..31\n"; - -$n=1; - -$template_1 = < {\$v} -We will evaluate 1+1 here -> {1 + 1} -EOM - -# (1) Construct temporary template file for testing -# file operations -$TEMPFILE = "tt$$"; -open(TMP, "> $TEMPFILE") or print "not ok $n\n" && &abort("Couldn\'t write tempfile $TEMPFILE: $!"); -print TMP $template_1; -close TMP; -print "ok $n\n"; $n++; - -# (2) Build template from file -$template = new Text::Template ('type' => 'FILE', 'source' => $TEMPFILE); -if (defined($template)) { - print "ok $n\n"; -} else { - print "not ok $n $Text::Template::ERROR\n"; -} -$n++; - -# (3) Fill in template from file -$X::v = "abc"; -$resultX = < abc -We will evaluate 1+1 here -> 2 -EOM -$Y::v = "ABC"; -$resultY = < ABC -We will evaluate 1+1 here -> 2 -EOM - -$text = $template->fill_in('package' => X); -if ($text eq $resultX) { - print "ok $n\n"; -} else { - print "not ok $n\n"; -} -$n++; - -# (4) Fill in same template again -$text = $template->fill_in('package' => Y); -if ($text eq $resultY) { - print "ok $n\n"; -} else { - print "not ok $n\n"; -} -$n++; - - - -# (5) Simple test of `fill_this_in' -$text = Text::Template->fill_this_in( $template_1, 'package' => X); -if ($text eq $resultX) { - print "ok $n\n"; -} else { - print "not ok $n\n"; -} -$n++; - -# (6) test creation of template from filehandle -if (open (TMPL, "< $TEMPFILE")) { - $template = new Text::Template ('type' => 'FILEHANDLE', - 'source' => *TMPL); - if (defined($template)) { - print "ok $n\n"; - } else { - print "not ok $n $Text::Template::ERROR\n"; - } - $n++; - -# (7) test filling in of template from filehandle - $text = $template->fill_in('package' => X); - if ($text eq $resultX) { - print "ok $n\n"; - } else { - print "not ok $n\n"; - } - $n++; - -# (8) test second fill_in on same template object - $text = $template->fill_in('package' => Y); - if ($text eq $resultY) { - print "ok $n\n"; - } else { - print "not ok $n\n"; - } - $n++; - close TMPL; -} else { - print "not ok $n\n"; $n++; - print "not ok $n\n"; $n++; - print "not ok $n\n"; $n++; -} - - -# (9) test creation of template from array -$template = new Text::Template - ('type' => 'ARRAY', - 'source' => [ - 'We will put value of $v (which is "abc") here -> {$v}', - "\n", - 'We will evaluate 1+1 here -> {1+1}', - "\n", - ]); -if (defined($template)) { - print "ok $n\n"; -} else { - print "not ok $n $Text::Template::ERROR\n"; -} -$n++; - -# (10) test filling in of template from array -$text = $template->fill_in('package' => X); -if ($text eq $resultX) { - print "ok $n\n"; -} else { - print "not ok $n\n"; -} -$n++; - -# (11) test second fill_in on same array template object -$text = $template->fill_in('package' => Y); -if ($text eq $resultY) { - print "ok $n\n"; -} else { - print "not ok $n\n"; - print STDERR "$resultX\n---\n$text"; - unless (!defined($text)) { print STDERR "ERROR: $Text::Template::ERROR\n"}; -} -$n++; - - - -# (12) Make sure \ is working properly -# Test added for version 1.11 -my $tmpl = Text::Template->new(TYPE => 'STRING', - SOURCE => 'B{"\\}"}C{"\\{"}D', - ); -# This should fail if the \ are not interpreted properly. -my $text = $tmpl->fill_in(); -print +($text eq "B}C{D" ? '' : 'not '), "ok $n\n"; -$n++; - -# (13) Make sure \ is working properly -# Test added for version 1.11 -$tmpl = Text::Template->new(TYPE => 'STRING', - SOURCE => qq{A{"\t"}B}, - ); -# Symptom of old problem: ALL \ were special in templates, so -# The lexer would return (A, PROGTEXT("t"), B), and the -# result text would be AtB instead of A(tab)B. -$text = $tmpl->fill_in(); - -print +($text eq "A\tB" ? '' : 'not '), "ok $n\n"; -$n++; - -# (14-27) Make sure \ is working properly -# Test added for version 1.11 -# This is a sort of general test. -my @tests = ('{""}' => '', # (14) - '{"}"}' => undef, # (15) - '{"\\}"}' => '}', # One backslash - '{"\\\\}"}' => undef, # Two backslashes - '{"\\\\\\}"}' => '}', # Three backslashes - '{"\\\\\\\\}"}' => undef, # Four backslashes - '{"\\\\\\\\\\}"}' => '\}', # Five backslashes (20) - '{"x20"}' => 'x20', - '{"\\x20"}' => ' ', # One backslash - '{"\\\\x20"}' => '\\x20', # Two backslashes - '{"\\\\\\x20"}' => '\\ ', # Three backslashes - '{"\\\\\\\\x20"}' => '\\\\x20', # Four backslashes (25) - '{"\\\\\\\\\\x20"}' => '\\\\ ', # Five backslashes - '{"\\x20\\}"}' => ' }', # (27) - ); - -my $i; -for ($i=0; $i<@tests; $i+=2) { - my $tmpl = Text::Template->new(TYPE => 'STRING', - SOURCE => $tests[$i], - ); - my $text = $tmpl->fill_in; - my $result = $tests[$i+1]; - my $ok = (! defined $text && ! defined $result - || $text eq $result); - unless ($ok) { - print STDERR "($n) expected .$result., got .$text.\n"; - } - print +($ok ? '' : 'not '), "ok $n\n"; - $n++; -} - - -# (28-30) I discovered that you can't pass a glob ref as your filehandle. -# MJD 20010827 -# (28) test creation of template from filehandle -if (open (TMPL, "< $TEMPFILE")) { - $template = new Text::Template ('type' => 'FILEHANDLE', - 'source' => \*TMPL); - if (defined($template)) { - print "ok $n\n"; - } else { - print "not ok $n $Text::Template::ERROR\n"; - } - $n++; - -# (29) test filling in of template from filehandle - $text = $template->fill_in('package' => X); - if ($text eq $resultX) { - print "ok $n\n"; - } else { - print "not ok $n\n"; - } - $n++; - -# (30) test second fill_in on same template object - $text = $template->fill_in('package' => Y); - if ($text eq $resultY) { - print "ok $n\n"; - } else { - print "not ok $n\n"; - } - $n++; - close TMPL; -} else { - print "not ok $n\n"; $n++; - print "not ok $n\n"; $n++; - print "not ok $n\n"; $n++; -} - -# (31) Test _scrubpkg for leakiness -$Text::Template::GEN0::test = 1; -Text::Template::_scrubpkg('Text::Template::GEN0'); -if ($Text::Template::GEN0::test) { - print "not ok $n\n"; -} else { - print "ok $n\n"; -} -$n++; - - -END {unlink $TEMPFILE;} - -exit; - - - - -sub abort { - unlink $TEMPFILE; - die $_[0]; -} diff --git a/external/perl/Text-Template-1.46/t/02-hash.t b/external/perl/Text-Template-1.46/t/02-hash.t deleted file mode 100644 index 29ba51a40e..0000000000 --- a/external/perl/Text-Template-1.46/t/02-hash.t +++ /dev/null @@ -1,111 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - - -print "1..12\n"; - -$n=1; - -$template = 'We will put value of $v (which is "good") here -> {$v}'; - -$v = 'oops (main)'; -$Q::v = 'oops (Q)'; - -$vars = { 'v' => \'good' }; - -# (1) Build template from string -$template = new Text::Template ('type' => 'STRING', 'source' => $template); -print +($template ? '' : 'not '), "ok $n\n"; -$n++; - -# (2) Fill in template in anonymous package -$result2 = 'We will put value of $v (which is "good") here -> good'; -$text = $template->fill_in(HASH => $vars); -print +($text eq $result2 ? '' : 'not '), "ok $n\n"; -$n++; - -# (3) Did we clobber the main variable? -print +($v eq 'oops (main)' ? '' : 'not '), "ok $n\n"; -$n++; - -# (4) Fill in same template again -$result4 = 'We will put value of $v (which is "good") here -> good'; -$text = $template->fill_in(HASH => $vars); -print +($text eq $result4 ? '' : 'not '), "ok $n\n"; -$n++; - -# (5) Now with a package -$result5 = 'We will put value of $v (which is "good") here -> good'; -$text = $template->fill_in(HASH => $vars, PACKAGE => 'Q'); -print +($text eq $result5 ? '' : 'not '), "ok $n\n"; -$n++; - -# (6) We expect to have clobbered the Q variable. -print +($Q::v eq 'good' ? '' : 'not '), "ok $n\n"; -$n++; - -# (7) Now let's try it without a package -$result7 = 'We will put value of $v (which is "good") here -> good'; -$text = $template->fill_in(HASH => $vars); -print +($text eq $result7 ? '' : 'not '), "ok $n\n"; -$n++; - -# (8-11) Now what does it do when we pass a hash with undefined values? -# Roy says it does something bad. (Added for 1.20.) -my $WARNINGS = 0; -{ - local $SIG{__WARN__} = sub {$WARNINGS++}; - local $^W = 1; # Make sure this is on for this test - $template8 = 'We will put value of $v (which is "good") here -> {defined $v ? "bad" : "good"}'; - $result8 = 'We will put value of $v (which is "good") here -> good'; - my $template = - new Text::Template ('type' => 'STRING', 'source' => $template8); - my $text = $template->fill_in(HASH => {'v' => undef}); - # (8) Did we generate a warning? - print +($WARNINGS == 0 ? '' : 'not '), "ok $n\n"; - $n++; - - # (9) Was the output correct? - print +($text eq $result8 ? '' : 'not '), "ok $n\n"; - $n++; - - # (10-11) Let's try that again, with a twist this time - $WARNINGS = 0; - $text = $template->fill_in(HASH => [{'v' => 17}, {'v' => undef}]); - # (10) Did we generate a warning? - print +($WARNINGS == 0 ? '' : 'not '), "ok $n\n"; - $n++; - - # (11) Was the output correct? - if ($] < 5.005) { - print "ok $n # skipped -- not supported before 5.005\n"; - } else { - print +($text eq $result8 ? '' : 'not '), "ok $n\n"; - } - $n++; -} - - -# (12) Now we'll test the multiple-hash option (Added for 1.20.) -$text = Text::Template::fill_in_string(q{$v: {$v}. @v: [{"@v"}].}, - HASH => [{'v' => 17}, - {'v' => ['a', 'b', 'c']}, - {'v' => \23}, - ]); -$result = q{$v: 23. @v: [a b c].}; -print +($text eq $result ? '' : 'not '), "ok $n\n"; -$n++; - - -exit; - diff --git a/external/perl/Text-Template-1.46/t/03-out.t b/external/perl/Text-Template-1.46/t/03-out.t deleted file mode 100644 index 0ba65a54dc..0000000000 --- a/external/perl/Text-Template-1.46/t/03-out.t +++ /dev/null @@ -1,56 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. -# - -use Text::Template; - -die "This is the test program for Text::Template version 1.46 -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..1\n"; - -$n=1; - -$template = q{ -This line should have a 3: {1+2} - -This line should have several numbers: -{ $t = ''; foreach $n (1 .. 20) { $t .= $n . ' ' } $t } -}; - -$templateOUT = q{ -This line should have a 3: { $OUT = 1+2 } - -This line should have several numbers: -{ foreach $n (1 .. 20) { $OUT .= $n . ' ' } } -}; - -# Build templates from string -$template = new Text::Template ('type' => 'STRING', 'source' => $template) - or die; -$templateOUT = new Text::Template ('type' => 'STRING', 'source' => $templateOUT) - or die; - -# Fill in templates -$text = $template->fill_in() - or die; -$textOUT = $templateOUT->fill_in() - or die; - -# (1) They should be the same -print +($text eq $textOUT ? '' : 'not '), "ok $n\n"; -$n++; - -# Missing: Test this feature in Safe compartments; -# it's a totally different code path. -# Decision: Put that into safe.t, because that file should -# be skipped when Safe.pm is unavailable. - - -exit; - diff --git a/external/perl/Text-Template-1.46/t/04-safe.t b/external/perl/Text-Template-1.46/t/04-safe.t deleted file mode 100644 index 4c07121b44..0000000000 --- a/external/perl/Text-Template-1.46/t/04-safe.t +++ /dev/null @@ -1,161 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template; - -BEGIN { - eval "use Safe"; - if ($@) { - print "1..0\n"; - exit 0; - } -} - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..16\n"; - -if ($^O eq 'MacOS') { - $BADOP = qq{}; - $FAILURE = q{}; -} else { - $BADOP = qq{kill 0}; - $FAILURE = q{Program fragment at line 1 delivered error ``kill trapped by operation mask''}; -} - -$n=1; -$v = $v = 119; - -$c = new Safe or die; - -$goodtemplate = q{This should succeed: { $v }}; -$goodoutput = q{This should succeed: 119}; - -$template1 = new Text::Template ('type' => 'STRING', 'source' => $goodtemplate) - or die; -$template2 = new Text::Template ('type' => 'STRING', 'source' => $goodtemplate) - or die; - -$text1 = $template1->fill_in(); -$text2 = $template1->fill_in(SAFE => $c); -$ERR2 = $@; -$text3 = $template2->fill_in(SAFE => $c); -$ERR3 = $@; - -# (1)(2)(3) None of these should have failed. -print +(defined $text1 ? '' : 'not '), "ok $n\n"; -$n++; -print +(defined $text2 ? '' : 'not '), "ok $n\n"; -$n++; -print +(defined $text3 ? '' : 'not '), "ok $n\n"; -$n++; - -# (4) Safe and non-safe fills of different template objects with the -# same template text should yield the same result. -# print +($text1 eq $text3 ? '' : 'not '), "ok $n\n"; -# (4) voided this test: it's not true, because the unsafe fill -# uses package main, while the safe fill uses the secret safe package. -# We could alias the secret safe package to be identical to main, -# but that wouldn't be safe. If you want the aliasing, you have to -# request it explicitly with `PACKAGE'. -print "ok $n\n"; -$n++; - -# (5) Safe and non-safe fills of the same template object -# should yield the same result. -# (5) voided this test for the same reason as #4. -# print +($text1 eq $text2 ? '' : 'not '), "ok $n\n"; -print "ok $n\n"; -$n++; - -# (6) Make sure the output was actually correct -print +($text1 eq $goodoutput ? '' : 'not '), "ok $n\n"; -$n++; - - -$badtemplate = qq{This should fail: { $BADOP; 'NOFAIL' }}; -$badnosafeoutput = q{This should fail: NOFAIL}; -$badsafeoutput = q{This should fail: Program fragment delivered error ``kill trapped by operation mask at template line 1.''}; - -$template1 = new Text::Template ('type' => 'STRING', 'source' => $badtemplate) - or die; -$template2 = new Text::Template ('type' => 'STRING', 'source' => $badtemplate) - or die; - -$text1 = $template1->fill_in(); -$text2 = $template1->fill_in(SAFE => $c); -$ERR2 = $@; -$text3 = $template2->fill_in(SAFE => $c); -$ERR3 = $@; -$text4 = $template1->fill_in(); - -# (7)(8)(9)(10) None of these should have failed. -print +(defined $text1 ? '' : 'not '), "ok $n\n"; -$n++; -print +(defined $text2 ? '' : 'not '), "ok $n\n"; -$n++; -print +(defined $text3 ? '' : 'not '), "ok $n\n"; -$n++; -print +(defined $text4 ? '' : 'not '), "ok $n\n"; -$n++; - -# (11) text1 and text4 should be the same (using safe in between -# didn't change anything.) -print +($text1 eq $text4 ? '' : 'not '), "ok $n\n"; -$n++; - -# (12) text2 and text3 should be the same (same template text in different -# objects -print +($text2 eq $text3 ? '' : 'not '), "ok $n\n"; -$n++; - -# (13) text1 should yield badnosafeoutput -print +($text1 eq $badnosafeoutput ? '' : 'not '), "ok $n\n"; -$n++; - -# (14) text2 should yield badsafeoutput -$text2 =~ s/'kill'/kill/; # 5.8.1 added quote marks around the op name -print "# expected: <$badsafeoutput>\n# got : <$text2>\n"; -print +($text2 eq $badsafeoutput ? '' : 'not '), "ok $n\n"; -$n++; - - -$template = q{{$x=1}{$x+1}}; - -$template1 = new Text::Template ('type' => 'STRING', 'source' => $template) - or die; -$template2 = new Text::Template ('type' => 'STRING', 'source' => $template) - or die; - -$text1 = $template1->fill_in(); -$text2 = $template1->fill_in(SAFE => new Safe); - -# (15) Do effects persist in safe compartments? -print +($text1 eq $text2 ? '' : 'not '), "ok $n\n"; -$n++; - -# (16) Try the BROKEN routine in safe compartments -sub my_broken { - my %a = @_; $a{error} =~ s/ at.*//s; - "OK! text:$a{text} error:$a{error} lineno:$a{lineno} arg:$a{arg}" ; -} -$templateB = new Text::Template (TYPE => 'STRING', SOURCE => '{die}') - or die; -$text1 = $templateB->fill_in(BROKEN => \&my_broken, - BROKEN_ARG => 'barg', - SAFE => new Safe, - ); -$result1 = qq{OK! text:die error:Died lineno:1 arg:barg}; -print +($text1 eq $result1 ? '' : 'not '), "ok $n\n"; -$n++; - - - -exit; - diff --git a/external/perl/Text-Template-1.46/t/05-safe2.t b/external/perl/Text-Template-1.46/t/05-safe2.t deleted file mode 100644 index 03534770f1..0000000000 --- a/external/perl/Text-Template-1.46/t/05-safe2.t +++ /dev/null @@ -1,105 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template; - -BEGIN { - eval "use Safe"; - if ($@) { - print "1..0\n"; - exit 0; - } -} - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..12\n"; -$n = 1; - -$c = new Safe or die; - -# Test handling of packages and importing. -$c->reval('$P = "safe root"'); -$P = $P = 'main'; -$Q::P = $Q::P = 'Q'; - -# How to effectively test the gensymming? - -$t = new Text::Template TYPE => 'STRING', SOURCE => 'package is {$P}' - or die; - -# (1) Default behavior: Inherit from calling package, `main' in this case. -$text = $t->fill_in(); -print +($text eq 'package is main' ? '' : 'not '), "ok $n\n"; -$n++; - -# (2) When a package is specified, we should use that package instead. -$text = $t->fill_in(PACKAGE => 'Q'); -print +($text eq 'package is Q' ? '' : 'not '), "ok $n\n"; -$n++; - -# (3) When no package is specified in safe mode, we should use the -# default safe root. -$text = $t->fill_in(SAFE => $c); -print +($text eq 'package is safe root' ? '' : 'not '), "ok $n\n"; -$n++; - -# (4) When a package is specified in safe mode, we should use the -# default safe root, after aliasing to the specified package -$text = $t->fill_in(SAFE => $c, PACKAGE => Q); -print +($text eq 'package is Q' ? '' : 'not '), "ok $n\n"; -$n++; - -# Now let's see if hash vars are installed properly into safe templates -$t = new Text::Template TYPE => 'STRING', SOURCE => 'hash is {$H}' - or die; - -# (5) First in default mode -$text = $t->fill_in(HASH => {H => 'good5'} ); -print +($text eq 'hash is good5' ? '' : 'not '), "ok $n\n"; -$n++; - -# (6) Now in packages -$text = $t->fill_in(HASH => {H => 'good6'}, PACKAGE => 'Q' ); -print +($text eq 'hash is good6' ? '' : 'not '), "ok $n\n"; -$n++; - -# (7) Now in the default root of the safe compartment -$text = $t->fill_in(HASH => {H => 'good7'}, SAFE => $c ); -print +($text eq 'hash is good7' ? '' : 'not '), "ok $n\n"; -$n++; - -# (8) Now in the default root after aliasing to a package that -# got the hash stuffed in -$text = $t->fill_in(HASH => {H => 'good8'}, SAFE => $c, PACKAGE => 'Q2' ); -print +($text eq 'hash is good8' ? '' : 'not '), "ok $n\n"; -$n++; - -# Now let's make sure that none of the packages leaked on each other. -# (9) This var should NOT have been installed into the main package -print +(defined $H ? 'not ' : ''), "ok $n\n"; -$H=$H; -$n++; - -# (10) good6 was overwritten in test 7, so there's nothing to test for here. -print "ok $n\n"; -$n++; - -# (11) this value overwrote the one from test 6. -print +($Q::H eq 'good7' ? '' : 'not '), "ok $n\n"; -$Q::H = $Q::H; -$n++; - -# (12) -print +($Q2::H eq 'good8' ? '' : 'not '), "ok $n\n"; -$Q2::H = $Q2::H; -$n++; - - - diff --git a/external/perl/Text-Template-1.46/t/06-ofh.t b/external/perl/Text-Template-1.46/t/06-ofh.t deleted file mode 100644 index 6865ad1945..0000000000 --- a/external/perl/Text-Template-1.46/t/06-ofh.t +++ /dev/null @@ -1,39 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..2\n"; - -$n=1; - -$template = new Text::Template TYPE => STRING, SOURCE => q{My process ID is {$$}}; -$of = "t$$"; -END { unlink $of } -open O, "> $of" or die; - -$text = $template->fill_in(OUTPUT => \*O); - -# (1) No $text should have been constructed. Return value should be true. -print +($text eq '1' ? '' : 'not '), "ok $n\n"; -$n++; - -close O or die; -open I, "< $of" or die; -{ local $/; $t = } -close I; - -# (2) The text should have been printed to the file -print +($t eq "My process ID is $$" ? '' : 'not '), "ok $n\n"; -$n++; - -exit; - diff --git a/external/perl/Text-Template-1.46/t/07-safe3.t b/external/perl/Text-Template-1.46/t/07-safe3.t deleted file mode 100644 index 5f438f6148..0000000000 --- a/external/perl/Text-Template-1.46/t/07-safe3.t +++ /dev/null @@ -1,91 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module - -use Text::Template; - -BEGIN { - eval "use Safe"; - if ($@) { - print "1..0\n"; - exit 0; - } -} - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..3\n"; - -$n=1; - -# Test the OUT feature with safe compartments - -$template = q{ -This line should have a 3: {1+2} - -This line should have several numbers: -{ $t = ''; foreach $n (1 .. 20) { $t .= $n . ' ' } $t } -}; - -$templateOUT = q{ -This line should have a 3: { $OUT = 1+2 } - -This line should have several numbers: -{ foreach $n (1 .. 20) { $OUT .= $n . ' ' } } -}; - -$c = new Safe; - -# Build templates from string -$template = new Text::Template ('type' => 'STRING', 'source' => $template, - SAFE => $c) - or die; -$templateOUT = new Text::Template ('type' => 'STRING', 'source' => $templateOUT, - SAFE => $c) - or die; - -# Fill in templates -$text = $template->fill_in() - or die; -$textOUT = $templateOUT->fill_in() - or die; - -# (1) They should be the same -print +($text eq $textOUT ? '' : 'not '), "ok $n\n"; -$n++; - -# (2-3) "Joel Appelbaum" <000701c0ac2c$aed1d6e0$0201a8c0@prime> -# "Contrary to the documentation the $OUT variable is not always -# undefined at the start of each program fragment. The $OUT variable -# is never undefined after it is used once if you are using the SAFE -# option. The result is that every fragment after the fragment that -# $OUT was used in is replaced by the old $OUT value instead of the -# result of the fragment. This holds true even after the -# Text::Template object goes out of scope and a new one is created!" -# -# Also reported by Daini Xie. - -{ - my $template = q{{$OUT = 'x'}y{$OUT .= 'z'}}; - my $expected = "xyz"; - my $s = Safe->new; - my $o = Text::Template->new(type => 'string', - source => $template, - ); - for (1..2) { - my $r = $o->fill_in(SAFE => $s); - if ($r ne $expected) { - print "not ok $n # <$r>\n"; - } else { - print "ok $n\n"; - } - $n++; - } -} - -exit; - diff --git a/external/perl/Text-Template-1.46/t/08-exported.t b/external/perl/Text-Template-1.46/t/08-exported.t deleted file mode 100644 index ef9cfafdee..0000000000 --- a/external/perl/Text-Template-1.46/t/08-exported.t +++ /dev/null @@ -1,75 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template 'fill_in_file', 'fill_in_string'; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..6\n"; - -$n=1; -$Q::n = $Q::n = 119; - -# (1) Test fill_in_string -$out = fill_in_string('The value of $n is {$n}.', PACKAGE => 'Q' ); -print +($out eq 'The value of $n is 119.' ? '' : 'not '), "ok $n\n"; -$n++; - -# (2) Test fill_in_file -$TEMPFILE = "tt$$"; -open F, "> $TEMPFILE" or die "Couldn't open test file: $!; aborting"; -print F 'The value of $n is {$n}.', "\n"; -close F or die "Couldn't write test file: $!; aborting"; -$R::n = $R::n = 8128; - -$out = fill_in_file($TEMPFILE, PACKAGE => 'R'); -print +($out eq "The value of \$n is 8128.\n" ? '' : 'not '), "ok $n\n"; -$n++; - -# (3) Jonathan Roy reported this bug: -open F, "> $TEMPFILE" or die "Couldn't open test file: $!; aborting"; -print F "With a message here? [% \$var %]\n"; -close F or die "Couldn't close test file: $!; aborting"; -$out = fill_in_file($TEMPFILE, DELIMITERS => ['[%', '%]'], - HASH => { "var" => \"It is good!" }); -print +($out eq "With a message here? It is good!\n" ? '' : 'not '), "ok $n\n"; -$n++; - -# (4) It probably occurs in fill_this_in also: -$out = - Text::Template->fill_this_in("With a message here? [% \$var %]\n", - DELIMITERS => ['[%', '%]'], - HASH => { "var" => \"It is good!" }); -print +($out eq "With a message here? It is good!\n" ? '' : 'not '), "ok $n\n"; -$n++; - -# (5) This test failed in 1.25. It was supplied by Donald L. Greer Jr. -# Note that it's different from (1) in that there's no explicit -# package=> argument. -use vars qw($string $foo $r); -$string='Hello {$foo}'; -$foo="Don"; -$r = fill_in_string($string); -print (($r eq 'Hello Don' ? '' : 'not '), 'ok ', $n++, "\n"); - -# (6) This test failed in 1.25. It's a variation on (5) -package Q2; -use Text::Template 'fill_in_string'; -use vars qw($string $foo $r); -$string='Hello {$foo}'; -$foo="Don"; -$r = fill_in_string($string); -print (($r eq 'Hello Don' ? '' : 'not '), 'ok ', $main::n++, "\n"); - -package main; - -END { $TEMPFILE && unlink $TEMPFILE } - -exit; - diff --git a/external/perl/Text-Template-1.46/t/09-error.t b/external/perl/Text-Template-1.46/t/09-error.t deleted file mode 100644 index 40f9fac6cb..0000000000 --- a/external/perl/Text-Template-1.46/t/09-error.t +++ /dev/null @@ -1,63 +0,0 @@ -#!perl -# -# test apparatus for Text::Template module -# still incomplete. - -use Text::Template; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..5\n"; -$n = 1; - -# (1-2) Missing source -eval { - Text::Template->new(); -}; -unless ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) { - print STDERR $@; - print "not "; -} -print "ok $n\n"; -$n++; - -eval { - Text::Template->new(TYPE => 'FILE'); -}; -if ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) { - print "ok $n\n"; -} else { - print STDERR $@; - print "not ok $n\n"; -} -$n++; - -# (3) Invalid type -eval { - Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food'); -}; -if ($@ =~ /^\QIllegal value `WLUNCH' for TYPE parameter/) { - print "ok $n\n"; -} else { - print STDERR $@; - print "not ok $n\n"; -} -$n++; - -# (4-5) File does not exist -my $o = Text::Template->new(TYPE => 'file', - SOURCE => 'this file does not exist'); -print $o ? "not ok $n\n" : "ok $n\n"; -$n++; -print defined($Text::Template::ERROR) - && $Text::Template::ERROR =~ /^Couldn't open file/ - ? "ok $n\n" : "not ok $n\n"; -$n++; - - -exit; - diff --git a/external/perl/Text-Template-1.46/t/10-delimiters.t b/external/perl/Text-Template-1.46/t/10-delimiters.t deleted file mode 100644 index f74d591cc7..0000000000 --- a/external/perl/Text-Template-1.46/t/10-delimiters.t +++ /dev/null @@ -1,99 +0,0 @@ -#!perl -# -# Tests for user-specified delimiter functions -# These tests first appeared in version 1.20. - -use Text::Template; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..18\n"; -$n = 1; - -# (1) Try a simple delimiter: <<..>> -# First with the delimiters specified at object creation time -$V = $V = 119; -$template = q{The value of $V is <<$V>>.}; -$result = q{The value of $V is 119.}; -$template1 = Text::Template->new(TYPE => STRING, - SOURCE => $template, - DELIMITERS => ['<<', '>>'] - ) - or die "Couldn't construct template object: $Text::Template::ERROR; aborting"; -$text = $template1->fill_in(); -print +($text eq $result ? '' : 'not '), "ok $n\n"; -$n++; - -# (2) Now with delimiter choice deferred until fill-in time. -$template1 = Text::Template->new(TYPE => STRING, SOURCE => $template); -$text = $template1->fill_in(DELIMITERS => ['<<', '>>']); -print +($text eq $result ? '' : 'not '), "ok $n\n"; -$n++; - -# (3) Now we'll try using regex metacharacters -# First with the delimiters specified at object creation time -$template = q{The value of $V is [$V].}; -$template1 = Text::Template->new(TYPE => STRING, - SOURCE => $template, - DELIMITERS => ['[', ']'] - ) - or die "Couldn't construct template object: $Text::Template::ERROR; aborting"; -$text = $template1->fill_in(); -print +($text eq $result ? '' : 'not '), "ok $n\n"; -$n++; - -# (4) Now with delimiter choice deferred until fill-in time. -$template1 = Text::Template->new(TYPE => STRING, SOURCE => $template); -$text = $template1->fill_in(DELIMITERS => ['[', ']']); -print +($text eq $result ? '' : 'not '), "ok $n\n"; -$n++; - - - -# (5-18) Make sure \ is working properly -# (That is to say, it is ignored.) -# These tests are similar to those in 01-basic.t. -my @tests = ('{""}' => '', # (5) - - # Backslashes don't matter - '{"}"}' => undef, - '{"\\}"}' => undef, # One backslash - '{"\\\\}"}' => undef, # Two backslashes - '{"\\\\\\}"}' => undef, # Three backslashes - '{"\\\\\\\\}"}' => undef, # Four backslashes (10) - '{"\\\\\\\\\\}"}' => undef, # Five backslashes - - # Backslashes are always passed directly to Perl - '{"x20"}' => 'x20', - '{"\\x20"}' => ' ', # One backslash - '{"\\\\x20"}' => '\\x20', # Two backslashes - '{"\\\\\\x20"}' => '\\ ', # Three backslashes (15) - '{"\\\\\\\\x20"}' => '\\\\x20', # Four backslashes - '{"\\\\\\\\\\x20"}' => '\\\\ ', # Five backslashes - '{"\\x20\\}"}' => undef, # (18) - ); - -my $i; -for ($i=0; $i<@tests; $i+=2) { - my $tmpl = Text::Template->new(TYPE => 'STRING', - SOURCE => $tests[$i], - DELIMITERS => ['{', '}'], - ); - my $text = $tmpl->fill_in; - my $result = $tests[$i+1]; - my $ok = (! defined $text && ! defined $result - || $text eq $result); - unless ($ok) { - print STDERR "($n) expected .$result., got .$text.\n"; - } - print +($ok ? '' : 'not '), "ok $n\n"; - $n++; -} - - -exit; - diff --git a/external/perl/Text-Template-1.46/t/11-prepend.t b/external/perl/Text-Template-1.46/t/11-prepend.t deleted file mode 100644 index fe242e5898..0000000000 --- a/external/perl/Text-Template-1.46/t/11-prepend.t +++ /dev/null @@ -1,94 +0,0 @@ -#!perl -# -# Tests for PREPEND features -# These tests first appeared in version 1.22. - -use Text::Template; - -die "This is the test program for Text::Template version 1.46 -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -print "1..9\n"; -my $n = 1; - -@Emptyclass1::ISA = 'Text::Template'; -@Emptyclass2::ISA = 'Text::Template'; - -my $tin = q{The value of $foo is: {$foo}}; - -Text::Template->always_prepend(q{$foo = "global"}); - -$tmpl1 = Text::Template->new(TYPE => 'STRING', - SOURCE => $tin, - ); - -$tmpl2 = Text::Template->new(TYPE => 'STRING', - SOURCE => $tin, - PREPEND => q{$foo = "template"}, - ); - -$tmpl1->compile; -$tmpl2->compile; - -$t1 = $tmpl1->fill_in(PACKAGE => 'T1'); -$t2 = $tmpl2->fill_in(PACKAGE => 'T2'); -$t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T3'); - -($t1 eq 'The value of $foo is: global') or print "not "; -print "ok $n\n"; $n++; -($t2 eq 'The value of $foo is: template') or print "not "; -print "ok $n\n"; $n++; -($t3 eq 'The value of $foo is: fillin') or print "not "; -print "ok $n\n"; $n++; - -Emptyclass1->always_prepend(q{$foo = 'Emptyclass global';}); -$tmpl1 = Emptyclass1->new(TYPE => 'STRING', - SOURCE => $tin, - ); - -$tmpl2 = Emptyclass1->new(TYPE => 'STRING', - SOURCE => $tin, - PREPEND => q{$foo = "template"}, - ); - -$tmpl1->compile; -$tmpl2->compile; - -$t1 = $tmpl1->fill_in(PACKAGE => 'T4'); -$t2 = $tmpl2->fill_in(PACKAGE => 'T5'); -$t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T6'); - -($t1 eq 'The value of $foo is: Emptyclass global') or print "not "; -print "ok $n\n"; $n++; -($t2 eq 'The value of $foo is: template') or print "not "; -print "ok $n\n"; $n++; -($t3 eq 'The value of $foo is: fillin') or print "not "; -print "ok $n\n"; $n++; - -$tmpl1 = Emptyclass2->new(TYPE => 'STRING', - SOURCE => $tin, - ); - -$tmpl2 = Emptyclass2->new(TYPE => 'STRING', - SOURCE => $tin, - PREPEND => q{$foo = "template"}, - ); - -$tmpl1->compile; -$tmpl2->compile; - -$t1 = $tmpl1->fill_in(PACKAGE => 'T4'); -$t2 = $tmpl2->fill_in(PACKAGE => 'T5'); -$t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T6'); - -($t1 eq 'The value of $foo is: global') or print "not "; -print "ok $n\n"; $n++; -($t2 eq 'The value of $foo is: template') or print "not "; -print "ok $n\n"; $n++; -($t3 eq 'The value of $foo is: fillin') or print "not "; -print "ok $n\n"; $n++; - - diff --git a/external/perl/Text-Template-1.46/t/12-preprocess.t b/external/perl/Text-Template-1.46/t/12-preprocess.t deleted file mode 100644 index 60b6b0c65b..0000000000 --- a/external/perl/Text-Template-1.46/t/12-preprocess.t +++ /dev/null @@ -1,52 +0,0 @@ -#!perl -# -# Tests for PREPROCESSOR features -# These tests first appeared in version 1.25. - -use Text::Template::Preprocess; - -die "This is the test program for Text::Template::Preprocess version 1.46. -You are using version $Text::Template::Preprocess::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::Preprocess::VERSION == 1.46; - -$TMPFILE = "tt$$"; - -print "1..8\n"; -my $n = 1; - -my $py = sub { tr/x/y/ }; -my $pz = sub { tr/x/z/ }; - -my $t = 'xxx The value of $x is {$x}'; -my $outx = 'xxx The value of $x is 119'; -my $outy = 'yyy The value of $y is 23'; -my $outz = 'zzz The value of $z is 5'; -open TF, "> $TMPFILE" or die "Couldn't open test file: $!; aborting"; -print TF $t; -close TF; - -@result = ($outx, $outy, $outz, $outz); -for my $trial (1, 0) { - for my $test (0 .. 3) { - my $tmpl; - if ($trial == 0) { - $tmpl = new Text::Template::Preprocess - (TYPE => 'STRING', SOURCE => $t) or die; - } else { - open TF, "< $TMPFILE" or die "Couldn't open test file: $!; aborting"; - $tmpl = new Text::Template::Preprocess - (TYPE => 'FILEHANDLE', SOURCE => \*TF) or die; - } - $tmpl->preprocessor($py) if ($test & 1) == 1; - my @args = ((($test & 2) == 2) ? (PREPROCESSOR => $pz) : ()); - my $o = $tmpl->fill_in(@args, - HASH => {x => 119, 'y' => 23, z => 5}); -# print STDERR "$o/$result[$test]\n"; - print +(($o eq $result[$test]) ? '' : 'not '), "ok $n\n"; - $n++; - } -} - -unlink $TMPFILE; diff --git a/external/perl/Text-Template-1.46/t/13-taint.t b/external/perl/Text-Template-1.46/t/13-taint.t deleted file mode 100644 index d92a37463a..0000000000 --- a/external/perl/Text-Template-1.46/t/13-taint.t +++ /dev/null @@ -1,119 +0,0 @@ -#!perl -T -# Tests for taint-mode features - -use lib 'blib/lib'; -use Text::Template; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -my $r = int(rand(10000)); -my $file = "tt$r"; - -# makes its arguments tainted -sub taint { - for (@_) { - $_ .= substr($0,0,0); # LOD - } -} - - -print "1..21\n"; - -my $n =1; -print "ok ", $n++, "\n"; - -my $template = 'The value of $n is {$n}.'; - -open T, "> $file" or die "Couldn't write temporary file $file: $!"; -print T $template, "\n"; -close T or die "Couldn't finish temporary file $file: $!"; - -sub should_fail { - my $obj = Text::Template->new(@_); - eval {$obj->fill_in()}; - if ($@) { - print "ok $n # $@\n"; - } else { - print "not ok $n # (didn't fail)\n"; - } - $n++; -} - -sub should_work { - my $obj = Text::Template->new(@_); - eval {$obj->fill_in()}; - if ($@) { - print "not ok $n # $@\n"; - } else { - print "ok $n\n"; - } - $n++; -} - -sub should_be_tainted { - if (Text::Template::_is_clean($_[0])) { - print "not ok $n\n"; $n++; return; - } - print "ok $n\n"; $n++; return; -} - -sub should_be_clean { - unless (Text::Template::_is_clean($_[0])) { - print "not ok $n\n"; $n++; return; - } - print "ok $n\n"; $n++; return; -} - -# Tainted filename should die with and without UNTAINT option -# untainted filename should die without UNTAINT option -# filehandle should die without UNTAINT option -# string and array with tainted data should die either way - -# (2)-(7) -my $tfile = $file; -taint($tfile); -should_be_tainted($tfile); -should_be_clean($file); -should_fail TYPE => 'file', SOURCE => $tfile; -should_fail TYPE => 'file', SOURCE => $tfile, UNTAINT => 1; -should_fail TYPE => 'file', SOURCE => $file; -should_work TYPE => 'file', SOURCE => $file, UNTAINT => 1; - -# (8-9) -open H, "< $file" or die "Couldn't open $file for reading: $!; aborting"; -should_fail TYPE => 'filehandle', SOURCE => \*H; -close H; -open H, "< $file" or die "Couldn't open $file for reading: $!; aborting"; -should_work TYPE => 'filehandle', SOURCE => \*H, UNTAINT => 1; -close H; - -# (10-15) -my $ttemplate = $template; -taint($ttemplate); -should_be_tainted($ttemplate); -should_be_clean($template); -should_fail TYPE => 'string', SOURCE => $ttemplate; -should_fail TYPE => 'string', SOURCE => $ttemplate, UNTAINT => 1; -should_work TYPE => 'string', SOURCE => $template; -should_work TYPE => 'string', SOURCE => $template, UNTAINT => 1; - -# (16-19) -my $array = [ $template ]; -my $tarray = [ $ttemplate ]; -should_fail TYPE => 'array', SOURCE => $tarray; -should_fail TYPE => 'array', SOURCE => $tarray, UNTAINT => 1; -should_work TYPE => 'array', SOURCE => $array; -should_work TYPE => 'array', SOURCE => $array, UNTAINT => 1; - -# (20-21) Test _unconditionally_untaint utility function -Text::Template::_unconditionally_untaint($ttemplate); -should_be_clean($ttemplate); -Text::Template::_unconditionally_untaint($tfile); -should_be_clean($tfile); - -END { unlink $file } - diff --git a/external/perl/Text-Template-1.46/t/14-broken.t b/external/perl/Text-Template-1.46/t/14-broken.t deleted file mode 100644 index d362395cfb..0000000000 --- a/external/perl/Text-Template-1.46/t/14-broken.t +++ /dev/null @@ -1,82 +0,0 @@ -#!perl -# test apparatus for Text::Template module - -use Text::Template; - -print "1..5\n"; - -$n=1; - -die "This is the test program for Text::Template version 1.46. -You are using version $Text::Template::VERSION instead. -That does not make sense.\n -Aborting" - unless $Text::Template::VERSION == 1.46; - -# (1) basic error delivery -{ my $r = Text::Template->new(TYPE => 'string', - SOURCE => '{1/0}', - )->fill_in(); - if ($r eq q{Program fragment delivered error ``Illegal division by zero at template line 1.''}) { - print "ok $n\n"; - } else { - print "not ok $n\n# $r\n"; - } - $n++; -} - -# (2) BROKEN sub called in ->new? -{ my $r = Text::Template->new(TYPE => 'string', - SOURCE => '{1/0}', - BROKEN => sub {'---'}, - )->fill_in(); - if ($r eq q{---}) { - print "ok $n\n"; - } else { - print "not ok $n\n# $r\n"; - } - $n++; -} - -# (3) BROKEN sub called in ->fill_in? -{ my $r = Text::Template->new(TYPE => 'string', - SOURCE => '{1/0}', - )->fill_in(BROKEN => sub {'---'}); - if ($r eq q{---}) { - print "ok $n\n"; - } else { - print "not ok $n\n# $r\n"; - } - $n++; -} - -# (4) BROKEN sub passed correct args when called in ->new? -{ my $r = Text::Template->new(TYPE => 'string', - SOURCE => '{1/0}', - BROKEN => sub { my %a = @_; - qq{$a{lineno},$a{error},$a{text}} - }, - )->fill_in(); - if ($r eq qq{1,Illegal division by zero at template line 1.\n,1/0}) { - print "ok $n\n"; - } else { - print "not ok $n\n# $r\n"; - } - $n++; -} - -# (5) BROKEN sub passed correct args when called in ->fill_in? -{ my $r = Text::Template->new(TYPE => 'string', - SOURCE => '{1/0}', - )->fill_in(BROKEN => - sub { my %a = @_; - qq{$a{lineno},$a{error},$a{text}} - }); - if ($r eq qq{1,Illegal division by zero at template line 1.\n,1/0}) { - print "ok $n\n"; - } else { - print "not ok $n\n# $r\n"; - } - $n++; -} - diff --git a/external/perl/Text-Template-1.56/Changes b/external/perl/Text-Template-1.56/Changes new file mode 100644 index 0000000000..3c50179ad8 --- /dev/null +++ b/external/perl/Text-Template-1.56/Changes @@ -0,0 +1,301 @@ +Revision history for Text::Template + +1.56 2019-07-09 + - Fix typos in Changes + +1.55 2019-02-25 + - Improve AppVeyor tests for older Perls (Thanks Roy Ivy) + - Check for Test::More 0.94 and skip tests if not installed where + done_testing() is used (Thanks Roy Ivy). + - Improve workaround for broken Win32 File::Temp taint failure (Thanks Roy Ivy). + - Skip/todo tests which fail under Devel::Cover (Thanks Roy Ivy) + - Add checks and skip_all checks for non-core test modules (Thanks Roy Ivy) + +1.54 2019-01-13 + - Fix tempfile creation during tests on Win32 + +1.53 2018-05-02 + - Add support for decoding template files via ENCODING constructor arg + [github #11] + - Docs cleanup: replace indirect-object style examples and use class method + style constructor calls in the POD docs + - Docs cleanup: remove hard tabs from POD, replace dated, unfair synopsis + [github #5], convert "THANKS" section to a POD list + +1.52 2018-03-19 + - Fix possible 'Subroutine ... redefined' warning (Github #10) + +1.51 2018-03-04 + - Add test for nested tags breakage that happened in v1.46 + - Turn off strict+warnings in sections where template code is eval'ed + [github #9] + +1.50 2018-02-10 + *** Revert support for identical start/end delimiters (e.g.: @@foo@@, XXfooXX) + due to breakage with nested tags (see + https://github.com/mschout/perl-text-template/issues/8). Will revisit + this in a future release. + +1.49 2018-02-07 + - Fix failing tests in v1.48 under perl < 5.8.9 + +1.48 2018-02-07 + - remove COPYING and Artistic files from the dist. These are replaced by + the Dist::Zilla generated LICENSE file. + - use strict/warnings (thanks Mohammad S Anwar) + - remove $VERSION checks from tests. This makes it easier to run the test + with Dist::Zilla and avoids maintenance issue of updating the tests for + each release (Thanks Andrew Ruder). + - Allow precompiled templates to work with preprocessing [#29928] (Thanks + Nik LaBelle) + - Add "strict" option to fill_in(). This adds "use strict" and "use vars + (...)" to the prepend section, and only the keys of the HASH option are + allowed in the template. (Thanks Desmond Daignault, Kivanc Yazan, CJM) + [55696] + - Fix templates with inline comments without newline after comment for perl + < 5.18 [34292] + - Don't use bareword file handles + - use three arg form of open() + - Fix BROKEN behaviour so that it returns the text accumulated so far on + undef as documented [28974] + - Source code cleanups + - Minimum perl version is now 5.8.0 + - Allow start/end delimiters to be identical (e.g.: @@foo@@, XXfooXX) + (Thanks mirod) [46639] + - Fix + document the FILENAME parameter to fill_in() (Thanks VDB) [106093] + - Test suite cleanups: + + turn on strict/warnings for all tests + + run tests through perltidy and formatting cleanup + + remove number prefixes from test names + + use Test::More instead of generating TAP by hand + + use three-arg form of open() + + don't use indirect object syntax + + don't use bareword file handles + + use File::Temp to generate temporary files + +1.47 2017-02-27 + - Fix longstanding memory leak in _scrubpkg() [#22031] + - Fix various spelling errors [#86872] + +NOTE: Changes for versions prior to 1.47 have been imported from README + +1.46 2013-02-11 + - Thanks to Rik Signes, there is a new + Text::Template->append_text_to_output method, which Text::Template always + uses whenever it wants to emit output. You can subclass this to get + control over the output, for example for postprocessing. + - A spurious warning is no longer emitted when the TYPE parameter to ->new + is omitted. + +1.45 2008-04-16 + +1.44 2003-04-29 + - This is a maintenance release. There are no feature changes. + - _scrubpkg, which was responsible for eptying out temporary packages after + the module had done with them, wasn't always working; the result was + memory leaks in long-running applications. This should be fixed now, and + there is a test in the test suite for it. + - Minor changes to the test suite to prevent spurious errors. + - Minor documentation changes. + +1.43 2002-03-25 + - The ->new method now fails immediately and sets $Text::Template::ERROR if + the file that is named by a filename argument does not exist or cannot be + opened for some other reason. Formerly, the constructor would succeed + and the ->fill_in call would fail. + +1.42 2001-11-05 + - This is a maintenance release. There are no feature changes. + - Fixed a bug relating to use of UNTAINT under perl 5.005_03 and possibly + other versions. + - Taint-related tests are now more comprehensive. + +1.41 2001-09-04 + - This is a maintenance release. There are no feature changes. + - Tests now work correctly on Windows systems and possibly on other + non-unix systems. + +1.40 2001-08-30 + *** INCOMPATIBLE CHANGE *** + - The format of the default error message has changed. It used to look + like: + + Program fragment at line 30 delivered error ``Illegal division by zero'' + + It now looks like: + + Program fragment delivered error ``Illegal division by zero at catalog.tmpl line 37'' + + Note that the default message used to report the line number at which the + program fragment began; it now reports the line number at which the error + actually occurred. + + *** INCOMPATIBLE CHANGE *** + - The format of the default error message has changed. It used to look like: + + Program fragment at line 30 delivered error ``Illegal division by zero'' + + It now looks like: + + Program fragment delivered error ``Illegal division by zero at catalog.tmpl line 37'' + + - Note that the default message used to report the line number at which the + program fragment began; it now reports the line number at which the error + actually occurred. + - New UNTAINT option tells the module that it is safe to 'eval' code even + though it has come from a file or filehandle. + - Code added to prevent memory leaks when filling many templates. Thanks + to Itamar Almeida de Carvalho. + - Bug fix: $OUT was not correctly initialized when used in conjunction + with SAFE. + - You may now use a glob ref when passing a filehandle to the ->new + function. Formerly, a glob was required. + - New subclass: Text::Template::Preprocess. Just like Text::Template, but + you may supply a PREPROCESS option in the constructor or the fill_in + call; this is a function which receives each code fragment prior to + evaluation, and which may modify and return the fragment; the modified + fragment is what is evaluated. + - Error messages passed to BROKEN subroutines will now report the correct + line number of the template at which the error occurred: + + Illegal division by zero at template line 37. + + - If the template comes from a file, the filename will be reported as well: + + Illegal division by zero at catalog.tmpl line 37. + + - New UNTAINT option tells the module that it is safe to eval template code + even if it has come from a file or filehandle, disabling taint checking + in these cases. + - Code added to prevent memory leaks when filling many templates. Thanks to + Itamar Almeida de Carvalho. + - Bug fix: $OUT was not always correctly initialized when used in + conjunction with SAFE. + - You may now use a glob ref when passing a filehandle to the new function. + Formerly, a glob was required. + - Error messages passed to BROKEN subroutines will now report the correct + line number of the template at which the error occurred: + + Illegal division by zero at template line 37. + + If the template comes from a file, the filename will be reported as well: + + Illegal division by zero at catalog.tmpl line 37. + + - New subclass: Text::Template::Preprocess. Just like Text::Template, but + you may supply a PREPROCESS option in the fill_in call; this is a + function which receives each code fragment prior to evaluation, and which + may modify and return the fragment; the modified fragment is what is + evaluated. + +1.31 2001-02-05 + - Maintenance and bug fix release + - fill_in_string was failing. Thanks to Donald L. Greer Jr. for the test case. + +1.23 1999-12-21 + - Small bug fix: DELIMITER and other arguments were being ignored in calls + to fill_in_file and fill_this_in. (Thanks to Jonathan Roy for reporting + this.) + +1.22 + - You can now specify that certain Perl statements be prepended to the + beginning of every program fragment in a template, either per template, + or for all templates, or for the duration of only one call to fill_in. + This is useful, for example, if you want to enable `strict' checks in + your templates but you don't want to manually add `use strict' to the + front of every program fragment everywhere. + +1.20 1999-03-08 + - You can now specify that the program fragment delimiters are strings + other than { and }. This has three interesting effects: First, it + changes the delimiter strings. Second, it disables the special meaning + of \, so you have to be really, really sure that the delimiters will not + appear in your templates. And third, because of the simplifications + introduced by the elimination of \ processing, template parsing is 20-25% + faster. See the manual section on `Alternative Delimiters'. + - Fixed bug having to do with undefined values in HASH options. In + particular, Text::Template no longer generates a warning if you try to + give a variable an undefined value. + +1.12 1999-02-28 + - I forgot to say that Text::Template ISA Exporter, so the exported + functions never got exported. Duhhh! + - Template TYPEs are now case-insensitive. The `new' method now diagnoses + attempts to use an invalid TYPE. + - More tests for these things. + +1.11 1999-02-25 + - Fixed a bug in the way backslashes were processed. The 1.10 behavior was + incompatible with the beta versions and was also inconvenient. (`\n' in + templates was replaced with `n' before it was given to Perl for + evaluation.) The new behavior is also incompatible with the beta + versions, but it is only a little bit incompatible, and it is probably + better. + - Documentation for the new behavior, and tests for the bug. + +1.10 1999-02-13 + - New OUTPUT option delivers template results directly to a filehandle + instead of making them into a string. Saves space and time. + - PACKAGE and HASH now work intelligently with SAFE. + - Fragments may now output data directly to the template, rather than + having to arrange to return it as a return value at the end. This means + that where you used to have to write this: + + { my $blist = ''; + foreach $i (@items) { + $blist .= qq{ * $i\n}; + } + $blist; + } + + You can now write this instead, because $OUT is special. + + { foreach $i (@items) { + $OUT.= " * $i\n"; + } + } + + (`A spoonful of sugar makes the medicine go down.') + - Fixed some small bugs. Worked around a bug in Perl that does the wrong + thing with $x = when $x contains a glob. + - More documentation. Errors fixed. + - Lots more tests. + +1.03 1999-02-06 + - Code added to support HASH option to fill_in. (Incl. `_gensym' + function.) + - Documentation for HASH. + - New test file for HASH. + - Note about failure of lexical variables to propagate into templates. Why + does this surprise people? + - Bug fix: program fragments are evaluated in an environment with `no + strict' by default. Otherwise, you get a lot of `Global symbol "$v" + requires explicit package name' failures. Why didn't the test program + pick this up? Because the only variable the test program ever used was + `$a', which is exempt. Duhhhhh. + - Fixed the test program. + - Various minor documentation fixes. + +1.00 1999-02-05 + This is a complete rewrite. The new version delivers better functionality + but is only 2/3 as long, which I think is a good sign. It is supposed to be + 100% backward-compatible with the previous versions. With one cosmetic + change, it passes the test suite that the previous versions passed. If you + have compatibility problems, please mail me immediately. + + - At least twice as fast + - Better support for filling out the same template more than once + - Now supports evaluation of program fragments in Safe compartments. + (Thanks, Jonathan!) + - Better argument syntax + - More convenience functions + - The parser is much better and simpler + - Once a template is parsed, the parsed version is stored so that + it needn't be parsed again. + - BROKEN function behavior is rationalized. You can now pass an + arbitrary argument to your BROKEN function, or return a value + from it to the main program. + - Documentation overhauled. + +Previous Versions + - Maintained by Mark Jason Dominus (MJD) diff --git a/external/perl/Text-Template-1.46/INSTALL b/external/perl/Text-Template-1.56/INSTALL similarity index 100% rename from external/perl/Text-Template-1.46/INSTALL rename to external/perl/Text-Template-1.56/INSTALL diff --git a/external/perl/Text-Template-1.56/LICENSE b/external/perl/Text-Template-1.56/LICENSE new file mode 100644 index 0000000000..718b860a23 --- /dev/null +++ b/external/perl/Text-Template-1.56/LICENSE @@ -0,0 +1,379 @@ +This software is copyright (c) 2013 by Mark Jason Dominus . + +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) 2013 by Mark Jason Dominus . + +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) 2013 by Mark Jason Dominus . + +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 + diff --git a/external/perl/Text-Template-1.56/MANIFEST b/external/perl/Text-Template-1.56/MANIFEST new file mode 100644 index 0000000000..7f07faaa49 --- /dev/null +++ b/external/perl/Text-Template-1.56/MANIFEST @@ -0,0 +1,34 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. +Changes +INSTALL +LICENSE +MANIFEST +META.json +META.yml +Makefile.PL +README +SIGNATURE +lib/Text/Template.pm +lib/Text/Template/Preprocess.pm +t/author-pod-syntax.t +t/author-signature.t +t/basic.t +t/broken.t +t/delimiters.t +t/error.t +t/exported.t +t/hash.t +t/inline-comment.t +t/nested-tags.t +t/ofh.t +t/out.t +t/prepend.t +t/preprocess.t +t/rt29928.t +t/safe.t +t/safe2.t +t/safe3.t +t/strict.t +t/taint.t +t/template-encoding.t +t/warnings.t diff --git a/external/perl/Text-Template-1.56/META.json b/external/perl/Text-Template-1.56/META.json new file mode 100644 index 0000000000..2d41ada9a0 --- /dev/null +++ b/external/perl/Text-Template-1.56/META.json @@ -0,0 +1,83 @@ +{ + "abstract" : "Expand template text with embedded Perl", + "author" : [ + "Michael Schout " + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "Text-Template", + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "perl" : "5.008" + } + }, + "develop" : { + "requires" : { + "Dist::Zilla" : "5", + "Dist::Zilla::PluginBundle::MSCHOUT" : "0", + "Software::License::Perl_5" : "0", + "Test::Pod" : "1.41", + "Test::Signature" : "0" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "Encode" : "0", + "Exporter" : "0", + "base" : "0", + "perl" : "5.008", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "requires" : { + "File::Temp" : "0", + "Safe" : "0", + "Test::More" : "0", + "Test::More::UTF8" : "0", + "Test::Warnings" : "0", + "lib" : "0", + "perl" : "5.008", + "utf8" : "0", + "vars" : "0" + } + } + }, + "provides" : { + "Text::Template" : { + "file" : "lib/Text/Template.pm", + "version" : "1.56" + }, + "Text::Template::Preprocess" : { + "file" : "lib/Text/Template/Preprocess.pm", + "version" : "1.56" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://github.com/mschout/perl-text-template/issues" + }, + "homepage" : "https://github.com/mschout/perl-text-template", + "repository" : { + "type" : "git", + "url" : "https://github.com/mschout/perl-text-template.git", + "web" : "https://github.com/mschout/perl-text-template" + } + }, + "version" : "1.56", + "x_generated_by_perl" : "v5.26.2", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.04" +} + diff --git a/external/perl/Text-Template-1.56/META.yml b/external/perl/Text-Template-1.56/META.yml new file mode 100644 index 0000000000..0310ce6e21 --- /dev/null +++ b/external/perl/Text-Template-1.56/META.yml @@ -0,0 +1,46 @@ +--- +abstract: 'Expand template text with embedded Perl' +author: + - 'Michael Schout ' +build_requires: + File::Temp: '0' + Safe: '0' + Test::More: '0' + Test::More::UTF8: '0' + Test::Warnings: '0' + lib: '0' + perl: '5.008' + utf8: '0' + vars: '0' +configure_requires: + ExtUtils::MakeMaker: '0' + perl: '5.008' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Text-Template +provides: + Text::Template: + file: lib/Text/Template.pm + version: '1.56' + Text::Template::Preprocess: + file: lib/Text/Template/Preprocess.pm + version: '1.56' +requires: + Carp: '0' + Encode: '0' + Exporter: '0' + base: '0' + perl: '5.008' + strict: '0' + warnings: '0' +resources: + bugtracker: https://github.com/mschout/perl-text-template/issues + homepage: https://github.com/mschout/perl-text-template + repository: https://github.com/mschout/perl-text-template.git +version: '1.56' +x_generated_by_perl: v5.26.2 +x_serialization_backend: 'YAML::Tiny version 1.73' diff --git a/external/perl/Text-Template-1.56/Makefile.PL b/external/perl/Text-Template-1.56/Makefile.PL new file mode 100644 index 0000000000..15b421be1f --- /dev/null +++ b/external/perl/Text-Template-1.56/Makefile.PL @@ -0,0 +1,71 @@ +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. +use strict; +use warnings; + +use 5.008; + +use ExtUtils::MakeMaker; + +my %WriteMakefileArgs = ( + "ABSTRACT" => "Expand template text with embedded Perl", + "AUTHOR" => "Michael Schout ", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0 + }, + "DISTNAME" => "Text-Template", + "LICENSE" => "perl", + "MIN_PERL_VERSION" => "5.008", + "NAME" => "Text::Template", + "PREREQ_PM" => { + "Carp" => 0, + "Encode" => 0, + "Exporter" => 0, + "base" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "File::Temp" => 0, + "Safe" => 0, + "Test::More" => 0, + "Test::More::UTF8" => 0, + "Test::Warnings" => 0, + "lib" => 0, + "utf8" => 0, + "vars" => 0 + }, + "VERSION" => "1.56", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Carp" => 0, + "Encode" => 0, + "Exporter" => 0, + "File::Temp" => 0, + "Safe" => 0, + "Test::More" => 0, + "Test::More::UTF8" => 0, + "Test::Warnings" => 0, + "base" => 0, + "lib" => 0, + "strict" => 0, + "utf8" => 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); diff --git a/external/perl/Text-Template-1.56/README b/external/perl/Text-Template-1.56/README new file mode 100644 index 0000000000..5f62ac7186 --- /dev/null +++ b/external/perl/Text-Template-1.56/README @@ -0,0 +1,62 @@ + +Text::Template v1.46 + +This is a library for generating form letters, building HTML pages, or +filling in templates generally. A `template' is a piece of text that +has little Perl programs embedded in it here and there. When you +`fill in' a template, you evaluate the little programs and replace +them with their values. + +Here's an example of a template: + + Dear {$title} {$lastname}, + + It has come to our attention that you are delinquent in your + {$monthname[$last_paid_month]} payment. Please remit + ${sprintf("%.2f", $amount)} immediately, or your patellae may + be needlessly endangered. + + Love, + + Mark "{nickname(rand 20)}" Dominus + + +The result of filling in this template is a string, which might look +something like this: + + Dear Mr. Gates, + + It has come to our attention that you are delinquent in your + February payment. Please remit + $392.12 immediately, or your patellae may + be needlessly endangered. + + + Love, + + Mark "Vizopteryx" Dominus + +You can store a template in a file outside your program. People can +modify the template without modifying the program. You can separate +the formatting details from the main code, and put the formatting +parts of the program into the template. That prevents code bloat and +encourages functional separation. + +You can fill in the template in a `Safe' compartment. This means that +if you don't trust the person who wrote the code in the template, you +won't have to worry that they are tampering with your program when you +execute it. + +---------------------------------------------------------------- + +Text::Template was originally released some time in late 1995 or early +1996. After three years of study and investigation, I rewrote it from +scratch in January 1999. The new version, 1.0, was much faster, +delivered better functionality and was almost 100% backward-compatible +with the previous beta versions. + +I have added a number of useful features and conveniences since the +1.0 release, while still retaining backward compatibility. With one +merely cosmetic change, the current version of Text::Template passes +the test suite that the old beta versions passed. + diff --git a/external/perl/Text-Template-1.56/SIGNATURE b/external/perl/Text-Template-1.56/SIGNATURE new file mode 100644 index 0000000000..c7cb7d3f35 --- /dev/null +++ b/external/perl/Text-Template-1.56/SIGNATURE @@ -0,0 +1,65 @@ +This file contains message digests of all files listed in MANIFEST, +signed via the Module::Signature module, version 0.81. + +To verify the content in this distribution, first make sure you have +Module::Signature installed, then type: + + % cpansign -v + +It will check each file's integrity, as well as the signature's +validity. If "==> Signature verified OK! <==" is not displayed, +the distribution may already have been compromised, and you should +not run its Makefile.PL or Build.PL. + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +SHA1 8ba1381d3fc8d81457c35e5aff52b8e55d57be7c Changes +SHA1 b457bd56a70b838ccc55d183ab09de64b6996958 INSTALL +SHA1 f12894289cb0f379f24b8d63e2e761dbcba1b216 LICENSE +SHA1 2c21cb13f53da41c4b30011aca9014db2de46862 MANIFEST +SHA1 ea82a70dfcffe05202868dfe02826aaf1f6e0229 META.json +SHA1 9ad7419fb6209e81652da42967995c8fb8f1826b META.yml +SHA1 f7634b46dde2cf8c6f31fe46327d15151d654a2c Makefile.PL +SHA1 b94aaad0a0bf2c323061bfefb9cf1fd532f14e7b README +SHA1 090d77972c087a8905fa85522854afbf4ccc999b lib/Text/Template.pm +SHA1 ca5251a021e46b60603f10e757d689e52fde1feb lib/Text/Template/Preprocess.pm +SHA1 8efad25309730a4d501fb40fc03eda4697303372 t/author-pod-syntax.t +SHA1 19cc343f8a85c6805bbeb02580487483a6283887 t/author-signature.t +SHA1 ae085010c9f08576ef8584f224e38e6a98c1c178 t/basic.t +SHA1 006feb1a0b1e5780db52aa79bd38933664a8339a t/broken.t +SHA1 dee8cef1fcd43ce5de462018f8539d4a0fbc460f t/delimiters.t +SHA1 304955c4280159ec3a4c0f2717dcff9c887bb487 t/error.t +SHA1 c862dfc08e00e76b3f2aee953583d3cc8e5524a2 t/exported.t +SHA1 50ef92bda3b6b5cbd5a9307e6f17ce49ee8f245c t/hash.t +SHA1 d5dc210684aec8bb2c4817af96597c86047169c1 t/inline-comment.t +SHA1 31ff85f423178f2d6638d35edf859d73f63dd5c7 t/nested-tags.t +SHA1 62ae0720aa86146bccfa23d2c903fa142cb86d50 t/ofh.t +SHA1 68093417d49a2afdfcd4642bacea04466039b734 t/out.t +SHA1 a8b21fdca0f1d243775a00758105e0fcc58022aa t/prepend.t +SHA1 4e7e00eccede7c3231e93ef0f3cb011423be4eb5 t/preprocess.t +SHA1 a52d61ef92e6a88d694db0be4893b88417a72f9c t/rt29928.t +SHA1 5186ff459c6042af11bca92decd271887c7b2eae t/safe.t +SHA1 aa0c9ff96d66c1f74fc7ac73ce173c9f741f552e t/safe2.t +SHA1 b50a51577c0f2c13c9a48113dc7f061385a02219 t/safe3.t +SHA1 16d3abf7588da4c0056c6c6b7818470c8601577c t/strict.t +SHA1 f325ebf739e2aec3ae62427aef0c4e86de58ad29 t/taint.t +SHA1 4dac28585388482f1719f404cc357991af77e345 t/template-encoding.t +SHA1 ce1da9bf88d6ea62d7c756f0d730dfb3c5888b6e t/warnings.t +-----BEGIN PGP SIGNATURE----- + +iQJFBAEBCAAvFiEE2EtuRfhGgngE8PsARAzvLrlUzY4FAl0kljYRHG1zY2hvdXRA +Y3Bhbi5vcmcACgkQRAzvLrlUzY6BdRAAlu/LI+71ax6OJfn6O6SslZCKdIfef1+P +UQ3eQCzbUOK1hP9p6TNOMFv0xPew7a1jSsM/wLjryXKLqGIclonBopRisZjCSaFa +DSH+5k4A9TWKo7n08C3nydVZPTfHXLEO6tHIH2umDHjMyC1gDkApjvSqH53OCtoV +vUTqQn9c6MxmuIWus1gjVynTvXWtBmaqrvTuQENFUXsGH5gVVbEr0VNIyt6Ip3p5 +HnRe8UdykFJZvfhEhH1pbt2j513m9Bqce0eSb/eshraFugx7coD3gk2EXqp8eVzK +84vPEcNC8Moii8+qg48VDh9wBq1u/cba2U7PcVjj3lRk/pAni31XnlXLPWJ0dZLF +fR4glE86ESTGSyI2wGDxyEdev+e64sk7geYmL388kqtpqkKWvALmQkKUJg0T0ppp +LYv31DrsP4QM1duv46y3wVbqUPeQlKBOU81vfyAonrD02tRZjwRpCD67CZ9WSgZu +el85yPneIIijYEOzV8GYHKNiiZKpu2uidKCe+MFGxBtXe9hyi9x95tuyi9/pu2FB +YjbGJ8Wb4xhS7zdDWZb/axfwbcGMVml6a6xA98jVkwjHhPvKsf3qWVZZPtWneeN0 +pGNpMta73wQxrp5/W1GfvBfPVlsker6SAARg2NMwS9Wmp+ZuD6gdJ+aN0/PPtNUd +HQJJFjr/xo4= +=nx9E +-----END PGP SIGNATURE----- diff --git a/external/perl/Text-Template-1.46/lib/Text/Template.pm b/external/perl/Text-Template-1.56/lib/Text/Template.pm similarity index 60% rename from external/perl/Text-Template-1.46/lib/Text/Template.pm rename to external/perl/Text-Template-1.56/lib/Text/Template.pm index dc4f3bac77..be38c73ce4 100644 --- a/external/perl/Text-Template-1.46/lib/Text/Template.pm +++ b/external/perl/Text-Template-1.56/lib/Text/Template.pm @@ -5,486 +5,613 @@ # # Copyright 2013 M. J. Dominus. # You may copy and distribute this program under the -# same terms as Perl iteself. +# same terms as Perl itself. # If in doubt, write to mjd-perl-template+@plover.com for a license. # -# Version 1.46 package Text::Template; -require 5.004; -use Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(fill_in_file fill_in_string TTerror); -use vars '$ERROR'; -use strict; +$Text::Template::VERSION = '1.56'; +# ABSTRACT: Expand template text with embedded Perl + +use strict; +use warnings; + +require 5.008; + +use base 'Exporter'; + +our @EXPORT_OK = qw(fill_in_file fill_in_string TTerror); +our $ERROR; -$Text::Template::VERSION = '1.46'; my %GLOBAL_PREPEND = ('Text::Template' => ''); sub Version { - $Text::Template::VERSION; + $Text::Template::VERSION; } sub _param { - my $kk; - my ($k, %h) = @_; - for $kk ($k, "\u$k", "\U$k", "-$k", "-\u$k", "-\U$k") { - return $h{$kk} if exists $h{$kk}; - } - return; + my ($k, %h) = @_; + + for my $kk ($k, "\u$k", "\U$k", "-$k", "-\u$k", "-\U$k") { + return $h{$kk} if exists $h{$kk}; + } + + return undef; } -sub always_prepend -{ - my $pack = shift; - my $old = $GLOBAL_PREPEND{$pack}; - $GLOBAL_PREPEND{$pack} = shift; - $old; -} - -{ - my %LEGAL_TYPE; - BEGIN { - %LEGAL_TYPE = map {$_=>1} qw(FILE FILEHANDLE STRING ARRAY); - } - sub new { +sub always_prepend { my $pack = shift; - my %a = @_; - my $stype = uc(_param('type', %a) || "FILE"); - my $source = _param('source', %a); - my $untaint = _param('untaint', %a); - my $prepend = _param('prepend', %a); - my $alt_delim = _param('delimiters', %a); - my $broken = _param('broken', %a); - unless (defined $source) { - require Carp; - Carp::croak("Usage: $ {pack}::new(TYPE => ..., SOURCE => ...)"); - } - unless ($LEGAL_TYPE{$stype}) { - require Carp; - Carp::croak("Illegal value `$stype' for TYPE parameter"); - } - my $self = {TYPE => $stype, - PREPEND => $prepend, - UNTAINT => $untaint, - BROKEN => $broken, - (defined $alt_delim ? (DELIM => $alt_delim) : ()), - }; - # Under 5.005_03, if any of $stype, $prepend, $untaint, or $broken - # are tainted, all the others become tainted too as a result of - # sharing the expression with them. We install $source separately - # to prevent it from acquiring a spurious taint. - $self->{SOURCE} = $source; - bless $self => $pack; - return unless $self->_acquire_data; - - $self; - } + my $old = $GLOBAL_PREPEND{$pack}; + + $GLOBAL_PREPEND{$pack} = shift; + + $old; +} + +{ + my %LEGAL_TYPE; + + BEGIN { + %LEGAL_TYPE = map { $_ => 1 } qw(FILE FILEHANDLE STRING ARRAY); + } + + sub new { + my ($pack, %a) = @_; + + my $stype = uc(_param('type', %a) || "FILE"); + my $source = _param('source', %a); + my $untaint = _param('untaint', %a); + my $prepend = _param('prepend', %a); + my $alt_delim = _param('delimiters', %a); + my $broken = _param('broken', %a); + my $encoding = _param('encoding', %a); + + unless (defined $source) { + require Carp; + Carp::croak("Usage: $ {pack}::new(TYPE => ..., SOURCE => ...)"); + } + + unless ($LEGAL_TYPE{$stype}) { + require Carp; + Carp::croak("Illegal value `$stype' for TYPE parameter"); + } + + my $self = { + TYPE => $stype, + PREPEND => $prepend, + UNTAINT => $untaint, + BROKEN => $broken, + ENCODING => $encoding, + (defined $alt_delim ? (DELIM => $alt_delim) : ()) + }; + + # Under 5.005_03, if any of $stype, $prepend, $untaint, or $broken + # are tainted, all the others become tainted too as a result of + # sharing the expression with them. We install $source separately + # to prevent it from acquiring a spurious taint. + $self->{SOURCE} = $source; + + bless $self => $pack; + return unless $self->_acquire_data; + + $self; + } } # Convert template objects of various types to type STRING, # in which the template data is embedded in the object itself. sub _acquire_data { - my ($self) = @_; - my $type = $self->{TYPE}; - if ($type eq 'STRING') { - # nothing necessary - } elsif ($type eq 'FILE') { - my $data = _load_text($self->{SOURCE}); - unless (defined $data) { - # _load_text already set $ERROR - return undef; + my $self = shift; + + my $type = $self->{TYPE}; + + if ($type eq 'STRING') { + # nothing necessary } - if ($self->{UNTAINT} && _is_clean($self->{SOURCE})) { - _unconditionally_untaint($data); + elsif ($type eq 'FILE') { + my $data = _load_text($self->{SOURCE}); + unless (defined $data) { + + # _load_text already set $ERROR + return undef; + } + + if ($self->{UNTAINT} && _is_clean($self->{SOURCE})) { + _unconditionally_untaint($data); + } + + if (defined $self->{ENCODING}) { + require Encode; + $data = Encode::decode($self->{ENCODING}, $data, &Encode::FB_CROAK); + } + + $self->{TYPE} = 'STRING'; + $self->{FILENAME} = $self->{SOURCE}; + $self->{SOURCE} = $data; } - $self->{TYPE} = 'STRING'; - $self->{FILENAME} = $self->{SOURCE}; - $self->{SOURCE} = $data; - } elsif ($type eq 'ARRAY') { - $self->{TYPE} = 'STRING'; - $self->{SOURCE} = join '', @{$self->{SOURCE}}; - } elsif ($type eq 'FILEHANDLE') { - $self->{TYPE} = 'STRING'; - local $/; - my $fh = $self->{SOURCE}; - my $data = <$fh>; # Extra assignment avoids bug in Solaris perl5.00[45]. - if ($self->{UNTAINT}) { - _unconditionally_untaint($data); + elsif ($type eq 'ARRAY') { + $self->{TYPE} = 'STRING'; + $self->{SOURCE} = join '', @{ $self->{SOURCE} }; } - $self->{SOURCE} = $data; - } else { - # This should have been caught long ago, so it represents a - # drastic `can't-happen' sort of failure - my $pack = ref $self; - die "Can only acquire data for $pack objects of subtype STRING, but this is $type; aborting"; - } - $self->{DATA_ACQUIRED} = 1; + elsif ($type eq 'FILEHANDLE') { + $self->{TYPE} = 'STRING'; + local $/; + my $fh = $self->{SOURCE}; + my $data = <$fh>; # Extra assignment avoids bug in Solaris perl5.00[45]. + if ($self->{UNTAINT}) { + _unconditionally_untaint($data); + } + $self->{SOURCE} = $data; + } + else { + # This should have been caught long ago, so it represents a + # drastic `can't-happen' sort of failure + my $pack = ref $self; + die "Can only acquire data for $pack objects of subtype STRING, but this is $type; aborting"; + } + + $self->{DATA_ACQUIRED} = 1; } sub source { - my ($self) = @_; - $self->_acquire_data unless $self->{DATA_ACQUIRED}; - return $self->{SOURCE}; + my $self = shift; + + $self->_acquire_data unless $self->{DATA_ACQUIRED}; + + return $self->{SOURCE}; } sub set_source_data { - my ($self, $newdata) = @_; - $self->{SOURCE} = $newdata; - $self->{DATA_ACQUIRED} = 1; - $self->{TYPE} = 'STRING'; - 1; + my ($self, $newdata, $type) = @_; + + $self->{SOURCE} = $newdata; + $self->{DATA_ACQUIRED} = 1; + $self->{TYPE} = $type || 'STRING'; + + 1; } sub compile { - my $self = shift; + my $self = shift; - return 1 if $self->{TYPE} eq 'PREPARSED'; + return 1 if $self->{TYPE} eq 'PREPARSED'; - return undef unless $self->_acquire_data; - unless ($self->{TYPE} eq 'STRING') { - my $pack = ref $self; - # This should have been caught long ago, so it represents a - # drastic `can't-happen' sort of failure - die "Can only compile $pack objects of subtype STRING, but this is $self->{TYPE}; aborting"; - } + return undef unless $self->_acquire_data; - my @tokens; - my $delim_pats = shift() || $self->{DELIM}; + unless ($self->{TYPE} eq 'STRING') { + my $pack = ref $self; - - - my ($t_open, $t_close) = ('{', '}'); - my $DELIM; # Regex matches a delimiter if $delim_pats - if (defined $delim_pats) { - ($t_open, $t_close) = @$delim_pats; - $DELIM = "(?:(?:\Q$t_open\E)|(?:\Q$t_close\E))"; - @tokens = split /($DELIM|\n)/, $self->{SOURCE}; - } else { - @tokens = split /(\\\\(?=\\*[{}])|\\[{}]|[{}\n])/, $self->{SOURCE}; - } - my $state = 'TEXT'; - my $depth = 0; - my $lineno = 1; - my @content; - my $cur_item = ''; - my $prog_start; - while (@tokens) { - my $t = shift @tokens; - next if $t eq ''; - if ($t eq $t_open) { # Brace or other opening delimiter - if ($depth == 0) { - push @content, [$state, $cur_item, $lineno] if $cur_item ne ''; - $cur_item = ''; - $state = 'PROG'; - $prog_start = $lineno; - } else { - $cur_item .= $t; - } - $depth++; - } elsif ($t eq $t_close) { # Brace or other closing delimiter - $depth--; - if ($depth < 0) { - $ERROR = "Unmatched close brace at line $lineno"; - return undef; - } elsif ($depth == 0) { - push @content, [$state, $cur_item, $prog_start] if $cur_item ne ''; - $state = 'TEXT'; - $cur_item = ''; - } else { - $cur_item .= $t; - } - } elsif (!$delim_pats && $t eq '\\\\') { # precedes \\\..\\\{ or \\\..\\\} - $cur_item .= '\\'; - } elsif (!$delim_pats && $t =~ /^\\([{}])$/) { # Escaped (literal) brace? - $cur_item .= $1; - } elsif ($t eq "\n") { # Newline - $lineno++; - $cur_item .= $t; - } else { # Anything else - $cur_item .= $t; + # This should have been caught long ago, so it represents a + # drastic `can't-happen' sort of failure + die "Can only compile $pack objects of subtype STRING, but this is $self->{TYPE}; aborting"; } - } - if ($state eq 'PROG') { - $ERROR = "End of data inside program text that began at line $prog_start"; - return undef; - } elsif ($state eq 'TEXT') { - push @content, [$state, $cur_item, $lineno] if $cur_item ne ''; - } else { - die "Can't happen error #1"; - } - - $self->{TYPE} = 'PREPARSED'; - $self->{SOURCE} = \@content; - 1; + my @tokens; + my $delim_pats = shift() || $self->{DELIM}; + + my ($t_open, $t_close) = ('{', '}'); + my $DELIM; # Regex matches a delimiter if $delim_pats + + if (defined $delim_pats) { + ($t_open, $t_close) = @$delim_pats; + $DELIM = "(?:(?:\Q$t_open\E)|(?:\Q$t_close\E))"; + @tokens = split /($DELIM|\n)/, $self->{SOURCE}; + } + else { + @tokens = split /(\\\\(?=\\*[{}])|\\[{}]|[{}\n])/, $self->{SOURCE}; + } + + my $state = 'TEXT'; + my $depth = 0; + my $lineno = 1; + my @content; + my $cur_item = ''; + my $prog_start; + + while (@tokens) { + my $t = shift @tokens; + + next if $t eq ''; + + if ($t eq $t_open) { # Brace or other opening delimiter + if ($depth == 0) { + push @content, [ $state, $cur_item, $lineno ] if $cur_item ne ''; + $cur_item = ''; + $state = 'PROG'; + $prog_start = $lineno; + } + else { + $cur_item .= $t; + } + $depth++; + } + elsif ($t eq $t_close) { # Brace or other closing delimiter + $depth--; + if ($depth < 0) { + $ERROR = "Unmatched close brace at line $lineno"; + return undef; + } + elsif ($depth == 0) { + push @content, [ $state, $cur_item, $prog_start ] if $cur_item ne ''; + $state = 'TEXT'; + $cur_item = ''; + } + else { + $cur_item .= $t; + } + } + elsif (!$delim_pats && $t eq '\\\\') { # precedes \\\..\\\{ or \\\..\\\} + $cur_item .= '\\'; + } + elsif (!$delim_pats && $t =~ /^\\([{}])$/) { # Escaped (literal) brace? + $cur_item .= $1; + } + elsif ($t eq "\n") { # Newline + $lineno++; + $cur_item .= $t; + } + else { # Anything else + $cur_item .= $t; + } + } + + if ($state eq 'PROG') { + $ERROR = "End of data inside program text that began at line $prog_start"; + return undef; + } + elsif ($state eq 'TEXT') { + push @content, [ $state, $cur_item, $lineno ] if $cur_item ne ''; + } + else { + die "Can't happen error #1"; + } + + $self->{TYPE} = 'PREPARSED'; + $self->{SOURCE} = \@content; + + 1; } sub prepend_text { - my ($self) = @_; - my $t = $self->{PREPEND}; - unless (defined $t) { - $t = $GLOBAL_PREPEND{ref $self}; + my $self = shift; + + my $t = $self->{PREPEND}; + unless (defined $t) { - $t = $GLOBAL_PREPEND{'Text::Template'}; + $t = $GLOBAL_PREPEND{ ref $self }; + unless (defined $t) { + $t = $GLOBAL_PREPEND{'Text::Template'}; + } } - } - $self->{PREPEND} = $_[1] if $#_ >= 1; - return $t; + + $self->{PREPEND} = $_[1] if $#_ >= 1; + + return $t; } sub fill_in { - my $fi_self = shift; - my %fi_a = @_; + my ($fi_self, %fi_a) = @_; - unless ($fi_self->{TYPE} eq 'PREPARSED') { - my $delims = _param('delimiters', %fi_a); - my @delim_arg = (defined $delims ? ($delims) : ()); - $fi_self->compile(@delim_arg) - or return undef; - } - - my $fi_varhash = _param('hash', %fi_a); - my $fi_package = _param('package', %fi_a) ; - my $fi_broken = - _param('broken', %fi_a) || $fi_self->{BROKEN} || \&_default_broken; - my $fi_broken_arg = _param('broken_arg', %fi_a) || []; - my $fi_safe = _param('safe', %fi_a); - my $fi_ofh = _param('output', %fi_a); - my $fi_eval_package; - my $fi_scrub_package = 0; - my $fi_filename = _param('filename') || $fi_self->{FILENAME} || 'template'; - - my $fi_prepend = _param('prepend', %fi_a); - unless (defined $fi_prepend) { - $fi_prepend = $fi_self->prepend_text; - } - - if (defined $fi_safe) { - $fi_eval_package = 'main'; - } elsif (defined $fi_package) { - $fi_eval_package = $fi_package; - } elsif (defined $fi_varhash) { - $fi_eval_package = _gensym(); - $fi_scrub_package = 1; - } else { - $fi_eval_package = caller; - } - - my $fi_install_package; - if (defined $fi_varhash) { - if (defined $fi_package) { - $fi_install_package = $fi_package; - } elsif (defined $fi_safe) { - $fi_install_package = $fi_safe->root; - } else { - $fi_install_package = $fi_eval_package; # The gensymmed one + unless ($fi_self->{TYPE} eq 'PREPARSED') { + my $delims = _param('delimiters', %fi_a); + my @delim_arg = (defined $delims ? ($delims) : ()); + $fi_self->compile(@delim_arg) + or return undef; } - _install_hash($fi_varhash => $fi_install_package); - } - if (defined $fi_package && defined $fi_safe) { - no strict 'refs'; - # Big fat magic here: Fix it so that the user-specified package - # is the default one available in the safe compartment. - *{$fi_safe->root . '::'} = \%{$fi_package . '::'}; # LOD - } + my $fi_varhash = _param('hash', %fi_a); + my $fi_package = _param('package', %fi_a); + my $fi_broken = _param('broken', %fi_a) || $fi_self->{BROKEN} || \&_default_broken; + my $fi_broken_arg = _param('broken_arg', %fi_a) || []; + my $fi_safe = _param('safe', %fi_a); + my $fi_ofh = _param('output', %fi_a); + my $fi_filename = _param('filename', %fi_a) || $fi_self->{FILENAME} || 'template'; + my $fi_strict = _param('strict', %fi_a); + my $fi_prepend = _param('prepend', %fi_a); - my $fi_r = ''; - my $fi_item; - foreach $fi_item (@{$fi_self->{SOURCE}}) { - my ($fi_type, $fi_text, $fi_lineno) = @$fi_item; - if ($fi_type eq 'TEXT') { - $fi_self->append_text_to_output( - text => $fi_text, - handle => $fi_ofh, - out => \$fi_r, - type => $fi_type, - ); - } elsif ($fi_type eq 'PROG') { - no strict; - my $fi_lcomment = "#line $fi_lineno $fi_filename"; - my $fi_progtext = - "package $fi_eval_package; $fi_prepend;\n$fi_lcomment\n$fi_text;"; - my $fi_res; - my $fi_eval_err = ''; - if ($fi_safe) { - $fi_safe->reval(q{undef $OUT}); - $fi_res = $fi_safe->reval($fi_progtext); - $fi_eval_err = $@; - my $OUT = $fi_safe->reval('$OUT'); - $fi_res = $OUT if defined $OUT; - } else { - my $OUT; - $fi_res = eval $fi_progtext; - $fi_eval_err = $@; - $fi_res = $OUT if defined $OUT; - } + my $fi_eval_package; + my $fi_scrub_package = 0; - # If the value of the filled-in text really was undef, - # change it to an explicit empty string to avoid undefined - # value warnings later. - $fi_res = '' unless defined $fi_res; - - if ($fi_eval_err) { - $fi_res = $fi_broken->(text => $fi_text, - error => $fi_eval_err, - lineno => $fi_lineno, - arg => $fi_broken_arg, - ); - if (defined $fi_res) { - $fi_self->append_text_to_output( - text => $fi_res, - handle => $fi_ofh, - out => \$fi_r, - type => $fi_type, - ); - } else { - return $fi_res; # Undefined means abort processing - } - } else { - $fi_self->append_text_to_output( - text => $fi_res, - handle => $fi_ofh, - out => \$fi_r, - type => $fi_type, - ); - } - } else { - die "Can't happen error #2"; + unless (defined $fi_prepend) { + $fi_prepend = $fi_self->prepend_text; } - } - _scrubpkg($fi_eval_package) if $fi_scrub_package; - defined $fi_ofh ? 1 : $fi_r; + if (defined $fi_safe) { + $fi_eval_package = 'main'; + } + elsif (defined $fi_package) { + $fi_eval_package = $fi_package; + } + elsif (defined $fi_varhash) { + $fi_eval_package = _gensym(); + $fi_scrub_package = 1; + } + else { + $fi_eval_package = caller; + } + + my @fi_varlist; + my $fi_install_package; + + if (defined $fi_varhash) { + if (defined $fi_package) { + $fi_install_package = $fi_package; + } + elsif (defined $fi_safe) { + $fi_install_package = $fi_safe->root; + } + else { + $fi_install_package = $fi_eval_package; # The gensymmed one + } + @fi_varlist = _install_hash($fi_varhash => $fi_install_package); + if ($fi_strict) { + $fi_prepend = "use vars qw(@fi_varlist);$fi_prepend" if @fi_varlist; + $fi_prepend = "use strict;$fi_prepend"; + } + } + + if (defined $fi_package && defined $fi_safe) { + no strict 'refs'; + + # Big fat magic here: Fix it so that the user-specified package + # is the default one available in the safe compartment. + *{ $fi_safe->root . '::' } = \%{ $fi_package . '::' }; # LOD + } + + my $fi_r = ''; + my $fi_item; + foreach $fi_item (@{ $fi_self->{SOURCE} }) { + my ($fi_type, $fi_text, $fi_lineno) = @$fi_item; + if ($fi_type eq 'TEXT') { + $fi_self->append_text_to_output( + text => $fi_text, + handle => $fi_ofh, + out => \$fi_r, + type => $fi_type,); + } + elsif ($fi_type eq 'PROG') { + no strict; + + my $fi_lcomment = "#line $fi_lineno $fi_filename"; + my $fi_progtext = "package $fi_eval_package; $fi_prepend;\n$fi_lcomment\n$fi_text;\n;"; + my $fi_res; + my $fi_eval_err = ''; + + if ($fi_safe) { + no strict; + no warnings; + + $fi_safe->reval(q{undef $OUT}); + $fi_res = $fi_safe->reval($fi_progtext); + $fi_eval_err = $@; + my $OUT = $fi_safe->reval('$OUT'); + $fi_res = $OUT if defined $OUT; + } + else { + no strict; + no warnings; + + my $OUT; + $fi_res = eval $fi_progtext; + $fi_eval_err = $@; + $fi_res = $OUT if defined $OUT; + } + + # If the value of the filled-in text really was undef, + # change it to an explicit empty string to avoid undefined + # value warnings later. + $fi_res = '' unless defined $fi_res; + + if ($fi_eval_err) { + $fi_res = $fi_broken->( + text => $fi_text, + error => $fi_eval_err, + lineno => $fi_lineno, + arg => $fi_broken_arg,); + if (defined $fi_res) { + $fi_self->append_text_to_output( + text => $fi_res, + handle => $fi_ofh, + out => \$fi_r, + type => $fi_type,); + } + else { + return $fi_r; # Undefined means abort processing + } + } + else { + $fi_self->append_text_to_output( + text => $fi_res, + handle => $fi_ofh, + out => \$fi_r, + type => $fi_type,); + } + } + else { + die "Can't happen error #2"; + } + } + + _scrubpkg($fi_eval_package) if $fi_scrub_package; + + defined $fi_ofh ? 1 : $fi_r; } sub append_text_to_output { - my ($self, %arg) = @_; + my ($self, %arg) = @_; - if (defined $arg{handle}) { - print { $arg{handle} } $arg{text}; - } else { - ${ $arg{out} } .= $arg{text}; - } + if (defined $arg{handle}) { + print { $arg{handle} } $arg{text}; + } + else { + ${ $arg{out} } .= $arg{text}; + } - return; + return; } sub fill_this_in { - my $pack = shift; - my $text = shift; - my $templ = $pack->new(TYPE => 'STRING', SOURCE => $text, @_) - or return undef; - $templ->compile or return undef; - my $result = $templ->fill_in(@_); - $result; + my ($pack, $text) = splice @_, 0, 2; + + my $templ = $pack->new(TYPE => 'STRING', SOURCE => $text, @_) + or return undef; + + $templ->compile or return undef; + + my $result = $templ->fill_in(@_); + + $result; } sub fill_in_string { - my $string = shift; - my $package = _param('package', @_); - push @_, 'package' => scalar(caller) unless defined $package; - Text::Template->fill_this_in($string, @_); + my $string = shift; + + my $package = _param('package', @_); + + push @_, 'package' => scalar(caller) unless defined $package; + + Text::Template->fill_this_in($string, @_); } sub fill_in_file { - my $fn = shift; - my $templ = Text::Template->new(TYPE => 'FILE', SOURCE => $fn, @_) - or return undef; - $templ->compile or return undef; - my $text = $templ->fill_in(@_); - $text; + my $fn = shift; + my $templ = Text::Template->new(TYPE => 'FILE', SOURCE => $fn, @_) or return undef; + + $templ->compile or return undef; + + my $text = $templ->fill_in(@_); + + $text; } sub _default_broken { - my %a = @_; - my $prog_text = $a{text}; - my $err = $a{error}; - my $lineno = $a{lineno}; - chomp $err; -# $err =~ s/\s+at .*//s; - "Program fragment delivered error ``$err''"; + my %a = @_; + + my $prog_text = $a{text}; + my $err = $a{error}; + my $lineno = $a{lineno}; + + chomp $err; + + # $err =~ s/\s+at .*//s; + "Program fragment delivered error ``$err''"; } sub _load_text { - my $fn = shift; - local *F; - unless (open F, $fn) { - $ERROR = "Couldn't open file $fn: $!"; - return undef; - } - local $/; - ; + my $fn = shift; + + open my $fh, '<', $fn or do { + $ERROR = "Couldn't open file $fn: $!"; + return undef; + }; + + local $/; + + <$fh>; } sub _is_clean { - my $z; - eval { ($z = join('', @_)), eval '#' . substr($z,0,0); 1 } # LOD + my $z; + + eval { ($z = join('', @_)), eval '#' . substr($z, 0, 0); 1 } # LOD } sub _unconditionally_untaint { - for (@_) { - ($_) = /(.*)/s; - } + for (@_) { + ($_) = /(.*)/s; + } } { - my $seqno = 0; - sub _gensym { - __PACKAGE__ . '::GEN' . $seqno++; - } - sub _scrubpkg { - my $s = shift; - $s =~ s/^Text::Template:://; - no strict 'refs'; - my $hash = $Text::Template::{$s."::"}; - foreach my $key (keys %$hash) { - undef $hash->{$key}; + my $seqno = 0; + + sub _gensym { + __PACKAGE__ . '::GEN' . $seqno++; + } + + sub _scrubpkg { + my $s = shift; + + $s =~ s/^Text::Template:://; + + no strict 'refs'; + + my $hash = $Text::Template::{ $s . "::" }; + + foreach my $key (keys %$hash) { + undef $hash->{$key}; + } + + %$hash = (); + + delete $Text::Template::{ $s . "::" }; } - } } - + # Given a hashful of variables (or a list of such hashes) # install the variables into the specified package, # overwriting whatever variables were there before. sub _install_hash { - my $hashlist = shift; - my $dest = shift; - if (UNIVERSAL::isa($hashlist, 'HASH')) { - $hashlist = [$hashlist]; - } - my $hash; - foreach $hash (@$hashlist) { - my $name; - foreach $name (keys %$hash) { - my $val = $hash->{$name}; - no strict 'refs'; - local *SYM = *{"$ {dest}::$name"}; - if (! defined $val) { - delete ${"$ {dest}::"}{$name}; - } elsif (ref $val) { - *SYM = $val; - } else { - *SYM = \$val; - } + my $hashlist = shift; + my $dest = shift; + + if (UNIVERSAL::isa($hashlist, 'HASH')) { + $hashlist = [$hashlist]; } - } + + my @varlist; + + for my $hash (@$hashlist) { + for my $name (keys %$hash) { + my $val = $hash->{$name}; + + no strict 'refs'; + no warnings 'redefine'; + + local *SYM = *{"$ {dest}::$name"}; + + if (!defined $val) { + delete ${"$ {dest}::"}{$name}; + my $match = qr/^.\Q$name\E$/; + @varlist = grep { $_ !~ $match } @varlist; + } + elsif (ref $val) { + *SYM = $val; + push @varlist, do { + if (UNIVERSAL::isa($val, 'ARRAY')) { '@' } + elsif (UNIVERSAL::isa($val, 'HASH')) { '%' } + else { '$' } + } + . $name; + } + else { + *SYM = \$val; + push @varlist, '$' . $name; + } + } + } + + @varlist; } sub TTerror { $ERROR } 1; +__END__ -=head1 NAME +=pod + +=encoding UTF-8 + +=head1 NAME Text::Template - Expand template text with embedded Perl =head1 VERSION -This file documents C version B<1.46> +version 1.56 =head1 SYNOPSIS @@ -510,8 +637,8 @@ This file documents C version B<1.46> # Pass many variables explicitly $hash = { recipient => 'Abed-Nego', friends => [ 'me', 'you' ], - enemies => { loathsome => 'Bill Gates', - fearsome => 'Larry Ellison' }, + enemies => { loathsome => 'Saruman', + fearsome => 'Sauron' }, }; $text = $template->fill_in(HASH => $hash, ...); # $recipient is Abed-Nego, @@ -568,56 +695,53 @@ encourages functional separation. Here's an example of a template, which we'll suppose is stored in the file C: - Dear {$title} {$lastname}, + Dear {$title} {$lastname}, - It has come to our attention that you are delinquent in your - {$monthname[$last_paid_month]} payment. Please remit - ${sprintf("%.2f", $amount)} immediately, or your patellae may - be needlessly endangered. + It has come to our attention that you are delinquent in your + {$monthname[$last_paid_month]} payment. Please remit + ${sprintf("%.2f", $amount)} immediately, or your patellae may + be needlessly endangered. - Love, - - Mark "Vizopteryx" Dominus + Love, + Mark "Vizopteryx" Dominus The result of filling in this template is a string, which might look something like this: - Dear Mr. Gates, + Dear Mr. Smith, - It has come to our attention that you are delinquent in your - February payment. Please remit - $392.12 immediately, or your patellae may - be needlessly endangered. + It has come to our attention that you are delinquent in your + February payment. Please remit + $392.12 immediately, or your patellae may + be needlessly endangered. - Love, + Love, - Mark "Vizopteryx" Dominus + Mark "Vizopteryx" Dominus Here is a complete program that transforms the example template into the example result, and prints it out: - use Text::Template; + use Text::Template; - my $template = Text::Template->new(SOURCE => 'formletter.tmpl') - or die "Couldn't construct template: $Text::Template::ERROR"; + my $template = Text::Template->new(SOURCE => 'formletter.tmpl') + or die "Couldn't construct template: $Text::Template::ERROR"; - my @monthname = qw(January February March April May June - July August September October November December); - my %vars = (title => 'Mr.', - firstname => 'Bill', - lastname => 'Gates', - last_paid_month => 1, # February - amount => 392.12, - monthname => \@monthname, - ); + my @monthname = qw(January February March April May June + July August September October November December); + my %vars = (title => 'Mr.', + firstname => 'John', + lastname => 'Smith', + last_paid_month => 1, # February + amount => 392.12, + monthname => \@monthname); - my $result = $template->fill_in(HASH => \%vars); - - if (defined $result) { print $result } - else { die "Couldn't fill in template: $Text::Template::ERROR" } + my $result = $template->fill_in(HASH => \%vars); + if (defined $result) { print $result } + else { die "Couldn't fill in template: $Text::Template::ERROR" } =head2 Philosophy @@ -654,18 +778,18 @@ A backslash C<\> in front of a brace (or another backslash that is in front of a brace) escapes its special meaning. The result of filling out this template: - \{ The sum of 1 and 2 is {1+2} \} + \{ The sum of 1 and 2 is {1+2} \} is - { The sum of 1 and 2 is 3 } + { The sum of 1 and 2 is 3 } If you have an unmatched brace, C will return a failure code and a warning about where the problem is. Backslashes that do not precede a brace are passed through unchanged. If you have a template like this: - { "String that ends in a newline.\n" } + { "String that ends in a newline.\n" } The backslash inside the string is passed through to Perl unchanged, so the C<\n> really does turn into a newline. See the note at the end @@ -675,37 +799,37 @@ C option. (See L<"Alternative Delimiters">, below.) Each program fragment should be a sequence of Perl statements, which are evaluated the usual way. The result of the last statement -executed will be evaluted in scalar context; the result of this +executed will be evaluated in scalar context; the result of this statement is a string, which is interpolated into the template in place of the program fragment itself. The fragments are evaluated in order, and side effects from earlier fragments will persist into later fragments: - {$x = @things; ''}The Lord High Chamberlain has gotten {$x} - things for me this year. - { $diff = $x - 17; - $more = 'more' - if ($diff == 0) { - $diff = 'no'; - } elsif ($diff < 0) { - $more = 'fewer'; - } - ''; - } - That is {$diff} {$more} than he gave me last year. + {$x = @things; ''}The Lord High Chamberlain has gotten {$x} + things for me this year. + { $diff = $x - 17; + $more = 'more' + if ($diff == 0) { + $diff = 'no'; + } elsif ($diff < 0) { + $more = 'fewer'; + } + ''; + } + That is {$diff} {$more} than he gave me last year. The value of C<$x> set in the first line will persist into the next fragment that begins on the third line, and the values of C<$diff> and C<$more> set in the second fragment will persist and be interpolated into the last line. The output will look something like this: - The Lord High Chamberlain has gotten 42 - things for me this year. + The Lord High Chamberlain has gotten 42 + things for me this year. - That is 25 more than he gave me last year. + That is 25 more than he gave me last year. -That is all the syntax there is. +That is all the syntax there is. =head2 The C<$OUT> variable @@ -714,21 +838,21 @@ motivation for it: Suppose you are going to pass an array, C<@items>, into the template, and you want the template to generate a bulleted list with a header, like this: - Here is a list of the things I have got for you since 1907: - * Ivory - * Apes - * Peacocks - * ... + Here is a list of the things I have got for you since 1907: + * Ivory + * Apes + * Peacocks + * ... One way to do it is with a template like this: - Here is a list of the things I have got for you since 1907: - { my $blist = ''; - foreach $i (@items) { - $blist .= qq{ * $i\n}; - } - $blist; - } + Here is a list of the things I have got for you since 1907: + { my $blist = ''; + foreach $i (@items) { + $blist .= qq{ * $i\n}; + } + $blist; + } Here we construct the list in a variable called C<$blist>, which we return at the end. This is a little cumbersome. There is a shortcut. @@ -740,11 +864,11 @@ behavior, of replacing the fragment with its return value, is disabled; instead the fragment is replaced with the value of C<$OUT>. This means that you can write the template above like this: - Here is a list of the things I have got for you since 1907: - { foreach $i (@items) { - $OUT .= " * $i\n"; - } - } + Here is a list of the things I have got for you since 1907: + { foreach $i (@items) { + $OUT .= " * $i\n"; + } + } C<$OUT> is reinitialized to the empty string at the start of each program fragment. It is private to C, so @@ -758,11 +882,11 @@ variable C<$Text::Template::ERROR> to contain an explanation of what went wrong. For example, if you try to create a template from a file that does not exist, C<$Text::Template::ERROR> will contain something like: - Couldn't open file xyz.tmpl: No such file or directory + Couldn't open file xyz.tmpl: No such file or directory =head2 C - $template = new Text::Template ( TYPE => ..., SOURCE => ... ); + $template = Text::Template->new( TYPE => ..., SOURCE => ... ); This creates and returns a new template object. C returns C and sets C<$Text::Template::ERROR> if it can't create the @@ -771,7 +895,7 @@ come from. C says what kind of object the source is. The most common type of source is a file: - new Text::Template ( TYPE => 'FILE', SOURCE => $filename ); + Text::Template->new( TYPE => 'FILE', SOURCE => $filename ); This reads the template from the specified file. The filename is opened with the Perl C command, so it can be a pipe or anything @@ -780,18 +904,18 @@ else that makes sense with C. The C can also be C, in which case the C should be a string: - new Text::Template ( TYPE => 'STRING', - SOURCE => "This is the actual template!" ); + Text::Template->new( TYPE => 'STRING', + SOURCE => "This is the actual template!" ); The C can be C, in which case the source should be a reference to an array of strings. The concatenation of these strings is the template: - new Text::Template ( TYPE => 'ARRAY', - SOURCE => [ "This is ", "the actual", + Text::Template->new( TYPE => 'ARRAY', + SOURCE => [ "This is ", "the actual", " template!", ] - ); + ); The C can be FILEHANDLE, in which case the source should be an open filehandle (such as you got from the C or C @@ -799,22 +923,21 @@ packages, or a glob, or a reference to a glob). In this case C will read the text from the filehandle up to end-of-file, and that text is the template: - # Read template source code from STDIN: - new Text::Template ( TYPE => 'FILEHANDLE', - SOURCE => \*STDIN ); - + # Read template source code from STDIN: + Text::Template->new ( TYPE => 'FILEHANDLE', + SOURCE => \*STDIN ); If you omit the C attribute, it's taken to be C. C is required. If you omit it, the program will abort. The words C and C can be spelled any of the following ways: - TYPE SOURCE - Type Source - type source - -TYPE -SOURCE - -Type -Source - -type -source + TYPE SOURCE + Type Source + type source + -TYPE -SOURCE + -Type -Source + -type -source Pick a style you like and stick with it. @@ -828,6 +951,18 @@ string is the string that signals the beginning of each program fragment, and the second string is the string that signals the end of each program fragment. See L<"Alternative Delimiters">, below. +=item C + +You may also add a C option. If this option is present, and the +C is a C, then the data will be decoded from the given encoding +using the L module. You can use any encoding that L recognizes. +E.g.: + + Text::Template->new( + TYPE => 'FILE', + ENCODING => 'UTF-8', + SOURCE => 'xyz.tmpl'); + =item C If your program is running in taint mode, you may have problems if @@ -865,7 +1000,7 @@ overridden in the arguments to C. See L> below. =head2 C - $template->compile() + $template->compile() Loads all the template text from the template's source, parses and compiles it. If successful, returns true; otherwise returns false and @@ -881,7 +1016,7 @@ Delimiters">, below. =head2 C - $template->fill_in(OPTIONS); + $template->fill_in(OPTIONS); Fills in a template. Returns the resulting text if successful. Otherwise, returns C and sets C<$Text::Template::ERROR>. @@ -891,17 +1026,17 @@ write the key names in any of the six usual styles as above; this means that where this manual says C (for example) you can actually use any of - PACKAGE Package package -PACKAGE -Package -package + PACKAGE Package package -PACKAGE -Package -package Pick a style you like and stick with it. The all-lowercase versions may yield spurious warnings about - Ambiguous use of package => resolved to "package" + Ambiguous use of package => resolved to "package" so you might like to avoid them and use the capitalized versions. At present, there are eight legal options: C, C, -C, C, C, C, and C. +C, C, C, C, C, and C. =over 4 @@ -911,7 +1046,7 @@ C specifies the name of a package in which the program fragments should be evaluated. The default is to use the package from which C was called. For example, consider this template: - The value of the variable x is {$x}. + The value of the variable x is {$x}. If you use C<$template-Efill_in(PACKAGE =E 'R')> , then the C<$x> in the template is actually replaced with the value of C<$R::x>. If you @@ -927,26 +1062,25 @@ See the section at the end on `Security'. Here's an example of using C: - Your Royal Highness, + Your Royal Highness, - Enclosed please find a list of things I have gotten - for you since 1907: + Enclosed please find a list of things I have gotten + for you since 1907: - { foreach $item (@items) { + { foreach $item (@items) { $item_no++; - $OUT .= " $item_no. \u$item\n"; - } - } + $OUT .= " $item_no. \u$item\n"; + } + } - Signed, - Lord High Chamberlain + Signed, + Lord High Chamberlain We want to pass in an array which will be assigned to the array C<@items>. Here's how to do that: - - @items = ('ivory', 'apes', 'peacocks', ); - $template->fill_in(); + @items = ('ivory', 'apes', 'peacocks', ); + $template->fill_in(); This is not very safe. The reason this isn't as safe is that if you had a variable named C<$item_no> in scope in your program at the point @@ -963,8 +1097,8 @@ are safe. But if you use the C option, you will probably be safe even if the template does I declare its variables with C: - @Q::items = ('ivory', 'apes', 'peacocks', ); - $template->fill_in(PACKAGE => 'Q'); + @Q::items = ('ivory', 'apes', 'peacocks', ); + $template->fill_in(PACKAGE => 'Q'); In this case the template will clobber the variable C<$Q::item_no>, which is not related to the one your program was using. @@ -982,10 +1116,13 @@ C provides an alternative. The value for C should be a reference to a hash that maps variable names to values. For example, - $template->fill_in(HASH => { recipient => "The King", - items => ['gold', 'frankincense', 'myrrh'], - object => \$self, - }); + $template->fill_in( + HASH => { + recipient => "The King", + items => ['gold', 'frankincense', 'myrrh'], + object => \$self, + } + ); will fill out the template and use C<"The King"> as the value of C<$recipient> and the list of items as the value of C<@items>. Note @@ -1024,11 +1161,11 @@ that array. If the I is a reference to a hash, then C<%key> is set to that hash. Similarly if I is any other kind of reference. This means that - var => "foo" + var => "foo" and - var => \"foo" + var => \"foo" have almost exactly the same effect. (The difference is that in the former case, the value is copied, and in the latter case it is @@ -1039,7 +1176,7 @@ aliased.) In particular, if you want the template to get an object or any kind, you must pass a reference to it: - $template->fill_in(HASH => { database_handle => \$dbh, ... }); + $template->fill_in(HASH => { database_handle => \$dbh, ... }); If you do this, the template will have a variable C<$database_handle> which is the database handle object. If you leave out the C<\>, the @@ -1065,16 +1202,18 @@ of variables. For example, one set of variables might be the defaults for a fill-in form, and the second set might be the user inputs, which override the defaults when they are present: - $template->fill_in(HASH => [\%defaults, \%user_input]); + $template->fill_in(HASH => [\%defaults, \%user_input]); You can also use this to set two variables with the same name: - $template->fill_in(HASH => [{ v => "The King" }, - { v => [1,2,3] }, - ] - ); + $template->fill_in( + HASH => [ + { v => "The King" }, + { v => [1,2,3] } + ] + ); -This sets C<$v> to C<"The King"> and C<@v> to C<(1,2,3)>. +This sets C<$v> to C<"The King"> and C<@v> to C<(1,2,3)>. =item C @@ -1100,19 +1239,19 @@ fragment that cased the error. If you don't specify a C function, C supplies a default one that returns something like - Program fragment delivered error ``Illegal division by 0 at - template line 37'' + Program fragment delivered error ``Illegal division by 0 at + template line 37'' (Note that the format of this message has changed slightly since version 1.31.) The return value of the C function is interpolated into the template at the place the error occurred, so that this template: - (3+4)*5 = { 3+4)*5 } + (3+4)*5 = { 3+4)*5 } yields this result: - (3+4)*5 = Program fragment delivered error ``syntax error at template line 1'' + (3+4)*5 = Program fragment delivered error ``syntax error at template line 1'' If you specify a value for the C attribute, it should be a reference to a function that C can call instead of the @@ -1156,23 +1295,24 @@ The C function could also use the C as a reference to store an error message or some other information that it wants to communicate back to the caller. For example: - $error = ''; + $error = ''; - sub my_broken { - my %args = @_; - my $err_ref = $args{arg}; - ... - $$err_ref = "Some error message"; - return undef; - } + sub my_broken { + my %args = @_; + my $err_ref = $args{arg}; + ... + $$err_ref = "Some error message"; + return undef; + } - $template->fill_in(BROKEN => \&my_broken, - BROKEN_ARG => \$error, - ); + $template->fill_in( + BROKEN => \&my_broken, + BROKEN_ARG => \$error + ); - if ($error) { - die "It didn't work: $error"; - } + if ($error) { + die "It didn't work: $error"; + } If one of the program fragments in the template fails, it will call the C function, C, and pass it the C, @@ -1181,6 +1321,29 @@ message into C<$error> this way. Then the function that called C can see if C has left an error message for it to find, and proceed accordingly. +=item C + +If you give C a C option, then this is the file name that +you loaded the template source from. This only affects the error message that +is given for template errors. If you loaded the template from C for +example, and pass C as the C parameter, errors will look +like C<... at foo.txt line N> rather than C<... at template line N>. + +Note that this does NOT have anything to do with loading a template from the +given filename. See C for that. + +For example: + + my $template = Text::Template->new( + TYPE => 'string', + SOURCE => 'The value is {1/0}'); + + $template->fill_in(FILENAME => 'foo.txt') or die $Text::Template::ERROR; + +will die with an error that contains + + Illegal division by zero at at foo.txt line 1 + =item C If you give C a C option, its value should be a safe @@ -1213,7 +1376,7 @@ the C option to C, the value should be a filehandle. The generated text will be printed to this filehandle as it is constructed. For example: - $template->fill_in(OUTPUT => \*STDOUT, ...); + $template->fill_in(OUTPUT => \*STDOUT, ...); fills in the C<$template> as usual, but the results are immediately printed to STDOUT. This may result in the output appearing more @@ -1260,17 +1423,17 @@ any results. An example: - $Q::name = 'Donald'; - $Q::amount = 141.61; - $Q::part = 'hyoid bone'; + $Q::name = 'Donald'; + $Q::amount = 141.61; + $Q::part = 'hyoid bone'; - $text = Text::Template->fill_this_in( <<'EOM', PACKAGE => Q); - Dear {$name}, - You owe me \\${sprintf('%.2f', $amount)}. - Pay or I will break your {$part}. - Love, - Grand Vizopteryx of Irkutsk. - EOM + $text = Text::Template->fill_this_in( <<'EOM', PACKAGE => Q); + Dear {$name}, + You owe me \\${sprintf('%.2f', $amount)}. + Pay or I will break your {$part}. + Love, + Grand Vizopteryx of Irkutsk. + EOM Notice how we included the template in-line in the program by using a `here document' with the CE> notation. @@ -1290,14 +1453,14 @@ four years ago and it is too late to change it. C is exactly like C except that it is not a method and you can omit the C> and just say - print fill_in_string(<<'EOM', ...); - Dear {$name}, - ... - EOM + print fill_in_string(<<'EOM', ...); + Dear {$name}, + ... + EOM To use C, you need to say - use Text::Template 'fill_in_string'; + use Text::Template 'fill_in_string'; at the top of your program. You should probably use C instead of C. @@ -1306,7 +1469,7 @@ C instead of C. If you import C, you can say - $text = fill_in_file(filename, ...); + $text = fill_in_file(filename, ...); The C<...> are passed to C as above. The filename is the name of the file that contains the template you want to fill in. It @@ -1323,7 +1486,7 @@ People always ask for this. ``Why don't you have an include function?'' they want to know. The short answer is this is Perl, and Perl already has an include function. If you want it, you can just put - {qx{cat filename}} + {qx{cat filename}} into your template. VoilE. @@ -1331,19 +1494,19 @@ If you don't want to use C, you can write a little four-line function that opens a file and dumps out its contents, and call it from the template. I wrote one for you. In the template, you can say - {Text::Template::_load_text(filename)} + {Text::Template::_load_text(filename)} If that is too verbose, here is a trick. Suppose the template package that you are going to be mentioning in the C call is package C. Then in the main program, write - *Q::include = \&Text::Template::_load_text; + *Q::include = \&Text::Template::_load_text; This imports the C<_load_text> function into package C with the name C. From then on, any template that you fill in with package C can say - {include(filename)} + {include(filename)} to insert the text from the named file at that point. If you are using the C option instead, just put C @@ -1354,7 +1517,7 @@ Suppose you don't want to insert a plain text file, but rather you want to include one template within another? Just use C in the template itself: - {Text::Template::fill_in_file(filename)} + {Text::Template::fill_in_file(filename)} You can do the same importing trick if this is too much to type. @@ -1364,8 +1527,8 @@ You can do the same importing trick if this is too much to type. People are frequently surprised when this doesn't work: - my $recipient = 'The King'; - my $text = fill_in_file('formletter.tmpl'); + my $recipient = 'The King'; + my $text = fill_in_file('formletter.tmpl'); The text C doesn't get into the form letter. Why not? Because C<$recipient> is a C variable, and the whole point of @@ -1378,13 +1541,12 @@ private variable, and in this case you don't want the variable to be private. Put the variables into package variables in some other package, and use the C option to C: - $Q::recipient = $recipient; - my $text = fill_in_file('formletter.tmpl', PACKAGE => 'Q'); - + $Q::recipient = $recipient; + my $text = fill_in_file('formletter.tmpl', PACKAGE => 'Q'); or pass the names and values in a hash with the C option: - my $text = fill_in_file('formletter.tmpl', HASH => { recipient => $recipient }); + my $text = fill_in_file('formletter.tmpl', HASH => { recipient => $recipient }); =head2 Security Matters @@ -1397,19 +1559,19 @@ rest of your program and wreck something. Nevertheless, there's really no way (except with C) to protect against a template that says - { $Important::Secret::Security::Enable = 0; - # Disable security checks in this program - } + { $Important::Secret::Security::Enable = 0; + # Disable security checks in this program + } or - { $/ = "ho ho ho"; # Sabotage future uses of . - # $/ is always a global variable - } + { $/ = "ho ho ho"; # Sabotage future uses of . + # $/ is always a global variable + } or even - { system("rm -rf /") } + { system("rm -rf /") } so B go filling in templates unless you're sure you know what's in them. If you're worried, or you can't trust the person who wrote @@ -1437,7 +1599,7 @@ an alternative set of delimiters with the C option. For example, if you would like code fragments to be delimited by C<[@--> and C<--@]> instead of C<{> and C<}>, use - ... DELIMITERS => [ '[@--', '--@]' ], ... + ... DELIMITERS => [ '[@--', '--@]' ], ... Note that these delimiters are I, not regexes. (I tried for regexes, but it complicates the lexical analysis too much.) @@ -1450,16 +1612,16 @@ as they nest properly. This means that if for some reason you absolutely must have a program fragment that mentions one of the delimiters, like this: - [@-- - print "Oh no, a delimiter: --@]\n" - --@] + [@-- + print "Oh no, a delimiter: --@]\n" + --@] you may be able to make it work by doing this instead: - [@-- - # Fake matching delimiter in a comment: [@-- - print "Oh no, a delimiter: --@]\n" - --@] + [@-- + # Fake matching delimiter in a comment: [@-- + print "Oh no, a delimiter: --@]\n" + --@] It may be safer to choose delimiters that begin with a newline character. @@ -1476,22 +1638,22 @@ undeclared variables and the like. But each code fragment is a separate lexical scope, so you have to turn on C at the top of each and every code fragment: - { use strict; - use vars '$foo'; - $foo = 14; - ... - } + { use strict; + use vars '$foo'; + $foo = 14; + ... + } - ... + ... - { # we forgot to put `use strict' here - my $result = $boo + 12; # $boo is misspelled and should be $foo - # No error is raised on `$boo' - } + { # we forgot to put `use strict' here + my $result = $boo + 12; # $boo is misspelled and should be $foo + # No error is raised on `$boo' + } Because we didn't put C at the top of the second fragment, it was only active in the first fragment, and we didn't get any -C checking in the second fragment. Then we mispelled C<$foo> +C checking in the second fragment. Then we misspelled C<$foo> and the error wasn't caught. C version 1.22 and higher has a new feature to make @@ -1500,44 +1662,71 @@ added to the beginning of each program fragment. When you make a call to C, you can specify a - PREPEND => 'some perl statements here' + PREPEND => 'some perl statements here' option; the statements will be prepended to each program fragment for that one call only. Suppose that the C call included a - PREPEND => 'use strict;' + PREPEND => 'use strict;' option, and that the template looked like this: - { use vars '$foo'; - $foo = 14; - ... - } + { use vars '$foo'; + $foo = 14; + ... + } - ... + ... - { my $result = $boo + 12; # $boo is misspelled and should be $foo - ... - } + { my $result = $boo + 12; # $boo is misspelled and should be $foo + ... + } The code in the second fragment would fail, because C<$boo> has not been declared. C was implied, even though you did not write it explicitly, because the C option added it for you automatically. -There are two other ways to do this. At the time you create the +There are three other ways to do this. At the time you create the template object with C, you can also supply a C option, in which case the statements will be prepended each time you fill in that template. If the C call has its own C option, this overrides the one specified at the time you created the template. Finally, you can make the class method call - Text::Template->always_prepend('perl statements'); + Text::Template->always_prepend('perl statements'); If you do this, then call calls to C for I template will attach the perl statements to the beginning of each program fragment, except where overridden by C options to C or C. +An alternative to adding "use strict;" to the PREPEND option, you can +pass STRICT => 1 to fill_in when also passing the HASH option. + +Suppose that the C call included both + + HASH => {$foo => ''} and + STRICT => 1 + +options, and that the template looked like this: + + { + $foo = 14; + ... + } + + ... + + { my $result = $boo + 12; # $boo is misspelled and should be $foo + ... + } + +The code in the second fragment would fail, because C<$boo> has not +been declared. C was implied, even though you did not +write it explicitly, because the C option added it for you +automatically. Any variable referenced in the template that is not in the +C option will be an error. + =head2 Prepending in Derived Classes This section is technical, and you should skip it on the first few @@ -1553,7 +1742,7 @@ first one that it finds. In a subclass of C, this last possibility is ambiguous. Suppose C is a subclass of C. Should - Text::Template->always_prepend(...); + Text::Template->always_prepend(...); affect objects in class C? The answer is that you can have it either way. @@ -1567,11 +1756,11 @@ which the template object belongs. If it doesn't find any value, it looks in C<$GLOBAL_PREPEND{'Text::Template'}>. This means that objects in class C I be affected by - Text::Template->always_prepend(...); + Text::Template->always_prepend(...); I there is also a call to - Derived->always_prepend(...); + Derived->always_prepend(...); So when you're designing your derived class, you can arrange to have your objects ignore C calls by simply @@ -1586,8 +1775,8 @@ method to get an arbitrary effect. Jennifer D. St Clair asks: - > Most of my pages contain JavaScript and Stylesheets. - > How do I change the template identifier? + > Most of my pages contain JavaScript and Stylesheets. + > How do I change the template identifier? Jennifer is worried about the braces in the JavaScript being taken as the delimiters of the Perl program fragments. Of course, disaster @@ -1600,61 +1789,60 @@ some reason, there are two easy workarounds: 1. You can put C<\> in front of C<{>, C<}>, or C<\> to remove its special meaning. So, for example, instead of - if (br== "n3") { - // etc. - } + if (br== "n3") { + // etc. + } you can put - if (br== "n3") \{ - // etc. - \} + if (br== "n3") \{ + // etc. + \} and it'll come out of the template engine the way you want. But here is another method that is probably better. To see how it works, first consider what happens if you put this into a template: - { 'foo' } + { 'foo' } Since it's in braces, it gets evaluated, and obviously, this is going to turn into - foo + foo So now here's the trick: In Perl, C is the same as C<'...'>. So if we wrote - {q{foo}} + {q{foo}} it would turn into - foo + foo So for your JavaScript, just write - {q{if (br== "n3") { - // etc. - }} - } + {q{if (br== "n3") { + // etc. + }} + } and it'll come out as - if (br== "n3") { - // etc. - } + if (br== "n3") { + // etc. + } which is what you want. - -=head2 Shut Up! +head2 Shut Up! People sometimes try to put an initialization section at the top of their templates, like this: - { ... - $var = 17; - } + { ... + $var = 17; + } Then they complain because there is a C<17> at the top of the output that they didn't want to have there. @@ -1667,18 +1855,18 @@ and have the recipient filled in. To prevent the 17 from appearing in the output is very simple: - { ... - $var = 17; - ''; - } + { ... + $var = 17; + ''; + } Now the last expression evaluated yields the empty string, which is invisible. If you don't like the way this looks, use - { ... - $var = 17; - ($SILENTLY); - } + { ... + $var = 17; + ($SILENTLY); + } instead. Presumably, C<$SILENTLY> has no value, so nothing will be interpolated. This is what is known as a `trick'. @@ -1727,29 +1915,28 @@ C<\}> signal a literal brace. Examples: - \{ foo \} + \{ foo \} is I evaluated, because the C<\> before the braces signals that they should be taken literally. The result in the output looks like this: - { foo } - + { foo } This is a syntax error: - { "foo}" } + { "foo}" } because C thinks that the code ends at the first C<}>, and then gets upset when it sees the second one. To make this work correctly, use - { "foo\}" } + { "foo\}" } This passes C<"foo}"> to Perl for evaluation. Note there's no C<\> in the evaluated code. If you really want a C<\> in the evaluated code, use - { "foo\\\}" } + { "foo\\\}" } This passes C<"foo\}"> to Perl for evaluation. @@ -1769,20 +1956,20 @@ If it really, really bothers you, you can import a function called C that returns the current value of the C<$ERROR> variable. So you can say: - use Text::Template 'TTerror'; + use Text::Template 'TTerror'; - my $template = new Text::Template (SOURCE => $filename); - unless ($template) { - my $err = TTerror; - die "Couldn't make template: $err; aborting"; - } + my $template = Text::Template->new(SOURCE => $filename); + unless ($template) { + my $err = TTerror; + die "Couldn't make template: $err; aborting"; + } I don't see what benefit this has over just doing this: - use Text::Template; + use Text::Template; - my $template = new Text::Template (SOURCE => $filename) - or die "Couldn't make template: $Text::Template::ERROR; aborting"; + my $template = Text::Template->new(SOURCE => $filename) + or die "Couldn't make template: $Text::Template::ERROR; aborting"; But if it makes you happy to do it that way, go ahead. @@ -1796,12 +1983,12 @@ into their template output. It's totally straightforward. Just call the C functions from inside the template: - { $q->checkbox_group(NAME => 'toppings', - LINEBREAK => true, - COLUMNS => 3, - VALUES => \@toppings, - ); - } + { $q->checkbox_group(NAME => 'toppings', + LINEBREAK => true, + COLUMNS => 3, + VALUES => \@toppings, + ); + } =head2 Automatic preprocessing of program fragments @@ -1819,124 +2006,302 @@ method. It is passed a list of pairs with these entries: text - the text that will be appended type - where the text came from: TEXT for literal text, PROG for code -=head2 Author +=head1 HISTORY -Mark Jason Dominus, Plover Systems - -Please send questions and other remarks about this software to -C - -You can join a very low-volume (E10 messages per year) mailing -list for announcements about this package. Send an empty note to -C to join. - -For updates, visit C. - -=head2 Support? - -This software is version 1.46. It may have bugs. Suggestions and bug -reports are always welcome. Send them to -C. (That is my address, not the address -of the mailing list. The mailing list address is a secret.) - -=head1 LICENSE - - Text::Template version 1.46 - Copyright 2013 Mark Jason Dominus - - 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 2 of the - License, or (at your option) any later version. You may also can - redistribute it and/or modify it under the terms of the Perl - Artistic License. - - 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 copies of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Originally written by Mark Jason Dominus, Plover Systems (versions 0.01 - 1.46) +Maintainership transferred to Michael Schout Emschout@cpan.orgE in version +1.47 =head1 THANKS Many thanks to the following people for offering support, encouragement, advice, bug reports, and all the other good stuff. -David H. Adler / -Joel Appelbaum / -Klaus Arnhold / -AntEnio AragEo / -Kevin Atteson / -Chris.Brezil / -Mike Brodhead / -Tom Brown / -Dr. Frank Bucolo / -Tim Bunce / -Juan E. Camacho / -Itamar Almeida de Carvalho / -Joseph Cheek / -Gene Damon / -San Deng / -Bob Dougherty / -Marek Grac / -Dan Franklin / -gary at dls.net / -Todd A. Green / -Donald L. Greer Jr. / -Michelangelo Grigni / -Zac Hansen / -Tom Henry / -Jarko Hietaniemi / -Matt X. Hunter / -Robert M. Ioffe / -Daniel LaLiberte / -Reuven M. Lerner / -Trip Lilley / -Yannis Livassof / -Val Luck / -Kevin Madsen / -David Marshall / -James Mastros / -Joel Meulenberg / -Jason Moore / -Sergey Myasnikov / -Chris Nandor / -Bek Oberin / -Steve Palincsar / -Ron Pero / -Hans Persson / -Sean Roehnelt / -Jonathan Roy / -Shabbir J. Safdar / -Jennifer D. St Clair / -Uwe Schneider / -Randal L. Schwartz / -Michael G Schwern / -Yonat Sharon / -Brian C. Shensky / -Niklas Skoglund / -Tom Snee / -Fred Steinberg / -Hans Stoop / -Michael J. Suzio / -Dennis Taylor / -James H. Thompson / -Shad Todd / -Lieven Tomme / -Lorenzo Valdettaro / -Larry Virden / -Andy Wardley / -Archie Warnock / -Chris Wesley / -Matt Womer / -Andrew G Wood / -Daini Xie / +=over 4 + +=item * + +Andrew G Wood + +=item * + +Andy Wardley + +=item * + +António Aragão + +=item * + +Archie Warnock + +=item * + +Bek Oberin + +=item * + +Bob Dougherty + +=item * + +Brian C. Shensky + +=item * + +Chris Nandor + +=item * + +Chris Wesley + +=item * + +Chris.Brezil + +=item * + +Daini Xie + +=item * + +Dan Franklin + +=item * + +Daniel LaLiberte + +=item * + +David H. Adler + +=item * + +David Marshall + +=item * + +Dennis Taylor + +=item * + +Donald L. Greer Jr. + +=item * + +Dr. Frank Bucolo + +=item * + +Fred Steinberg + +=item * + +Gene Damon + +=item * + +Hans Persson + +=item * + +Hans Stoop + +=item * + +Itamar Almeida de Carvalho + +=item * + +James H. Thompson + +=item * + +James Mastros + +=item * + +Jarko Hietaniemi + +=item * + +Jason Moore + +=item * + +Jennifer D. St Clair + +=item * + +Joel Appelbaum + +=item * + +Joel Meulenberg + +=item * + +Jonathan Roy + +=item * + +Joseph Cheek + +=item * + +Juan E. Camacho + +=item * + +Kevin Atteson + +=item * + +Kevin Madsen + +=item * + +Klaus Arnhold + +=item * + +Larry Virden + +=item * + +Lieven Tomme + +=item * + +Lorenzo Valdettaro + +=item * + +Marek Grac + +=item * + +Matt Womer + +=item * + +Matt X. Hunter + +=item * + +Michael G Schwern + +=item * + +Michael J. Suzio + +=item * + Michaely Yeung +=item * + +Michelangelo Grigni + +=item * + +Mike Brodhead + +=item * + +Niklas Skoglund + +=item * + +Randal L. Schwartz + +=item * + +Reuven M. Lerner + +=item * + +Robert M. Ioffe + +=item * + +Ron Pero + +=item * + +San Deng + +=item * + +Sean Roehnelt + +=item * + +Sergey Myasnikov + +=item * + +Shabbir J. Safdar + +=item * + +Shad Todd + +=item * + +Steve Palincsar + +=item * + +Tim Bunce + +=item * + +Todd A. Green + +=item * + +Tom Brown + +=item * + +Tom Henry + +=item * + +Tom Snee + +=item * + +Trip Lilley + +=item * + +Uwe Schneider + +=item * + +Val Luck + +=item * + +Yannis Livassof + +=item * + +Yonat Sharon + +=item * + +Zac Hansen + +=item * + +gary at dls.net + +=back + Special thanks to: =over 2 @@ -1970,4 +2335,29 @@ use it as if it were a regular variable. There are not quite enough tests in the test suite. +=head1 SOURCE + +The development version is on github at L +and may be cloned from L + +=head1 BUGS + +Please report any bugs or feature requests on the bugtracker website +L + +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. + +=head1 AUTHOR + +Michael Schout + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2013 by Mark Jason Dominus . + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm b/external/perl/Text-Template-1.56/lib/Text/Template/Preprocess.pm similarity index 64% rename from external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm rename to external/perl/Text-Template-1.56/lib/Text/Template/Preprocess.pm index 1e41037bd3..4fea67b383 100644 --- a/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm +++ b/external/perl/Text-Template-1.56/lib/Text/Template/Preprocess.pm @@ -1,40 +1,59 @@ package Text::Template::Preprocess; +$Text::Template::Preprocess::VERSION = '1.56'; +# ABSTRACT: Expand template text with embedded Perl + +use strict; +use warnings; + use Text::Template; -@ISA = qw(Text::Template); -$Text::Template::Preprocess::VERSION = 1.46; +our @ISA = qw(Text::Template); sub fill_in { - my $self = shift; - my (%args) = @_; - my $pp = $args{PREPROCESSOR} || $self->{PREPROCESSOR} ; - if ($pp) { - local $_ = $self->source(); -# print "# fill_in: before <$_>\n"; - &$pp; -# print "# fill_in: after <$_>\n"; - $self->set_source_data($_); - } - $self->SUPER::fill_in(@_); + my $self = shift; + my (%args) = @_; + + my $pp = $args{PREPROCESSOR} || $self->{PREPROCESSOR}; + + if ($pp) { + local $_ = $self->source(); + my $type = $self->{TYPE}; + + # print "# fill_in: before <$_>\n"; + &$pp; + + # print "# fill_in: after <$_>\n"; + $self->set_source_data($_, $type); + } + + $self->SUPER::fill_in(@_); } sub preprocessor { - my ($self, $pp) = @_; - my $old_pp = $self->{PREPROCESSOR}; - $self->{PREPROCESSOR} = $pp if @_ > 1; # OK to pass $pp=undef - $old_pp; + my ($self, $pp) = @_; + + my $old_pp = $self->{PREPROCESSOR}; + + $self->{PREPROCESSOR} = $pp if @_ > 1; # OK to pass $pp=undef + + $old_pp; } 1; +__END__ -=head1 NAME +=pod + +=encoding UTF-8 + +=head1 NAME Text::Template::Preprocess - Expand template text with embedded Perl =head1 VERSION -This file documents C version B<1.46> +version 1.56 =head1 SYNOPSIS @@ -78,7 +97,6 @@ C. One possible purpose: If your files contain a lot of JavaScript, like this: - Plain text here... { perl code }