1#======================================================================== 2# 3# Changes 4# 5# DESCRIPTION 6# Revision history for the Template Toolkit. 7# 8# AUTHOR 9# Andy Wardley <abw@wardley.org> 10# 11#======================================================================== 12 13#----------------------------------------------------------------------- 14# Version 2.24 - 8th February 2012 15#------------------------------------------------------------------------ 16 17* Added text virtual methods: upper, lower, ucfirst, lcfirst, squote, 18 dquote, trim, collapse, html and xml. 19 20* Fixed bug RT#67918 - Bug in Makefile.PL command line parsing when 2 = 21 signs were in an arguement. 22 23* Fixed bug RT#74335 - Added documentation for some methods that were 24 lacking it to keep Pod::Coverage happy. 25 26 27#----------------------------------------------------------------------- 28# Version 2.23 - 21st January 2012 29#------------------------------------------------------------------------ 30 31* Fixed bug RT#47929 which caused the XS Stash to die mysteriously when 32 calling code that used string evaluation (e.g. DateTime). 33 34* Fixed bug RT#68722 so that list.defined('alpha') always returns false. 35 36* Added the TRACE_VARS option to keep track of what variables are used 37 in a template. It's not documented yet. See t/trace_vars.t for an 38 example of use. 39 40* Applied patch from RT#48989 to avoid Template::Plugin::Procedural 41 from adding target class' methods AUTOLOAD and new methods multiple 42 times (Jens Rehsack) 43 44* Applied patch from RT#53451 to accept negative epoch times in 45 Template::Plugin::Date. 46 47* Applied patch from Marc Remy to add $Template::Directive::WHILE_MAX 48 option to tpage. 49 50 51#----------------------------------------------------------------------- 52# Version 2.22 - 21st July 2009 53#------------------------------------------------------------------------ 54 55* Changed pod coverage and kwalitee tests to only run when release 56 testing. 57 58 59#----------------------------------------------------------------------- 60# Version 2.21_02 - 4th July 2009 61#------------------------------------------------------------------------ 62 63* Added UTF8 support to the XS Stash. 64 https://rt.cpan.org/Ticket/Display.html?id=45842 65 66* Fixed the truncate filter to handle lengths shorter than the '...' 67 string being appended on the end. 68 https://rt.cpan.org/Ticket/Display.html?id=45617 69 70* Fixed a bug in the parser/grammar to make NEXT/LAST work correctly 71 inside nested loops. 72 https://rt.cpan.org/Ticket/Display.html?id=40887 73 74* Fixed a bug in Template::Plugin::Filter that was causing the weakened 75 $self reference in a dynamic filter closure to be garbage collected 76 too soon. (NOTE: this has probably un-fixed a previous bug) 77 https://rt.cpan.org/Ticket/Display.html?id=46691 78 79* Applied patch to allow list.sort to sort on multiple fields. 80 https://rt.cpan.org/Ticket/Display.html?id=40637 81 82 83#----------------------------------------------------------------------- 84# Version 2.21_01 - 4th July 2009 85#------------------------------------------------------------------------ 86 87* Removed Template::Plugin::Autoformat and t/autoform.t. They're now 88 available as a separate distribution. 89 90* Fixed some Win32 test failures and XS Stash compilation problems. 91 92 93#----------------------------------------------------------------------- 94# Version 2.21 - 30th June 2009 95#------------------------------------------------------------------------ 96 97* Fixed a PRE_CHOMP bug that left \r characters lying around when 98 confronted with templates with DOS \r\n line endings. 99 https://rt.cpan.org/Ticket/Display.html?id=43345 100 101* Applied patch from Bradley Baetz to fix defblock #line numbers 102 http://rt.cpan.org/Public/Bug/Display.html?id=47024 103 104 105#----------------------------------------------------------------------- 106# Version 2.20_4 (2.21 candidate) - 21st May 2009 107#------------------------------------------------------------------------ 108 109* Added the even(), odd() and parity() methods to Template::Iterator to 110 assist in making zebra tables. 111 112* Removed a post-5.6 perlism in Template::Context that broke on 5.6.2 113 https://rt.cpan.org/Ticket/Display.html?id=46250 114 115* Replaced a whole bunch of UNIVERSAL::isa() calls with blessed/isa 116 117* Applied a patch from Norbert Buchmüller to prevent the #line markers 118 from being whitespaced away from the first column. 119 https://rt.cpan.org/Ticket/Display.html?id=46269 120 121* Applied a patch from Denis F. Latypoff to fix uri/url filters with 122 utf8 text 123 https://rt.cpan.org/Ticket/Display.html?id=41173 124 125 126#----------------------------------------------------------------------- 127# Version 2.20_3 (2.21 candidate) - 20th May 2009 128#------------------------------------------------------------------------ 129 130* Fixed the XS Stash to compile properly in threaded Perls. 131 https://rt.cpan.org/Public/Bug/Display.html?id=46240 132 133* Applied a patch to the XS Stash from Alexey A. Kiritchun to make the 134 scalar.length vmethod work correctly with utf8 strings. 135 http://lists.tt2.org/pipermail/templates/2009-May/010803.html 136 137 138#----------------------------------------------------------------------- 139# Version 2.20_2 (2.21 candidate) - 17th May 2009 140#------------------------------------------------------------------------ 141 142* Applied a patch to Template::Test from Andrew Ford to make it skip 143 properly. 144 http://lists.tt2.org/pipermail/templates/2009-March/010678.html 145 146* Changed the ttree -v/--verbose option so be less verbose and only 147 report on things that have changed. To make it more verbose (like 148 previous versions), add a second -v/--verbose flag, e.g. 149 150 $ ttree -v -v 151 152* Also added the --summary option to tree to print a summary of what it 153 did, and the --color/--colour option to make it print its verbose 154 messages in colour (on ANSI terminals). 155 156* Applied a ttree patch from Lyle Brooks to allow ttree to accept a 157 directory name as a command line argument. 158 159* Added the define_view() and define_views() method to Template::Context 160 and added the VIEWS option to pre-define views when the Template object 161 is created. Thanks to Timmy Chan for providing the groundwork on this. 162 http://lists.tt2.org/pipermail/templates/2009-April/010689.html 163 164* Retrospectively fixed the Changes for 2.20 to mention the ttree 165 --encoding option. 166 167* Applied a patch from Chisel Wright, changing uses of UNIVERSAL::can() 168 to use blessed() and ->can(). 169 http://lists.tt2.org/pipermail/templates/2009-May/010790.html 170 171* Fixed a memory leak in the XS Stash introduced in 2.20. 172 Thanks to Breno G. de Oliveira for reporting the problem and helping to 173 narrow it down. 174 https://rt.cpan.org/Public/Bug/Display.html?id=46058 175 176 177#------------------------------------------------------------------------ 178# Version 2.20_1 (2.21 candidate) - 7th April 2009 179#------------------------------------------------------------------------ 180 181* Deleted all the old HTML documentation (now available separately from 182 http://tt2.org/download/index.html#html_docs), examples, libraries and 183 other cruft that was way out of date and badly unloved. 184 185* Tweaked Template::Parser to work better with the ANYCASE option. It 186 now knows that anything following a dotop cannot be a keyword so that 187 you can write data.last without the 'last' bit being interpreted as the 188 LAST keyword. Thanks to Sean McAfee for the post that inspired it. 189 http://lists.tt2.org/pipermail/templates/2008-September/010462.html 190 191* Fixed a broken test for Apache::Util in the html_entity filter. Added 192 the use_html_entities() and use_apache_util() class methods to 193 Template::Filters to allow end-user selection of one or the other. 194 http://rt.cpan.org/Public/Bug/Display.html?id=40870 195 http://template-toolkit.org/svnweb/Template2/revision/?rev=1177 196 197* Tweaked Template::Context to recognise Badger::Exception objects and 198 convert them to Template::Exception objects. This is a temporary 199 measure to keep things working during the transition to Badger-based 200 modules. 201 202* Added the STRICT option which will cause the stash to throw an 203 exception on encountering an undefined value. Thanks to Ben Tilly 204 for the prod. 205 206* Applied a patch to Template::Iterator from Jonathon Padfield to make 207 get_all() do the right thing if get_first() hasn't been called. 208 209* Applied a patch to Template::Stash::Context from Ben Tilly to make 210 it easier to subclass. 211 212* Applied a patch from Robin Berjon to add the xml filter. 213 214 215#------------------------------------------------------------------------ 216# Version 2.20 - 13th August 2008 217#------------------------------------------------------------------------ 218 219* Updated all the documentation. 220 221* Restored the GIF images that got mangled in the switch from CVS to 222 Subversion. 223 224* Fixed the Makefile.PL to pre-glob the tests to keep things working 225 smoothly in Win32. 226 http://rt.cpan.org/Ticket/Display.html?id=25573 227 228* Applied a patch to Template::Directives from Ben Morrow to fix the 229 SWITCH/CASE directive when matching strings containing regex metacharacters. 230 http://rt.cpan.org/Ticket/Display.html?id=24183 231 232* Applied a patch to Template::Parser from Koichi Taniguchi to make it 233 treat TAGS with case sensitivity. 234 http://rt.cpan.org/Ticket/Display.html?id=19975 235 236* Changed html_entity_filter_factory() in Template::Filters to only look for 237 Apache::Utils and HTML::Entities once. 238 http://rt.cpan.org/Ticket/Display.html?id=19837 239 240 241Template::Stash 242--------------- 243 244* Applied a patch to Template::Stash from Jess Robinson which allows you 245 to call a list method on a single object and have it automatically 246 upgraded to a single item list. Changed the XS Stash to do the same. 247 http://lists.tt2.org/pipermail/templates/2006-November/009115.html 248 249* Fixed a minor bug in the XS Stash which prevented it from updating 250 hash entries with empty, but defined keys. Thanks to Yitzchak 251 Scott-Thoennes for reporting the problem. 252 http://lists.tt2.org/pipermail/templates/2007-November/009819.html 253 254* Applied a patch from Alexandr Ciornii to make the XS Stash compile 255 cleanly under VC++ 6.0 and with Sun's C compiler. 256 http://rt.cpan.org/Ticket/Display.html?id=20291 257 258 259Template::Provider 260------------------ 261 262* Fixed a minor bug in the Template::Provider code added in 2.19 that 263 caused errors in templates to only be reported once. Subsequent 264 fetches incorrectly returned 'not found' instead of repeating the 265 error. 266 267* Made Template::Provider use File::Spec->catfile instead of using '/' 268 and letting Perl worry about Doing The Right Thing. 269 http://rt.cpan.org/Ticket/Display.html?id=34489 270 271* Applied patch from Lyle Brooks to add binmode to the _template_content() 272 method in Template::Provider. 273 http://rt.cpan.org/Ticket/Display.html?id=38075 274 275* Applied patch from Ted Carnahan to silence UNIVERSAL::isa warnings in 276 Template::Provider. 277 http://rt.cpan.org/Ticket/Display.html?id=25468 278 279* Applied patch to Template::Provider from Andrew Hamlin which works around 280 a bug in Strawberry Perl on Win32. 281 http://rt.cpan.org/Ticket/Display.html?id=34578 282 283 284Template::VMethods 285------------------ 286 287* Applied a patch from Paul "LeoNerd" Evans to make the list.slice vmethod 288 work properly with negative indices. 289 http://lists.tt2.org/pipermail/templates/2008-March/010105.html 290 291 292Plugins 293------- 294 295* Added the Math plugin and related files to the MANIFEST so they 296 actually get shipped out as part of the distribution. D'Oh! 297 http://rt.cpan.org/Ticket/Display.html?id=27375 298 299* Added the Scalar plugin which adds the .scalar vmethod for calling 300 object methods and subroutines in scalar context. 301 302* Added Template::Plugin::Assert which allows you to assert that values 303 are defined. 304 305* Changed Template::Plugin::Filter to weaken the $self reference to avoid 306 circular references and memory leaks. Thanks to Masahiro Honma for 307 reporting the problem and suggesting the fix. 308 309* Applied patch from Ronald J Kimball to make Template::Plugin::Date accept 310 dates with the year coming first. 311 http://lists.tt2.org/pipermail/templates/2007-July/009540.html 312 313* Added C<1;> to the end of a few plugin modules that were missing it. 314 315ttree 316----- 317 318* Changed the --accept option in ttree to match against the full file 319 path (relative to --src dir) rather than just the file name. This 320 makes it behave the same way as the --ignore option. 321 322* Applied patch from Lyle Brooks to add binmode to the process() 323 call in ttree. 324 http://rt.cpan.org/Ticket/Display.html?id=38076 325 326* Added a patch from Nigel Metheringham also to set binmode in ttree 327 but via a configuration option. 328 https://rt.cpan.org/Ticket/Display.html?id=30760 329 330* Applied a patch from Éric Cholet to add the --encoding option to ttree. 331 http://lists.tt2.org/pipermail/templates/2008-August/010369.html 332 333 334#------------------------------------------------------------------------ 335# Version 2.19 - 27th April 2007 336#------------------------------------------------------------------------ 337 338* Applied a patch to t/fileline.t from Steffen Müller which fixes the 339 problems running on Win32 with backslashes in paths. 340 341 https://rt.cpan.org/Ticket/Display.html?id=20488 342 343* Applied a patch to the XS Stash from Randy Kobes which fixes some other 344 Win32 problems. 345 346 http://lists.tt2.org/pipermail/templates/2007-February/009247.html 347 348* Applied another patch to the XS Stash from Steve Peters which fixes 349 a problem with tied hashes under more recent version of Perl. 350 351 http://lists.tt2.org/pipermail/templates/2007-January/009181.html 352 353* Fixed a problem in the Perl Stash when using objects that have 354 overloaded comparison operators. Thanks to Randal Schwartz, Tatsuhiko 355 Miyagawa and Daisuke Maki for their contributions. 356 357 http://lists.tt2.org/pipermail/templates/2007-March/009265.html 358 359* Applied a patch from Bill Moseley to Template::Provider which adds 360 negative caching and moves some functionality into separate methods 361 to make subclassing easier. Also added the STAT_TTL configuration 362 parameter. 363 364 http://lists.tt2.org/pipermail/templates/2007-January/009183.html 365 366* Added the url filter as a less aggressive form of the uri filter. 367 Whereas the uri filter now (from v2.16 onwards) encodes all the 368 reserved characters (@, :, /, etc.) as per RFC2396, the url filter 369 leaves them intact and thus behaves just like the uri filter used 370 to. 371 372 http://lists.tt2.org/pipermail/templates/2007-March/009277.html 373 374#------------------------------------------------------------------------ 375# Version 2.18a - 9th February 2007 376#------------------------------------------------------------------------ 377 378* Applied a patch from Steve Peters to the Stash.xs to allow it to 379 compile with bleadperl 5.9.x 380 381 https://rt.cpan.org/Public/Bug/Display.html?id=22506 382 383#------------------------------------------------------------------------ 384# Version 2.18 - 9th February 2007 385#------------------------------------------------------------------------ 386 387* Merged in Adam's changes in 2.16 and 2.17 back into the developer CVS 388 repository and added his name to the credits. 389 390* Changed the parser grammar to accept expressions as arguments to a 391 subroutine, method or virtual method call. I'm embarrassed to admit 392 that it was a one line change that could (and should) have been made 393 long ago, if only I had realised just how trivial it was. Anyway, 394 you can now write nested expressions like this: 395 396 [% add(a+5, b < 10 ? c : d + e*5) %] 397 398* Put the t/fileline.t test back in as this was fixed in 2.15a 399 400* Added the Template::Toolkit documentation-only module. 401 402#------------------------------------------------------------------------ 403# Version 2.17 - 8th Feb 2007 404#------------------------------------------------------------------------ 405 406Another interim release from Adam Kennedy. 407 408* Change in Makefile.PL to force an upgrade to File::HomeDir 0.64 on darwin. 409 This is due to problems caused by changes made to Perl on the new Intel 410 versions of Mac OS X. 411 412* skip_all filelines.t on darwin 413 414#------------------------------------------------------------------------ 415# Version 2.16 - 23rd Jan 2007 416#------------------------------------------------------------------------ 417 418Interim release from Adam Kennedy. 419 420* Skip fileline.t on Win32, as it has some hard-coded path seperator 421 assumptions. This will be fixed more comprehensively later. 422 423* Handle spurious errors in Makefile.PL when a dev version of 424 ExtUtils::MakeMaker is installed. 425 426* Don't say "nmake" on Win32 when $Config{make} is 'dmake'. 427 This corrects the message on Strawberry Perl. 428 429 430#------------------------------------------------------------------------ 431# Version 2.15c - Not released ## DEVELOPER RELEASE ## 432#------------------------------------------------------------------------ 433 434* Fixed a bug in Template::Parser which caused it to get confused about 435 block names if it encountered a syntax error inside a BLOCK. Thanks 436 to Bill Moseley for reporting the problem. 437 438 http://lists.tt2.org/pipermail/templates/2006-July/008815.html 439 440* Fixed a minor buglet in Template::Provider which came to light while 441 investigating the above problem. If a previously cached template is changed 442 on disk and then fails to compile, the provider now invalidates the cache 443 entry immediately. Without this fix, the provider would report the error 444 once, then reuse the cached good version of the template until $STAT_TTL 445 ticked over when it would try to load and compile the disk version again. 446 The problem was that error messages were only reported once every $STAT_TTL 447 second(s) and any requests for the same template in the interim time would 448 mysteriously work. This way errors get reported consistently and immediately 449 and no-one has to waste an afternoon trying to figure out where the errors 450 went! 451 452#------------------------------------------------------------------------ 453# Version 2.15b - 30th May 2006 ## DEVELOPER RELEASE ## 454#------------------------------------------------------------------------ 455 456* Changed the uri filter to escape all reserved characters as per 457 URI::Escape and RFC2396. This now includes &, @, /, ;, :, =, +, ? 458 and $ which were previously not escaped. Thanks to islue@cpan.org 459 for reporting the problem. 460 461 http://rt.cpan.org/Ticket/Display.html?id=19593 462 463* Also changed the uri filter to encode all wide characters as the 464 equivalent UTF escapes. Thanks to Jonathan Rockway for reporting 465 the problem. 466 467 http://rt.cpan.org/Ticket/Display.html?id=19354 468 469* Fixed the redirect filter to not support relative paths. Thanks to 470 Paul Seamons for spotting the problem and providing a solution. 471 472* Moved all the virtual methods out of Template::Stash and into 473 a new Template::VMethods module. 474 475* Fixed the version number of Template::Stash which had rolled over 476 to 2.102 making it appear to predate the 2.86 stash in TT v2.14. 477 Thanks to Randal Schwartz for reporting the problem. Changed all 478 version numbers in other modules to be a hard-coded numbers instead 479 of grokking it automagically from the CVS revision. 480 481* Changed the _recover() method of Template::Service to check if the 482 error thrown is a Template::Exception object rather than just a 483 reference. Thanks to David Wheeler for reporting the problem. 484 485 http://rt.cpan.org/Ticket/Display.html?id=17630 486 487* Fixed the some tests in stash.t and stash-xs.t which were failing 488 under Perl 5.6.2 due to a slightly different error message being 489 generated. Thanks to Anton Berezin for reporting the problem. 490 491* Fixed a bug in the Template::Provider _load() method to check that 492 $data is a hash ref before trying to mess with its innards. Thanks 493 to barbie@cpan.org for reporting the problem. 494 495 http://rt.cpan.org/Ticket/Display.html?id=18653 496 497 498#------------------------------------------------------------------------ 499# Version 2.15a - 29th May 2006 ## DEVELOPER RELEASE ## 500#------------------------------------------------------------------------ 501 502* Removed the latex filter from Template::Filters and related config 503 variables from Template::Config 504 505* Changed the t/fileline.t test to remove the line number from what Perl 506 reports as "(eval $line)". It appears to get the $line wrong on 507 FreeBSD, although the correct line number is reported following that 508 so the tests still do the right thing. Thanks to Anton Berezin for 509 reporting the problem. 510 511* Changed the t/compile3.t test to do something similar. 512 513 514#------------------------------------------------------------------------ 515# Version 2.15 - 26th May 2006 516#------------------------------------------------------------------------ 517 518Chomping Options 519---------------- 520 521* Added the CHOMP_GREEDY option and '~' chomping flag. Changed 522 CHOMP_COLLAPSE to greedily chomp all whitespace (including multiple 523 newlines) and replace it with a single space. Previously it only 524 chomped one line. Renamed the CHOMP_ALL option to CHOMP_ONE which 525 makes more sense. CHOMP_ALL is still provided as an alias for 526 CHOMP_ONE for backwards compatibility. Thanks to Paul Seamons for 527 doing all the hard work on this. 528 529 http://lists.tt2.org/pipermail/templates/2006-February/thread.html#8354 530 531* Added code to the replace text virtual method to use a faster and 532 simpler implementation if the replacement text doesn't contain any 533 back references. Thanks to Josh Rosenbaum for all his efforts on 534 this. 535 536 http://lists.tt2.org/pipermail/templates/2006-February/008344.html 537 538Stash 539----- 540 541* Changed various tests for private/hidden variables (starting '_' 542 or '.') to use a regex defined in the $PRIVATE package variable in 543 Template::Stash. This can be redefined or undefined. Note that 544 the XS Stash only looks to see if $PRIVATE is defined or not, and 545 currently hard-codes the regex. 546 547Plugins 548------- 549 550* Changed the Image plugin tag() method to call the name() method 551 instead of accessing the name directly, making it easier for 552 subclasses to provide an alternate name. Thanks to Cees Hek for 553 his patch. 554 555 http://lists.tt2.org/pipermail/templates/2006-February/008423.html 556 557* Change the AUTOLOAD regex in the Table plugin to be more robust. 558 559 http://lists.tt2.org/pipermail/templates/2006-May/008602.html 560 561Documentation 562------------- 563 564* Added the Template::Toolkit documentation pointing people to 565 the right place. 566 567* Updated the Template::Stash::XS documentation to remove the 568 "experimental" description and tidy things up a bit. 569 570 571#------------------------------------------------------------------------ 572# Version 2.14a - 2nd February 2006 ## DEVELOPER RELEASE ## 573#------------------------------------------------------------------------ 574 575Stash 576----- 577 578* Activated a patch in Template::Stash from Stephen Howard which adds 579 code for the full set of fallbacks for dot ops called against 580 objects which don't implement the specific method. For example 581 [% hashobj.vmethod %] [% listobj.2 %] and [% listobj.vmethod %] now 582 all work with the Perl Template::Stash. Added code to the XS Stash 583 to do the same and updated tests. 584 585 http://template-toolkit.org/pipermail/templates/2003-December/005417.html 586 587* Added full support for tied hashes and tied lists in the XS Stash. 588 Added some further tests to make sure it's all working as expected. 589 590 http://lists.tt2.org/pipermail/templates/2006-January/008266.html 591 592* Applied path from Slaven Rezic to Template::Stash::XS to check 593 return code in tt_fetch_item() in a way which plays nicely with tied 594 hashes. 595 596 http://rt.cpan.org/Ticket/Display.html?id=7830 597 598* Changed Template::Stash and Template::Stash::XS to evaluate list 599 vmethods in lvalues. 600 601 http://lists.tt2.org/pipermail/templates/2006-January/008198.html 602 603* Changed Template::Stash to be a little more strict about what it 604 considers a failed method call. This allows exception thrown within 605 called methods to be propagated correctly rather than being ignored 606 as undefined method. Thanks to Dave Howorth, Tom Insam and Stig 607 Brautaset for reporting the problem and providing fixes. 608 609 http://lists.tt2.org/pipermail/templates/2005-April/007375.html 610 http://lists.tt2.org/pipermail/templates/2006-February/008367.html 611 612* Removed redundant performance profiling code from 613 Template::Stash::XS. Must check with Doug that this is OK and he's 614 not still using it... 615 616 617Virtual Methods 618--------------- 619 620* Added the scalar.remove, scalar.substr, hash.delete, hash.items, 621 hash.pairs, list.import and list.hash virtual methods. 622 623* Changed the scalar.replace method to work properly with back 624 references ($1, $2, etc) by incorporating ideas, code and tests from 625 Nik Clayton, Paul Seamon, Sergey Martynoff, Josh Rosenbaum and 626 others. 627 628 http://lists.tt2.org/pipermail/templates/2006-February/008306.html 629 http://lists.tt2.org/pipermail/templates/2006-February/008326.html 630 631* Changed list.push and list.unshift to accept multiple arguments, 632 thanks to Bill Moseley. 633 634 http://lists.tt2.org/pipermail/templates/2006-January/008294.html 635 636* Fixed the split scalar virtual method which wasn't accepting the 637 second argument (limit) correctly. Thanks to Josh Rosenbaum for 638 pointing out the problem. 639 640 http://lists.tt2.org/pipermail/templates/2005-October/007982.html 641 642* Documented the fact that hash.list is going to change in the future, 643 recommending people switch to hash.pairs. 644 645 http://lists.tt2.org/pipermail/templates/2006-January/008256.html 646 http://lists.tt2.org/pipermail/templates/2006-February/008312.html 647 648* Added the global option to the 'match' scalar virtual method. 649 650* Changed $element to $component in Template::Context to fix callers 651 bug, thanks to Andy Maas who identified the problem and found the 652 solution: 653 654 http://lists.tt2.org/pipermail/templates/2004-December/007020.html 655 656* Changed the sort and nsort list virtual methods to always return 657 references to lists, avoiding any ambiguity in return results. 658 659* Changed the hash.defined method to do the same thing as 660 scalar.defined when called without arguments. Added list.defined to 661 do the same thing as hash.defined. 662 663 http://rt.cpan.org/Ticket/Display.html?id=9094 664 665* Moved all the tests into t/vmethods/* 666 667 668Plugins 669------- 670 671* Added the $Template::Plugins::PLUGIN_BASE package variable to define 672 the default 'Template::Plugin' value for the PLUGIN_BASE option. By 673 clearing this value before calling the Template new() constructor, 674 you can avoid having Template::Plugin added to the PLUGIN_BASE by 675 default. Also changed PLUGINS search to look for lower case plugin 676 name as well as case-specific name. Thanks yet again Josh for 677 addressing this issue. 678 679 http://lists.tt2.org/pipermail/templates/2006-January/008225.html 680 681* Applied a single character patch from Lubomir Host which fixes the 682 user attribute in Template::Plugin::File. 683 684* Added the Math Plugin to MANIFEST. 685 686* Changed the URL plugin to ignore parameters that are unset (e.g. 687 defined but zero length) 688 689* Applied two patches to the Image plugin from Bill Moseley to escape 690 attributes in the tag() method and to provide the 'file' options. 691 Also adds proper documentation for the 'root' option. 692 693 http://lists.tt2.org/pipermail/templates/2005-November/008086.html 694 http://lists.tt2.org/pipermail/templates/2005-December/008189.html 695 696* Added the $JOINT package variable to Template::Plugin::URL to 697 provide a work-around for the URL plugin which incorrectly (as 698 we now know) encodes '&' as '&' 699 700 http://rt.cpan.org//Ticket/Display.html?id=11551 701 http://lists.tt2.org/pipermail/templates/2005-December/008158.html 702 703* Added substr() method to the String plugin, as suggested here: 704 705 http://rt.cpan.org/Ticket/Display.html?id=2619 706 707* Moved all XML plugins and related tests into a separate Template-XML 708 distribution. 709 710* Moved DBI plugin and tests into Template-DBI distribution. 711 712* Moved GD plugins and tests into Template-GD distribution. 713 714 715Filters 716------- 717 718* Applied a patch to the truncate() filter from "Ashley" which 719 adds a second argument. 720 721 http://lists.tt2.org/pipermail/templates/2005-December/008145.html 722 723* Fixed a bug in the same truncate() filter to stop it from truncating 724 strings that are exactly as long as the limit (change '<' to '<='), 725 thanks to Nicholas at oxhoej.dk. 726 727 http://rt.cpan.org/Ticket/Display.html?id=8911 728 729* Added "use locale" to Template::Filters to enable locale-specific 730 filters. 731 732 http://rt.cpan.org/Ticket/Display.html?id=9094 733 http://rt.cpan.org/Ticket/Display.html?id=5695 734 735* Updated documentation to reflect the fact that the html filter also 736 escapes " as " Thanks to Geoff Richards for reporting it. 737 738* Moved Latex filters into Template-Latex distribution. 739 740 741ttree 742----- 743 744* Applied patch from Yuri Pimenov to prevent ttree from raising a 745 warning when the --depend_debug option is used. 746 747 http://lists.tt2.org/pipermail/templates/2005-May/007400.html 748 749* Applied a patch to ttree from Slaven Rezic which fixes the arguments 750 passed to mkpath. 751 752 http://rt.cpan.org//Ticket/Display.html?id=14216 753 754* Applied a patch to ttree from Mike Schilli to prevent it from going 755 into an infinite loop on encountering a directory called "0" 756 757 https://rt.cpan.org/Ticket/Display.html?id=14905 758 759* Fixed configuration section to not prompt "Do you want me to create 760 a sample .ttreerc file?" if the -h/--help options are specified, 761 thanks to Slaven Rezic for reporting the problem. 762 763 http://rt.cpan.org/Ticket/Display.html?id=4180 764 765* added AppConfig EXPAND => EXPAND_ALL option to perl5lib, 766 template_plugin_base, template_compile_dir and depend_file 767 configuration options to allow them to contain ~ to indicate 768 the user's home directory, or $WHATEVER for environment variables, 769 as per the other path-specific options like src, lib, etc. 770 771Miscellaneous 772------------- 773 774* Added code to Makefile.PL to detect $ENV{PERL_MM_USE_DEFAULT} to 775 accept all defaults. Thanks to KANE. 776 777 http://rt.cpan.org/Ticket/Display.html?id=14613 778 779* Removed vStrings from Template::Document. Thanks to Dave Cross for 780 reporting the problem. 781 782 http://lists.tt2.org/pipermail/templates/2005-April/007357.html 783 784* Applied a patch from Barrie Slaymaker which corrects a bug in the 785 Template::Parser line counting when using chomp flags. 786 787 http://lists.tt2.org/pipermail/templates/2005-December/008157.html 788 789* Applied a patch from Jess Robinson to move the Template::Provider 790 check for file freshness into a separate method, in order to 791 play nicely with his Template::Provider::DBI module. 792 793 http://lists.tt2.org/pipermail/templates/2005-December/008143.html 794 795* Fixed the regex matching relative paths in Template::Provider, thanks 796 to Josh Rosenbaum 797 798 http://lists.tt2.org/pipermail/templates/2005-January/007141.html 799 800* Applied a patch to Template::Provider to prevent a misleading error 801 message, thanks to Slaven Rezic. 802 803 http://rt.cpan.org/Ticket/Display.html?id=5327 804 805* Added an eval wrapper around mkpath() in Template::Provider to handle 806 errors more nicely. 807 808* Numerous documentation fixes. 809 810 811 812#------------------------------------------------------------------------ 813# Version 2.14 - 4th October 2004 814#------------------------------------------------------------------------ 815 816* Applied patch from Harald Joerg to prevent ttree from spewing warnings 817 when copying files. 818 http://template-toolkit.org/pipermail/templates/2004-March/005897.html 819 820* Applied a patch from Paul Orrock to fix a couple of missing errors in 821 ttree. 822 http://template-toolkit.org/pipermail/templates/2004-September/006605.html 823 824* Commented out line 797 of Template::Directive.pm which serves no 825 purpose and generates a warning. 826 827* Applied a patch from Mark Fowler to add support for Unicode to TT. 828 http://template-toolkit.org/pipermail/templates/2004-June/006270.html 829 830* Changed the fourth argument to process() to accept named IO layers for 831 binmode, e.g. process($in, $vars, $out, binmode => ':utf8'); 832 833* Added full range of command line options to tpage. 834 http://template-toolkit.org/pipermail/templates/2004-September/006545.html 835 836* Applied patches from Tosh Cooey, Simon Wilcox and Kenny Gatdula to fix 837 XML::Simple to allow direct access to XMLin() and XMLout() methods. See 838 http://template-toolkit.org/pipermail/templates/2004-September/006620.html 839 840* Fixed a bug in the 'callers' list maintained by a template component 841 which was failing to remove callers from the list after processing. 842 http://template-toolkit.org/pipermail/templates/2004-April/006070.html 843 844* Applied a doc patch from Dave Cash documenting caller and callers. 845 http://template-toolkit.org/pipermail/templates/2004-March/005960.html 846 847 848#------------------------------------------------------------------------ 849# Version 2.13 - 30th January 2004 850#------------------------------------------------------------------------ 851 852* Applied patch from Dave Cash to add 'caller' and 'callers' to 853 'component', see 854 http://lists.tt2.org/pipermail/templates/2004-January/005581.html 855 856* Applied patch from Dylan William Hardison to ttree which prevents 857 dependencies from interfering with files that are copied. See 858 http://lists.tt2.org/pipermail/templates/2003-December/005458.html 859 860 861#------------------------------------------------------------------------ 862# Version 2.12a - 13th January 2004 ## DEVELOPER RELEASE ## 863#------------------------------------------------------------------------ 864 865* Fixed the bug in test 25 of t/date.t, hopefully for good this time, 866 thanks to the efforts of Steve Peters. See: 867 http://template-toolkit.org/pipermail/templates/2004-January/005560.html 868 869* Added the FILE_INFO option to Template::Parser. Enabled by default, 870 this can be set to 0 to prevent the parser from adding file and line 871 info to the generated Perl file. Don't ask me why - Autrijus wanted 872 it (which probably means he's up to something twisted again :-). See: 873 http://template-toolkit.org/pipermail/templates/2004-January/005552.html 874 875 876#------------------------------------------------------------------------ 877# Version 2.12 - 12th January 2004 878#------------------------------------------------------------------------ 879 880* Added the module_version() method to Template::Base to report the 881 version number of a module. Added some tests to t/base.t. 882 883* Added the --template_module option to ttree, to allow the user to 884 specify a template processing module other than the default 'Template' 885 to be used. Also changed various print statements to send all 886 verbose output to stdout, whereas previously it was split across stdout 887 and stderr. 888 889 890#------------------------------------------------------------------------ 891# Version 2.11b - 7th January 2004 ## DEVELOPER RELEASE ## 892#------------------------------------------------------------------------ 893 894* Applied patch from Myk Melez to ensure the 'component' variable 895 remains correctly set to the current templates. See 896 http://template-toolkit.org/pipermail/templates/2004-January/005483.html 897 898 899#------------------------------------------------------------------------ 900# Version 2.11a - 6th January 2004 ## DEVELOPER RELEASE ## 901#------------------------------------------------------------------------ 902 903* Fixed bug in t/date.t and corrected version number of 904 Template::Grammar. 905 906 907#------------------------------------------------------------------------ 908# Version 2.11 - 6th January 2004 909#------------------------------------------------------------------------ 910 911* Bumped version number and updated documentation for release. 912 913 914#------------------------------------------------------------------------ 915# Version 2.10b - 2nd December 2003 ## DEVELOPER RELEASE ## 916#------------------------------------------------------------------------ 917 918* Changed the Template::Document process() method to pass itself 919 to the context visit() method when it calls it. Similarly, changed 920 the context visit() method to expect it. This is useful when 921 subclassing the context but shouldn't have any other effect. 922 923* Modified parser to add the file name and line number of the source 924 template to generated Perl code. This provides useful information 925 when warnings and errors are generated by Perl at runtime. Added 926 the t/fileline.t script to test it. 927 928 929#------------------------------------------------------------------------ 930# Version 2.10a - 9th October 2003 ## DEVELOPER RELEASE ## 931#------------------------------------------------------------------------ 932 933* Applied two patches from Axel Gerstmair to fix bugs in Makefile.PL 934 and t/date.t. See. 935 http://lists.tt2.org/pipermail/templates/2003-April/004553.html 936 http://lists.tt2.org/pipermail/templates/2003-May/004572.html 937 938* Applied patch from Jim Cromie to t/autoform.t to skip tests on all 939 versions of Perl from 5.8.0 onwards. 940 941* Changed $OUTPUT in Template::Directive to be a package variable, 942 allowing it to be re-defined to permit a flushed output hack. 943 http://lists.tt2.org/pipermail/templates/2003-October/005136.html 944 945* Applied a patch from Darren to the 'item' hash vmethod to protect 946 against accessing private variables (prefixed '.' or '_') 947 http://lists.tt2.org/pipermail/templates/2003-June/004761.html 948 949* Applied a patch from Ivan Adzhubey to template/splash/frame. 950 http://lists.tt2.org/pipermail/templates/2003-August/004953.html 951 952* Applied a patch from Bryce Harrington to add the absolute and 953 relative options to ttree. Also applied a patch from Mark Anderson 954 to add the 'template_debug'. Removed the old debug option which was 955 as good as useless. 956 http://lists.tt2.org/pipermail/templates/2003-October/005110.html 957 http://lists.tt2.org/pipermail/templates/2003-October/005126.html 958 959* Applied another patch from Mark to push files named on the command 960 line through the process_file() sub to ensure that various options 961 like accept checking, pemission preserving and copy processing (but 962 not modification time) are applied. 963 http://lists.tt2.org/pipermail/templates/2003-October/005132.html 964 965* Applied a variation of yet another ttree patch from Mark to add the 966 'suffix' option for changing the suffix of output files created. 967 http://lists.tt2.org/pipermail/templates/2003-October/005121.html 968 969* Applied a variation of a patch from Dylan William Hardison which 970 adds the 'depend' and 'depend_file' options to ttree. 971 http://lists.tt2.org/pipermail/templates/2003-July/004783.html 972 http://lists.tt2.org/pipermail/templates/2003-October/005147.html 973 974 975#------------------------------------------------------------------------ 976# Version 2.10 - 24th July 2003 977#------------------------------------------------------------------------ 978 979* Merged in Darren's branch to add the define_vmethod() methods to 980 Template::Context and Template::Stash. 981 982* Applied patch from Axel Gerstmair for minor fixes to Makefile.PL, 983 t/gd.t and t/date.t. 984 http://template-toolkit.org/pipermail/templates/2003-April/004545.html 985 986* Added undefined() method to the Stash which get() calls if a variable 987 value is undefined. Currently just returns '' to implement existing 988 behaviour, but it provides a method hook for subclasses to redefine. 989 990* Fixed a minor bug which prevented the Stash from being subclassable 991 by removing references to __PACKAGE__ 992 993 994#------------------------------------------------------------------------ 995# Version 2.09c - 29th April 2003 ## DEVELOPER RELEASE ## 996#------------------------------------------------------------------------ 997 998* applied patch from Ivan Kurmanov to XPath plugin to add handling for 999 comments. 1000 1001* modified grammar to allow 'IN' as an alternate for '=' in FOREACH 1002 directives, thus allowing [% FOREACH item IN [ foo, bar, baz ] %] 1003 http://template-toolkit.org/pipermail/templates/2003-April/004519.html 1004 1005* changed test for PROCESS option in Template::Service init from 'exists' 1006 to 'defined' so that PROCESS set to undef Does The Right Thing. 1007 http://template-toolkit.org/pipermail/templates/2003-April/004536.html 1008 1009* changed Template::process() method to accept a hash reference or list 1010 of output options following any filename. This can now be used to 1011 explicitly set binary mode (or not) for the output of a file. Also 1012 changed Template::_output() method to expect a reference to text rather 1013 than a duplicated text string (for efficiency) and also the new hash 1014 reference of options. Also changed the redirect and stdout filters 1015 accordingly. 1016 1017* disabled the mandatory binmode setting on all files created under 1018 MSWin32. See previous item for details on how binmode can now be 1019 set explicitly, or link below for description of problem. 1020 http://template-toolkit.org/pipermail/templates/2003-April/004499.html 1021 1022* applied patch from Axel Gerstmair to Makefile.PL to add TT_EXTRAS item. 1023 http://template-toolkit.org/pipermail/templates/2003-April/004543.html 1024 1025 1026#------------------------------------------------------------------------ 1027# Version 2.09b - 24th April 2003 ## DEVELOPER RELEASE ## 1028#------------------------------------------------------------------------ 1029 1030* fixed bug introduced in 2.08e which caused some exception handling to 1031 fail under Perl 5.6.1 and earlier. 1032 http://template-toolkit.org/pipermail/templates/2003-April/004502.html 1033 1034* applied patch from Tatsuhiko Miyagawa to gd.t test to change size test 1035 from 6500 to 6000. 1036 1037* applied patch from Axel Gerstmair to the Image plugin. 1038 http://template-toolkit.org/pipermail/templates/2003-April/004496.html 1039 1040 1041#------------------------------------------------------------------------ 1042# Version 2.09a - 23rd April 2003 ## DEVELOPER RELEASE ## 1043#------------------------------------------------------------------------ 1044 1045* added WRAPPER configuration item, documentation and tests. Also added 1046 'wrapper' configuration item to ttree. See Template::Manual::Config 1047 1048* applied patch from Axel Gerstmair to fix File::Spec and File::Temp 1049 versions in Makefile.PL. 1050 http://template-toolkit.org/pipermail/templates/2003-April/004480.html 1051 1052#------------------------------------------------------------------------ 1053# Version 2.09 - 23rd April 2003 1054#------------------------------------------------------------------------ 1055 1056* Bumped version number for release. 1057 1058 1059#------------------------------------------------------------------------ 1060# Version 2.08e - 18th March 2003 ## DEVELOPER RELEASE ## 1061#------------------------------------------------------------------------ 1062 1063* changed Template::Provider and Template::Context to propagate nested 1064 exceptions (e.g. [ file => [ parse => 'blah blah' ] ]) to allow the 1065 caller to accurately differentiate between parse errors and missing 1066 file or other errors. 1067 http://lists.tt2.org/pipermail/templates/2003-March/004359.html 1068 1069* applied a patch from Gervase Markham to add set_legend() to the 1070 various GD::Graph modules that works with a list of arguments. 1071 http://lists.tt2.org/pipermail/templates/2003-March/004316.html 1072 1073 1074#------------------------------------------------------------------------ 1075# Version 2.08d - 18th March 2003 ## DEVELOPER RELEASE ## 1076#------------------------------------------------------------------------ 1077 1078* Made Template::Exception DTRT with overloading (mark) 1079 1080* Applied a patch from Jonas Liljegren to lower the chunking limit of 1081 the parser regex to prevent a segfault. See 1082 http://lists.tt2.org/pipermail/templates/2003-February/004290.html 1083 1084* Applied Pudge's patch for the XS Stash bug. See 1085 http://lists.tt2.org/pipermail/templates/2003-February/004289.html 1086 1087 1088#------------------------------------------------------------------------ 1089# Version 2.08c - 4th November 2002 ## DEVELOPER RELEASE ## 1090#------------------------------------------------------------------------ 1091 1092* Applied a patch from Bradley Baetz to work around a bug in Perl when 1093 using an overridden die(), as CGI::Carp does, for example. 1094 1095* Added the Image plugin interfacing to the Image::Size module, based 1096 on examples posted to the mailing list by Darren and Mark. See 1097 http://lists.tt2.org/pipermail/templates/2002-November/003876.html 1098 1099 1100#------------------------------------------------------------------------ 1101# Version 2.08b - 1st November 2002 ## DEVELOPER RELEASE ## 1102#------------------------------------------------------------------------ 1103 1104* Applied two patches from Leon to fix bug in constant folding with 1105 multiple replacements (a missing 'g' on a s///) 1106 1107* Applied a patch from Tatsuhiko Miyagawa to Template::Constants to 1108 replace 'our' perl5.6isms. 1109 1110* Added the Template::Plugin::Procedural module for creating plugins that 1111 use subroutines rather than method calls. 1112 1113* Fixed a html.t test to allow numerical instead of named entities (mark) 1114 1115* Added the params() method to the CGI plugin. 1116 1117* Changed File::Temp and File::Basename to be loaded dynamically in 1118 Template::Document as and when needed. Thanks to a patch from 1119 Bradley Baetz. 1120 1121* Added a preload() method to Template::Config to preload in advance 1122 all the Template::* modules typically used. Also added call to 1123 preload() from Template module if $ENV{MOD_PERL} is set. 1124 1125* Applied a patch from Randal Schwartz to fix rowspan attribute in 1126 templates/html/cell and templates/html/row 1127 1128 1129#------------------------------------------------------------------------ 1130# Version 2.08a - 14th August 2002 ## DEVELOPER RELEASE ## 1131#------------------------------------------------------------------------ 1132 1133* Totally re-implemented the handling of the DEBUG parameter. Added 1134 DEBUG_* constants to Template::Constants which can be used to enable 1135 different debugging options and messages. 1136 1137* Added skip_all($reason) to Template::Test and fixed up a whole bunch 1138 of tests to use it. Also made other minor fixes to the tests to run 1139 nicely (or bail politely) under Perl 5.8.0 1140 1141* Applied patch from Slaven Rezic to Template::Plugin::Data which 1142 modifies the locale loading to append various suffixes (e.g. '.UTF-8') 1143 in the case that the unadorned locale can't be loaded. 1144 1145* Bumped version number of File::Spec to 0.8 in Makefile.PL PREREQ_PM. 1146 Previous versions didn't include splitdir(). Thanks to Slaven Rezic 1147 for reporting the problem. 1148 1149 1150#------------------------------------------------------------------------ 1151# Version 2.08 - 30th July 2002 1152#------------------------------------------------------------------------ 1153 1154* Applied two minor patches from Leon to remove 'use warnings' from 2 1155 test scripts to maintain compatability with 5.005 1156 1157 1158#------------------------------------------------------------------------ 1159# Version 2.07c - 22nd July 2002 ## DEVELOPER RELEASE ## 1160#------------------------------------------------------------------------ 1161 1162* Fixed a bug in Date plugin introduced in last version which caused 1163 it to ignore the 'time' parameter. 1164 1165* Modified INCLUDE_PATH handling in Template::Provider to accept a 1166 reference to a subroutine or object implementing a paths() method 1167 as an element in the list. This is then called to return a 1168 dynamically generated path. Documented and tested. 1169 1170* Changed the implementation of the NAMESPACE calling code to leave 1171 the namespace prefix intact on the ident list which then gets 1172 passed to the handler's ident() method. Modified the ident() 1173 method of Template::Namespace::Constants to expect and remove it. 1174 Constant folding now *doesn't* happen for constants that return 1175 a reference or undefined value. These get compiled as regular 1176 runtime variable lookups. 1177 1178* Added new list virtual methods: 'unique' to cull multiple identical 1179 items, 'merge' to merge lists together, 'splice' which acts 1180 just like Perl's splice, and 'slice' which returns a slice of the 1181 list. Also modified first and last virtual methods to take an 1182 argument indicating the number of items to return from the start or 1183 end of the list. Added the 'chunk' scalar virtual method to split a 1184 string into chunks of a particular flushed either left or right. 1185 (darren, mark, abw) 1186 1187* Moved documentation for virtual methods into a separate manpage, 1188 Template::Manual::VMethods 1189 1190* Modifed Template::Test to allow -- name testname -- comments to 1191 be added to tests to give them names, reported by test harness 1192 (darren) 1193 1194* Merged functionality of process() and include() methods into 1195 process() with optional third $localize flag. (darren) 1196 1197* Modified the OUTPUT option to accept a reference to a list (darren) 1198 1199 1200#------------------------------------------------------------------------ 1201# Version 2.07b - 7th July 2002 ## DEVELOPER RELEASE ## 1202#------------------------------------------------------------------------ 1203 1204* Added the CONSTANTS, CONSTANTS_NAMESPACE and NAMESPACE options, the 1205 Template::Namespace::Constants module, documentation and t/constants.t 1206 test suite. This adds support for compile-time constant folding and 1207 other custom namespace handlers. 1208 1209 1210#------------------------------------------------------------------------ 1211# Version 2.07a - 5th July 2002 ## DEVELOPER RELEASE ## 1212#------------------------------------------------------------------------ 1213 1214* Changed the Perl and XS stashes to automatically promote a scalar 1215 to a list and apply a list virtual method (if defined) as a last 1216 ditch attempt. 1217 1218* Changed Template::Stash::Context virtual methods to import those 1219 of Template::Stash. 1220 1221* Fixed a potential race condition when using compiled templates 1222 by changing Template::Document::write_perl_file() to write 1223 to a temporary file and then rename it into place, thus preventing 1224 two separate processes attempting to write the same file at the 1225 same time. 1226 1227* Added the DEBUG and DEBUG_FORMAT options and the corresponding 1228 DEBUG directive. 1229 1230* Fixed bug introduced to Template::Provider in 2.06g which changed 1231 handling of trailing slashes on COMPILE_DIR. 1232 1233* Fixed a bug in Template::Parser to preserve any post-chomp flags 1234 that were otherwise ignored when an entire directive is commented 1235 out, e.g. 1236 1237 [%# blah 1238 # blah 1239 -%] 1240 1241* Applied a patch from Harald Joerg so that ttree considers files 1242 with equal mtime to be "not modified". 1243 1244* Applied a patch from Keith Murphy adding the gmt flag to the Date 1245 plugin. 1246 1247* Applied Makefile.PL portability patch from Chris Nandor. 1248 1249* Minor documentation fixes. 1250 1251 1252#------------------------------------------------------------------------ 1253# Version 2.07 - 17th April 2002 1254#------------------------------------------------------------------------ 1255 1256* Changed example in synopsis of Template::Plugin::XML::Style to one 1257 based on that posted to the mailing list by Tony Bowden. 1258 1259* Fixed a single/double quoting bug in docsrc which prevented [% and %] 1260 being correctly displayed in the tables of contents in HTML docs. 1261 1262 1263#------------------------------------------------------------------------ 1264# Version 2.06g - 15th April 2002 ## DEVELOPER RELEASE ## 1265#------------------------------------------------------------------------ 1266 1267* Fixed a bug in ttree which prevented it from passing the recurse option 1268 onto the Template object due to a name mismatch: recurse/recursion 1269 1270* Changed Template::Test to accept messages to ok(). Also added is() 1271 as an alias for match(). 1272 1273* Fixed an oversight/bug in the XS stash where a missing aTHX_ around 1274 line 546 caused compilation to fail under Win32. 1275 1276* Applied a patch to Template::Provider from Alexander Schilling which 1277 untaints paths before calling mkpath() to prevent errors under -T. 1278 1279* Fixed Template::Parser so that the INTERPOLATE option now works with 1280 files > 32K, thanks to the efforts of Stephen Adkins. 1281 1282 1283#------------------------------------------------------------------------ 1284# Version 2.06f - 13th March 2002 ## DEVELOPER RELEASE ## 1285#------------------------------------------------------------------------ 1286 1287* Fixed a bug in both the Perl and XS Stash modules which resulted in 1288 virtual methods being called on the base stash, e.g. [% size %] 1289 was treated as [% stash.size %]. The only exception that we allow 1290 through is 'import' so that we can [% import(another_hash) %] 1291 1292* Fixed the compilation of the XS Stash on earlier versions of Perl 1293 (e.g. 5.00503) and other platforms (e.g. Win32) by including the 1294 ppport.h file. 1295 1296* Fixed a warning about undefined values in Template::Plugin::Format 1297 raised by t/format.t 1298 1299* Fixed a warning in t/html.t raised when neither Apache::Util nor 1300 HTML::Entities is installed. 1301 1302 1303#------------------------------------------------------------------------ 1304# Version 2.06e - 12th March 2002 ## DEVELOPER RELEASE ## 1305#------------------------------------------------------------------------ 1306 1307* Fixed a minor bug in t/tiedhash.t which was trying to use the XS stash 1308 even if it wasn't enabled. Thanks to Lyle Brooks for the patch. 1309 1310* Added the 'match' virtual method for matching a string against a 1311 regex and returning a reference to a list of (captured) (backrefs). 1312 1313* Changed html filter back into a fast and simple static filter. Added 1314 html_entity filter which uses Apache::Util or HTML::Entities to do 1315 a complete and thorough (but slower) job. The undocumented 'entity' 1316 option of the html filter is now removed (but may appear elsewhere). 1317 1318* Added the size virtual method for scalars to prove a consistent way 1319 of testing something.size to see if it has some value(s). For scalars 1320 it returns 1. 1321 1322* Modified the 'sort' and 'nsort' list virtual methods to allow a sort 1323 key passed to represent a method to be called on objects in the list 1324 as well as the key of a value to be fetched from hash references in 1325 the list. e.g. [% books.sort('author') %] allows 'books' to contain 1326 a list of hash refs with an 'author' key or objects with an 'author' 1327 method. Thanks to Tony Bowden for suggesting this improvement. 1328 1329* Applied a patch from Simon Wilcox to strip MS-DOS \r characters from 1330 end of lines read by the Datafile plugin. 1331 1332* Applied a patch from Ville Skyttä which fixes numerous minor bugs 1333 in various splash templates. 1334 1335* Added the 'defined' and 'exists' virtual hash methods for testing if 1336 a value has a defined value, or exists in the hash, respectively. 1337 1338* Applied a patch from Stathy Touloumis to make the XS Stash thread safe. 1339 1340* Added the 'grep' virtual list method. 1341 1342* Applied a patch from Mark Fowler to improve the XML XPath plugin's 1343 handling of nested elements. 1344 1345* Fixed handling of prefix support in template() and insert() methods 1346 of Template::Content. Any prefix is stripped from the name but passed 1347 as the second argument to the provider fetch() method. e.g. 1348 [% INCLUDE foo:bar %] calls the foo $provider->fetch('bar', 'foo') and 1349 [% INCLUDE http://tt2.org/t/templates/hello %] results in a call to 1350 $provider->fetch('//tt2.org/t/templates/hello', 'http') 1351 1352 1353#------------------------------------------------------------------------ 1354# Version 2.06d - 22nd January 2002 ## DEVELOPER RELEASE ## 1355#------------------------------------------------------------------------ 1356 1357* Applied a patch to the DBI plugin from Simon Matthews to stop it 1358 from closing a DBH which was passed in open from an external source. 1359 1360* Applied another patch from Simon to fix a bug with compiled templates 1361 which were never being loaded due to a '<' comparison of timestamps 1362 rather than '<='. See 1363 http://lists.tt2.org/pipermail/templates/2002-January/002361.html 1364 1365* Applied a patch from Doug Steinwand which fixes a minor bug in the 1366 XS Stash as reported by Andrey Brindeew: 1367 http://lists.tt2.org/pipermail/templates/2002-January/002475.html 1368 1369* Changed URL plugin to accept multiple values for CGI parameters, e.g. 1370 [% USE URL('/cgi-bin/foo', items=[10,20]) %] generates a URL like: 1371 /cgi-bin/foo?item=10&item=20 1372 1373* Applied a patch from David D. Kilzer to Makefile.PL to add -I flags 1374 to the various invocations of perl that we missed, and also to add 1375 a clean/FILES target for WriteMakefile(). See. 1376 http://lists.tt2.org/pipermail/templates/2002-January/002431.html 1377 1378* Fixed Makefile.PL to warn, not die, about mandatory modules, leaving 1379 it to the definitions in the PREREQ_PM which the CPAN module can 1380 understand. Thanks to Leon for waving the flag. 1381 1382* Applied Leon's doc patch to the Table plugin to demonstrate 1383 row/column transposition. 1384 1385* Added ucfirst and lcfirst filters to fold first character to upper 1386 or lower case respectively. Thanks to Paul Makepeace for the patch. 1387 1388* Fixed truncate method of String plugin to not append suffix if the 1389 string is already shorter than the required length. Thanks to 1390 Yann Kerhervé for the patch. 1391 1392 1393#------------------------------------------------------------------------ 1394# Version 2.06c - 20th December 2001 ## DEVELOPER RELEASE ## 1395#------------------------------------------------------------------------ 1396 1397* Changed both Perl and XS Stash modules to try to apply a SCALAR_OPS 1398 virtual method to a blessed object as a last-ditch chance if all else 1399 fails. Thanks to Tony Bowden for reporting the problem. See 1400 http://lists.tt2.org/pipermail/templates/2001-December/002263.html 1401 1402* Added tie() method to DBI plugin which interfaces to the Tie::DBI 1403 module, based on some plugin code sent to me courtesy of Dave 1404 Hodgkinson. Also made various minor cleanups to DBI code and updated 1405 documentation and tests. Incidentally, this tickled the missing 1406 feature in the XS stash which doesn't yet support tied hashes. 1407 1408* Applied a patch from Christian Schaffner which fixes a problem in 1409 the Makefile.PL for installation via the fink package manager under 1410 Mac OS X. 1411 1412* Fixed up some of the ugliness in the docsrc tools. 1413 1414 1415#------------------------------------------------------------------------ 1416# Version 2.06b - 2nd December 2001 ## DEVELOPER RELEASE ## 1417#------------------------------------------------------------------------ 1418 1419* Added the Template::Plugin::Filter module to make plugin filters 1420 easier to write and rewrote the Template::Plugin::XML::Style to use 1421 it. 1422 1423* Added the Template::Plugin::String module which provides a nice 1424 object oriented approach to string manipulation. 1425 1426* Added the '_' string concatenation operator. [% foo = bar _ baz %] 1427 1428* Applied Craig's suggested fixes to the parser to correct potential 1429 precendence problems and added tests to the test suite. See: 1430 http://lists.tt2.org/pipermail/templates/2001-November/002138.html 1431 1432* Applied Leon's patch to Template::Service to delete the 'template' 1433 entry added to the variable hash at the end of processing. 1434 1435* Fixed an obscured bug/oversight in Template::Plugins which tested 1436 generated plugin objects for truth rather than definedness to see if 1437 the plugin returned was valid. This can cause problems if your 1438 object has an overloaded stringification operator which gets called 1439 (but shouldn't) and could return an untrue (but correct) value. 1440 1441* Fixed t/dumper.t to only have one entry in each hash to avoid hash 1442 ordering problems. Thanks to Randal for reporting the problem. 1443 1444* Added the assert() subroutine to Template::Test. 1445 1446* Added some more content to the FAQ. 1447 1448 1449#------------------------------------------------------------------------ 1450# Version 2.06a - 19th November 2001 ## DEVELOPER RELEASE ## 1451#------------------------------------------------------------------------ 1452 1453* Added the XML::Style plugin for doing simple XML stylesheet like 1454 transformations and t/xmlstyle.t. 1455 1456* Fixed a bug in the DBI plugin where nested loops could cause the inner 1457 query to overwrite the _STH of the outer query causing the outer loop 1458 to end prematurely. Thanks to Dave Hodgkinson, Craig Barratt and Simon 1459 Matthews for working on the problem and solution. For more info, see 1460 http://lists.tt2.org/pipermail/templates/2001-November/002067.html 1461 1462* Applied a patch from Aleksey Nogin to Makefile.PL to call bin/gifsplash 1463 with the '-i' option. This fixes the problem reported by Kenny Flegal: 1464 http://www.tt2.org/pipermail/templates/2001-November/002028.html 1465 1466* Applied a patch from Stas Bekman to add 'align' to template/html/row. 1467 1468 1469#------------------------------------------------------------------------ 1470# Version 2.06 - 7th Nov 2001 1471#------------------------------------------------------------------------ 1472 1473* Fixed a bug in t/compile5.t which caused the following test warning on 1474 Win32: "Cannot chdir to D/blah/blah/Template-Toolkit-2.05c/t/test: No 1475 such file or directory at t\compile5.t line 73". Thanks to Chris 1476 Winters for finding the bug and testing the fix. 1477 1478 1479#------------------------------------------------------------------------ 1480# Version 2.05d - 6th Nov 2001 ## DEVELOPER RELEASE ## 1481#------------------------------------------------------------------------ 1482 1483* Fixed a bug in the parser which was missing a '^' anchor on the regex 1484 matching the TAGS directive, causing it to match anywhere. Thanks to 1485 Dominic Mitchell and Adrian Howard for reporting and fixing the problem. 1486 See http://lists.tt2.org/pipermail/templates/2001-October/001760.html 1487 1488* Modified Template::Parser to correctly handle "\t" and "\r" in double 1489 quoted strings as well as "\n". Added test to t/parser.t 1490 1491* Applied a patch from Stas Bekman to add 'valign' as an option to the 1492 html/cell template. 1493 1494* Applied a patch from Harald Joerg to document the 3rd $default 1495 option to Template::Stash::set(). 1496 1497* Fixed a problem in the docsrc build whereby double quote strings 1498 were causing embedded variables to be incorrectly interpolated, e.g. 1499 [% INCLUDE xyz title="set($var, $val, $default)" %] is now 1500 [% INCLUDE xyz title='set($var, $val, $default)' %]. Thanks to 1501 Harald Joerg for reporting the problem. 1502 1503 1504#------------------------------------------------------------------------ 1505# Version 2.05c - 22 Oct 2001 ## DEVELOPER RELEASE ## 1506#------------------------------------------------------------------------ 1507 1508* Applied a patch from Tony Payne which fixes a bug where templates were 1509 being mangled under mod_perl due to a missing O_TRUNC on a sysopen(). 1510 See http://www.tt2.org/pipermail/templates/2001-October/001834.html 1511 1512* Fixed the mess I made of Pudge's XS Stash patch applied in 2.05b. 1513 1514* Updated the INSTALL/README guides to note the PPM installation for 1515 Win32 users. 1516 1517 1518#------------------------------------------------------------------------ 1519# Version 2.05b - 21 Sep 2001 ## DEVELOPER RELEASE ## 1520#------------------------------------------------------------------------ 1521 1522* Applied a patch from Chris Nandor to bring the XS stash in line with 1523 the regular Perl stash wrt accepting defined but empty keys. See 1524 http://www.tt2.org/pipermail/templates/2001-September/001695.html 1525 1526* Applied a patch to Template::Provider from Craig Barratt to fix 1527 a bug when caching is turned off (CACHE_SIZE = 0). See 1528 http://www.tt2.org/pipermail/templates/2001-September/001682.html 1529 1530* Moved installation out of README into a separate INSTALL file and 1531 added the HACKING document as a pointer to the internals docs. 1532 1533* Added the 'uri' filter for URI escaping text. 1534 1535 1536#------------------------------------------------------------------------ 1537# Version 2.05a - 12 Sep 2001 ## DEVELOPER RELEASE ## 1538#------------------------------------------------------------------------ 1539 1540* Applied a patch from Chris Nandor to use 'MSWin32' as a specific O/S 1541 detection rather than /win/i which gives a false positive for 'Darwin'. 1542 Needless to say, that's something of an insult to Darwin :-). Also 1543 fixes Template::Provider to use File::Spec::file_name_is_absolute() to 1544 test for absolute paths instead of the previous kludge. 1545 1546* Updated Template::Manual::Internals to include information about 1547 how to prepare patches and other useful information for potential 1548 TT hackers. 1549 1550* Added some code to the XS Stash to handle trivial access to tied 1551 hashes. Regular set/get/default should work as expected, but at 1552 present intermediate hashes are not auto-vivified on assignment, 1553 e.g. [% these.dont.get.created.in.XS.but.do.in.the.perl.stash = 10 %] 1554 1555 1556#------------------------------------------------------------------------ 1557# Version 2.05 - 11 Sep 2001 1558#------------------------------------------------------------------------ 1559 1560* Bumped version number and updated documentation for release. 1561 1562 1563#------------------------------------------------------------------------ 1564# Version 2.04f - 10 Sep 2001 ## DEVELOPER RELEASE ## 1565#------------------------------------------------------------------------ 1566 1567* Fixed a bug in the Date plugin which was performing one localtime() too 1568 many when a date was passed in to the format() method. e.g. the result 1569 from date.format('12:59::00 30/09/2001', '%H:%M') was 13:59 not 12:59. 1570 Thanks to Thierry-Michel Barral and Matthew Tuck for reporting the 1571 problem. 1572 1573* Incorporated Doug's new version of the XS Stash. It fixes the problem 1574 with strings not being recognized as integers (and the item = item + 1 1575 problem). It also adds a few additional tests for this situation to 1576 t/stash-xs.t 1577 1578* Fixed a minor bug in Makefile.PL which looked for 'msql' or 'mysql' as 1579 the default DBD for testing DBI but didn't select a suitable default 1580 if the above drivers weren't available. 1581 1582 1583#------------------------------------------------------------------------ 1584# Version 2.04e - 06 Sep 2001 ## DEVELOPER RELEASE ## 1585#------------------------------------------------------------------------ 1586 1587* Fixed bug in 'list' entry in $HASH_OPS in both Template/Stash.pm and 1588 Template/Stash/Context.pm to return '%$hash' instead of 'values %$hash'. 1589 Thanks to Craig Barrett for reporting the problem. 1590 1591* Applied a patch from Craig to Stash.pm and Stash/Context.pm to 1592 accept negative integers as array indices, counting back from the 1593 end of the list as in Perl. This brings it into line with the new 1594 XS Stash. 1595 http://www.tt2.org/pipermail/templates/2001-August/001493.html 1596 1597* And another patch from Craig to allow $var and ${var} to be used as 1598 keys in hashes. 1599 http://www.tt2.org/pipermail/templates/2001-August/001410.html 1600 1601* Modified Template::Plugins fetch() method to accept $factory as a 1602 code reference. Then changed _load() to return a closure for 1603 regular Perl modules loaded (via LOAD_PERL option) which, which 1604 called by fetch(), removes the first argument, the $context 1605 reference, which the non-plugin module won't be expecting. This 1606 fixes the problem reported (and also fixed but in a slightly 1607 different way) by Lyle Brooks, here in these messages: 1608 http://www.tt2.org/pipermail/templates/2001-August/001397.html 1609 http://www.tt2.org/pipermail/templates/2001-August/001406.html 1610 1611* Removed the eq, ne, gt, lt, ge and ne operators added in 2.04d. Given 1612 that they can (and did) break code that had existing variables with 1613 those names, I decided it was best to strip them out again and think 1614 more carefully about adding them to an official release. Hence they're 1615 not going to be in 2.05. 1616 1617* Fixed an outrageous oversight in the HTML 'rgb' template by defining 1618 'orange' as a valid colour (I can't believe Leon hasn't already sent 1619 me a patch for this!) Created a new custom colour scheme in the 1620 Makefile.PL which uses it. Hacked the Makefile.PL and the generated 1621 ttree config file to allow text colours to be specified as well as 1622 button background colours. 1623 1624 1625#------------------------------------------------------------------------ 1626# Version 2.04d - 29 Aug 2001 ## DEVELOPER RELEASE ## 1627#------------------------------------------------------------------------ 1628 1629* Incorporated Doug Steinwand's XS Stash. This adds the files in the 1630 'xs' directory, t/stash-xs.t, bin/tt-bench.pl and includes some work 1631 on the Makefile.PL to incorporate the required prompting, etc. 1632 1633* Added gt, ge, lt and le as comparison operators which map directly 1634 to their Perl counterparts. Added tests to t/stash.t and relevant 1635 documentation to the IF directive. 1636 1637* Applied some patches from Leon and Doug to enhance the coverage of 1638 the test suite. 1639 1640* Added 'sorted' as a flag to the HTML plugin to return attributes in 1641 sorted order. Mainly for debugging purposes, as used in t/html.t. 1642 1643* Fixed Template::Parser.pm to recognise "\r" as a valid escape sequence 1644 in double quoted strings. 1645 1646 1647#------------------------------------------------------------------------ 1648# Version 2.04c - 04 Aug 2001 ## DEVELOPER RELEASE ## 1649#------------------------------------------------------------------------ 1650 1651* Fixed t/dbi.t and t/latex*.t to not complain about "Test header seen 1652 twice". Thanks to Leon. 1653 1654 1655#------------------------------------------------------------------------ 1656# Version 2.04b - 04 Aug 2001 ## DEVELOPER RELEASE ## 1657#------------------------------------------------------------------------ 1658 1659* Fixed a bug in the Makefile.PL which prevented the correct targets 1660 from being added to the generated Makefile to install additional 1661 components, build HTML docs, etc. 1662 1663* Applied a patch from Chris Nandor to fix a bug introduced by the taint 1664 checks in 2.04 which barfed on ';' in filenames. Also changes open() 1665 to sysopen() in Template::Document for additional security. See 1666 http://www.tt2.org/pipermail/templates/2001-August/001348.html 1667 1668* Another part of the same pudge patch adds FACTORY as a default value 1669 to Template::Parser to allow Template::Directive factory class to 1670 be replaced. 1671 1672 1673#------------------------------------------------------------------------ 1674# Version 2.04a - 5th July 2001 ## DEVELOPER RELEASE ## 1675#------------------------------------------------------------------------ 1676 1677* Changed GD plugin and tests to require GD version 1.20. See 1678 http://www.tt2.org/pipermail/templates/2001-July/001212.html 1679 1680* Applied Craig's fix for the DBI plugin to correctly destroy a 1681 statement handle to ensure that finish() gets called on it even if the 1682 iterator doesn't complete. See: 1683 http://www.tt2.org/pipermail/templates/2001-July/001216.html 1684 1685* Further to Craig's points in the above post, I added get_all() and 1686 get() to the DBI iterator so that you can now do this: 1687 1688 [% people = DBI.query(...) %] 1689 [% person = people.get %] # first person 1690 [% person = people.get %] # second person 1691 [% FOREACH person = people.get_all %] 1692 # third to nth person(s) 1693 [% END %] 1694 1695* Fixed Template::Provider which wasn't saving compiled templates to 1696 disk when specified with an absolute path, as reported by Merlyn. See 1697 http://www.template-toolkit.org/pipermail/templates/2001-July/001213.html 1698 1699* Updated Makefile.PL to accept various command line args including 1700 TT_ACCEPT to automatically accept all default values and TT_QUIET to 1701 shut the file up with all those yackety yack, yack messages. 1702 1703 1704#------------------------------------------------------------------------ 1705# Version 2.04 - 29th June 2001 1706#------------------------------------------------------------------------ 1707 1708* Applied a patch from Craig Barratt to both the regular 1709 Template::Stash and the alternate Template::Stash::Context which 1710 allows array indexes into hashes and arrays (slices) in the same 1711 manner as Perl. For example: 1712 1713 [% keys = [ 'foo', 'bar' ] 1714 vals = hash.$keys # [ hash.foo, hash.bar ] 1715 1716 keys = [ 2, 3, 7 ] 1717 vals = list.$keys # [ list.2, list.3, list.7 ] 1718 %] 1719 1720* Applied another patch from Craig to Parser.pm which fixes a bug 1721 relating to text strings being interpolated in a numerical context. 1722 See: http://www.tt2.org/pipermail/templates/2001-April/000901.html 1723 1724* Applied yet another patch from Craig ("Man of the Patch" for v2.04 :-), 1725 to fix a problem with NEXT not working inside switch: 1726 1727 FOREACH and WHILE now get a LOOP: label, and NEXT and LAST now 1728 generate "next LOOP;" and "last LOOP;". However, the original 1729 code allows naked "NEXT" or "LAST" (which behave like STOP). I 1730 didn't want to change this behavior, so NEXT and LAST only get the 1731 LOOP label inside loops (except in the top-level atomexpr FOREACH 1732 and atomexpr WHILE cases, which should be ok). 1733 1734* Does he ever sleep! :-) Another patch from Craig to improve upon 1735 the ref->template mapping feature in Template::View. Documentation 1736 pending. For further details, see 1737 http://www.tt2.org/pipermail/templates/2001-June/001161.html 1738 1739* Applied a patch from Mark Fowler, which fixes the problem with 1740 search/replace virtual methods incorrectly returning with a search 1741 pattern of '0'. e.g. [% bob = '0'; bob.replace('0', 'zero') %] 1742 now returns 'zero' instead of ''. 1743 1744* Applied a patch from Doug Steinwand to prevent the Stash from 1745 raising undef error reporting 'Can't locate object methof "bar" via 1746 package "Foo"' unless $DEBUG is enabled. 1747 1748* Applied a patch to the DBI plugin from Rafael Kitover which calls 1749 the DBI connect_cached() method instead of connect() to allow 1750 connection caching in a persistent server environment (e.g. Apache 1751 mod_perl). 1752 1753* Changed html filter to be a dynamic filter factory, allowing the 1754 'entity' option to be set to prevent entities of the form 1755 '&word;' being converted to '&word;' 1756 1757 [% FILTER html(entity = 1) %] 1758 < & > # < & > 1759 [% END %] 1760 1761* Changed Template::Stash to propogate any object errors that 1762 are references (e.g. Template::Exception objects or otherwise) 1763 or string that don't look like "Can't locate object method ...". 1764 1765* Fixed various typos in docsrc/xml/ttdocsrc with a deft: 1766 s/Plugin::GD::Graphs/Plugin::GD::Graph/g; 1767 1768* Applied a patch from Leon Brocard to remove a suspect test from 1769 t/filter.t which Chris Nandor reported as causing problems. 1770 1771* Added Craig's comments on replace backreferences and TT grammar to 1772 TODO list. 1773 1774* Applied various patches from Leon: to remove redundant "print 1..0" 1775 in various t/*.t files; to add '1;' to end of '.defaults.cfg' file; 1776 and to fix t/vmeth.t and t/leak.t to run correctly under latest 1777 bleadperl. 1778 1779* Applied a patch from Jonas Liljegren to fix problems with errors 1780 being raised in -T taint mode. 1781 1782* Fixed another problem identified by Jonas so that filters are no 1783 longer cached. See: 1784 http://www.tt2.org/pipermail/templates/2001-June/001192.html 1785 1786 1787#------------------------------------------------------------------------ 1788# Version 2.03 - 15th June 2001 1789#------------------------------------------------------------------------ 1790 1791* Added new virtual methods 'item', 'list', 'hash' to each of scalar, 1792 list and hash ops to Do The Right Thing to convert the original value 1793 to what the caller wants. This is based on a patch supplied by Craig 1794 Barratt... 1795 1796* ...which implements a number of new features to the stash, most 1797 notably the ability to specify the context in which you want an 1798 object method or subroutine to be called in by appending '.list' or 1799 '.scalar' to a dotted variable. e.g. [% cgi.param('foo').scalar %]. 1800 I haven't folded this patch into the core Stash yet (other than 1801 adopting the virtual methods described above) but it's provided as 1802 an alternate stash implementation, Template::Stash::Context, which 1803 you can create and specify to your Template object via the STASH 1804 configuration option. I'd like to a) benchmark it and b) give 1805 people the option of trying it out (and hacking on it?) before 1806 integrating the new features into the default stash. 1807 1808* Applied a patch to add the Latex filter and GD plugin functionality, 1809 thanks to the excellent work of Craig Barratt and Richard Tietjen. 1810 In Craig's words: 1811 1812 Here is a new version of my Latex filter and GD plugin code. 1813 (This adds a latex filter that supports PDF, PS and DVI output, 1814 plus 16 or so plugins for the GD::* modules, allowing PNG, GIF 1815 output.) 1816 1817 [Includes] Richard Tietjen's changes for the latex filter for WinXX 1818 [which] didn't make it into the May 20th version. The new version 1819 includes the correct changes for WinXX and also now has been 1820 tested against TexLive and MikTeX on WinXX. 1821 1822 Craig's patch also included full documentation so you can read all about 1823 it in the Manual and Module pages. In addition, the Makefile.PL now 1824 searches for GD modules and external Latex programs and does some extra 1825 user prompting for confirmation of Latex installation/configuration. 1826 Not only that, but Craig also managed to roll in a couple of other 1827 minor bug fixes and documention updates. Nice work! 1828 1829* Fixed the parser to accept fully dotted up variable assignments in 1830 argument lists, e.g. in INCLUDE, etc. You can now do this: 1831 1832 [% INCLUDE html/head 1833 html.head.title = 'My Title' 1834 %] 1835 1836 Note however that the assignment to such variables is always "global", 1837 even though INCLUDE claims to localise the stash. Remember that the 1838 localisation does not perform a deep copy so the localised copy of 1839 the 'html' variable might just be a copy of the reference to a previously 1840 defined hash array. Thus, you modify the original albeit via a copy 1841 of the reference to it. See INCLUDE section of 1842 Template::Manual::Directives for further details. 1843 1844* Added 'base' option to Template::View. This allows one view to inherit 1845 from another "base class" view. If a template isn't defined in a 1846 derived view then it automatically asks its base view for it, and so 1847 on up the inheritance tree. 1848 1849 [% VIEW myview.default 1850 prefix = 'view/default/'; 1851 END 1852 %] 1853 [% VIEW myview.fancy 1854 base = myview.default 1855 prefix = 'view/fancy/'; 1856 END 1857 %] 1858 1859 In this example, [% myview.fancy.header %] will be resolved as 1860 [% INCLUDE view/fancy/header %] or [% INCLUDE view/default/header %] 1861 if 'view/fancy/header' doesn't exist. Variables are also inherited. 1862 1863* Added the 'sealed' and 'silent' parameters to VIEW to allow view to be 1864 optionally unsealed (allow external variable updates/creation) and 1865 to silence warnings about attempts to update sealed variables, 1866 respectively. See the Template::Manual::Views page for more info on 1867 this and previosu item. 1868 1869* Added the HTML plugin for generating (very basic) HTML elements. 1870 See the Template::Plugin::HTML documentation. 1871 1872* Added the present() and content() methods to XML::DOM::Node in the 1873 XML::DOM plugin to make them work harmoniously with VIEWs. See the 1874 Template::Plugin::XML::DOM documentation for further details. 1875 1876* Did the same for Template::Plugin::XML::XPath, adding present($view) 1877 and content($view) methods to XML::XPath::Node::Element and a 1878 present($view) method to XML::XPath::Node::Text. See the 1879 Template::Plugin::XML::DOM documentation for more details. 1880 1881* Added the calc() method to the Date plugin to return an interface to 1882 the Date::Calc module. e.g. 1883 1884 [% USE Date; calc = Date.calc %] 1885 [% calc.Monday_of_Week(22, 2001).join('/') %] 1886 1887* Moved Template::Tutorial to Template::Tutorial::Web and added the 1888 tutorial kindly donated by Dave Cross on generating and using data 1889 files with TT as Template::Tutorial::Datafile. Template::Tutorial 1890 is now an index to the tutorials. 1891 1892* Changed the bin/tt2inst script to no longer use the 'no_chdir' option 1893 of the File::Find module which isn't supported in earlier version such 1894 as distributed with pre-5.6.0 Perl. Thanks to a patch from Vivek 1895 Khera <khera@kcilink.com>. Changed Makefile.PL to accept File::Spec 1896 version 0.6 or later. 1897 1898* Fixed a bug in the FOREACH directive which would barf with the error 1899 "undef error - loop is undefined" when DEBUG was enabled. 1900 1901* Applied a patch from Eric Cholet to fix a bug in META data items not 1902 correctly escaping ' and \ characters. 1903 1904* Applied another patch from Eric to fix "Use of uninitialised value" 1905 warning when using a subclassed parser. 1906 1907* Applied a patch to ttree from Leon Brocard print full path for ignored 1908 files. 1909 1910* Fixed typo in the ttree help page which incorrectly listed debug 1911 mode as '-d' (now '-dbg' as well as '--debug') 1912 1913* Fixed (hopefully once and for all!) the problem with choming the 1914 final newline in a template. The last newline is now chomped just 1915 like any other, depending on the POST_CHOMP flag and/or trailing '-' 1916 in the directive. e.g. 1917 1918 [% FILTER latex('ps') %] 1919 ... 1920 [% END -%] 1921 1922 If you explicitly want a newline then make sure one is added to the 1923 end of the template and don't enable POST_CHOMP or add a trailing '+' 1924 in the directive, e.g. 1925 1926 [% INCLUDE footer +%] 1927 1928* Made a number of fixes to the HTML generated by the Splash! and HTML 1929 libraries to make it conformant with HTML 3.2 specificiation. Added 1930 DOCTYPE to html/header, ALT tags, ... added html/head, html/body and 1931 html/html to do more thorough job using nested variables. Also added 1932 html/config to load HTML plugin. Full conformance is still an issue, 1933 but we're working on it... 1934 1935 1936#------------------------------------------------------------------------ 1937# Version 2.02 - 6th April 2001 1938#------------------------------------------------------------------------ 1939 1940* Updated various components of the Splash! library, cleaned up some 1941 ugliness (a little) and revised the examples. Documentation in 1942 Template::Library::Splash is now hopelessly out of date but examples 1943 are more comprehensive. Makefile.PL now prompts user to select a 1944 colour scheme for creating the documentation and examples. 1945 1946* Fixed problems with Splash! images displaying the "wrong" colour on 1947 certain systems. It appears to be the case that this was automatic 1948 gamma correction at work, an otherwise very cool feature of PNG 1949 files. Alas it broke things here so we've switched to GIF files. 1950 Also made an improvement to the way of generating and using the 1951 images. By using simple transparency and doing away with the 1952 anti-aliasing it's possible to support any foreground colour for a 1953 set of images in a background colour. One set of black images are 1954 now distributed with TT. These are blown into many colours during 1955 installation, implemented by the bin/gifsplash script and defined 1956 as the 'tt2_splash' Makefile target, run automatically as part of 1957 'make install'. 1958 1959* Changed redirect filter factory and the underlying Template::_output 1960 method to accept a 'binmode' flag. The bin/gifsplash script sets 1961 this flag to ensure that the GIFs generated for Splash! are valid on 1962 Win32 platforms (it's a good job SAM knows what binmode is for... :-) 1963 1964* Applied a patch from Leon Brocard to add 'recurse' and 'verbose' 1965 options to the ttree.cfg files generated by Makefile.PL. Their 1966 absence was preventing the docs and examples from being built 1967 (unless, like the stupid author, you already had a default 1968 ~/.ttreerc which included these flags :-). 1969 1970* Fixed Makefile.PL to check for File::Spec 0.82, thanks to the efforts 1971 of Doug Steinwand and Leon who found and fixed the problem with 1972 'splitdir' otherwise not being available. Later changed requirement 1973 from 0.82 to 0.80 because this is the version currently distributed 1974 with ActivePerl 5.6.0 and it appears to work just fine (saves those 1975 poor Win32 users from having to install any more modules than 1976 absolutely necessary) 1977 1978* Removed test for platform specific error messages from t/xpath.t 1979 Removed warning from README that this test would fail. Thanks 1980 again to Leon for the patch and to <umun@yahoo.com> (no name 1981 given) for reporting the problem. 1982 1983* Applied another patch from Leon to fix Template::Base.pm to avoid 1984 "Use of uninitialized value..." warnings. 1985 1986* Applied yet more patches from Leon to add "use Template::Plugin" or 1987 something similar to the File, Directory and View plugins. 'use 1988 base' doesn't work as advertised (e.g. in ensuring the module is 1989 loaded) in older versions of Perl. 1990 1991* Fixed t/leak.t to only run one particular test if Perl version is 1992 5.6.0 or greater. Test fails on earlier versions due to destructors 1993 being called in a different order. 1994 1995* Updated Makefile.PL to supply a more typical default installation 1996 directory for Win32 systems - C:/Program File/Template Toolkit 2/. 1997 This brought to light numerous bugs (following) which were fixed 1998 with the invaluable help of Simon Matthews and Theakston's Black 1999 Sheep Ale... :-) 2000 2001* Pathnames generated in the Makefile.PL for the Makefile are now all 2002 "double quoted" to protect embedded whitespace, e.g. when building 2003 docs: ttree -f "C:/Program Files/...") 2004 2005* Patched Template/Provider.pm in several places to strip out any 2006 extra ':' characters put in the wrong place of a path. For example, 2007 when writing compiled template "C:/foo" to disk with a COMPILE_DIR 2008 of "C:/bar", the resulting file is now "C:/bar/C/foo" instead of 2009 the erroneous "C:/bar/C:/foo". 2010 2011* On Win32 systems, provider prefixes must be more than 1 character in 2012 length. This is a compromise for cases where you might want to do 2013 something like: [% INCLUDE C:/foo/bar %]. Remains unchanged on 2014 other platforms. 2015 2016* On Win32 systems the DELIMITER now defaults to a slight variation of 2017 ':' if not otherwise set. It now uses /:(?!\/)/ to split on ':' 2018 where not followed by '/'. This makes things like INCLUDE_PATH => 2019 'C:/here:C:/there' work properly, although setting a more suitable 2020 DELIMITER for Win32 systems (e.g. ';') is still recommended (we tried 2021 automatically setting it to ';' on Win32, but that caused more problems 2022 than it was worth). 2023 2024* Changed Template::Provider to consider a file starting (\w:)?/ as an 2025 ABSOLUTE path when running on Win32 (e.g. C:/foo). On other 2026 platforms, it remains unchanged, looking only for a leading '/'. 2027 Also changed ttree to do the same, so that 'ttree -f C:/test.cfg' 2028 is treated as an absolute path and it doesn't try and prefix it 2029 with the ttree configuration file directory. Note that ttree 2030 does this regardless of OS. 2031 2032* Fixed stringification problem identified by SAM. Objects that have 2033 auto-stringification sometimes didn't get properly stringified at the 2034 right time. e.g. [% a = "$an_obj" %]. 2035 2036* Fixed File and Directory plugins to gracefully ignore Perl dying with 2037 "getpwuid() not supported on this platform" errors on Win32. The 2038 'uid' and 'user' attributes of File and Directory plugin objects 2039 are left undefined. 2040 2041* Then, hacked t/file.t and t/directry.t test to not be run under 2042 Win32. There are a couple of outstanding minor problems with these 2043 test scripts caused by differences in '/' and '\' as path 2044 separators. Need to fix these at some point. 2045 2046* Makefile.PL now saves configuration options in '.defaults.cfg' 2047 file, using these values as defaults when run again. 2048 2049* Removed duplicated $VERSION from DBI and XML::DOM plugins, thanks 2050 to Jonathan Leffler. 2051 2052* Updated documentation to reflect new changes. 2053 2054 2055#------------------------------------------------------------------------ 2056# Version 2.01 - 30th March 2001 2057#------------------------------------------------------------------------ 2058 2059* Added the various template libraries in the 'templates' directory. 2060 The 'html' library implements some generally useful HTML elements. 2061 The 'pod/html' libraray contains some templates for converting POD to 2062 HTML, used in building the TT2 HTML documentation, for example. The 2063 'ps' library contains templates defining a few useful marks and other 2064 procedures for generating PostScript pages. The 'splash' directory 2065 contains templates for the "Splash!" library which implements a 2066 widget set for building stylish HTML user interfaces. 2067 2068* Added a host of example pages in the 'examples' directory which 2069 demonstrate use of the above libraries. 2070 2071* Added an 'images' directory to contain the small images used to build 2072 up the Splash! interface components. 2073 2074* Added the 'docs' directory containing templates and library elements 2075 for building the TT2 documentation as HTML pages. 2076 2077* Updated Makefile.PL to now offer to install optional libraries, 2078 images, build HTML docs, examples, etc. Adds 'tt2_install', 2079 'tt2_html_docs' and 'tt2_examples' as Makefile targets if requested. 2080 These then get run as part of "make install". 2081 2082* Totally re-organised the documentation, splitting the long user manual 2083 into separate Template::Manual::* pages, adding the Template::FAQ, 2084 Template::Internals, and various other changes. All POD and HTML 2085 documentation is built from the same sources in the form of another 2086 set of templates, POD files, XML files, scripts, etc., distributed 2087 separately as the 'docsrc' bundle, and available from the web site. 2088 The POD documentation now gets glued onto the end of the .pm 2089 modules and only creates separate .pod files for those manual pages 2090 that don't have equivalent modules (e.g. Template::FAQ, etc.) 2091 NOTE: this might mean that existing .pod files from earlier versions 2092 of TT might mask documentation in newer .pm files... 2093 2094* Added the Template::View module, the VIEW directive and the View 2095 plugin which can be used collectively to create dynamic views. This 2096 is a very powerful tool which fulfills a number of requirements and 2097 makes possible a number of things that have previously been messy, 2098 difficult or not possible. Views are primarily collections of 2099 templates. You can define BLOCKs within a view and they remain 2100 local to it, but can be called from outside the view. This is still 2101 very experimental. Things are likely to change. See 2102 Template::Views for (incomplete) documentation and take a look at 2103 t/view.t for examples. 2104 2105 [% VIEW fancy_html 2106 prefix = 'splash/' # template prefix/suffix 2107 suffix = '.tt2' 2108 bgcol = '#ffffff' # and any other variables you 2109 style = 'Fancy HTML' # care to define as view metadata, 2110 items = [ foo, bar.baz ] # including complex data and 2111 foo = bar ? baz : x.y.z # expressions 2112 %] 2113 2114 [% BLOCK header %] # define "private" view blocks 2115 Title: [% title %] 2116 [% END %] 2117 2118 [% END %] # end of VIEW definition 2119 2120 [% v = fancy_html %] # view is a regular object ref, re- 2121 [% mycode(v) %] # assign it, pass it around, etc. 2122 2123 [% v.title %] # access view metadata 2124 2125 [% v.header(title = 'Foo!') %] # view "methods" process blocks or 2126 [% v.footer %] # templates with prefix/suffix added 2127 # => [% INCLUDE splash/footer.tt2 %] 2128 2129* Added the facility to specify multiple templates within a PROCESS, 2130 INCLUDE, INSERT or WRAPPER directive. For all but WRAPPER, the 2131 templates are processed in the order specified. 2132 2133 [% PROCESS config + header + menu %] 2134 [% INCLUDE section/break + html/titlebar 2135 title='A New Section' 2136 %] 2137 [% WRAPPER edge + box + titlebar %] 2138 ... 2139 [% END %] 2140 2141 Multiple WRAPPER templates get processed in reverse order to create 2142 the correct nesting effect. In the example above, the enclosed block 2143 is processed and passed to 'titlebar' which wraps it and passes the 2144 output to 'header' which wraps it and passes the output to 'box', which 2145 wraps it and passes the output to 'edge' which wraps it and returns the 2146 output. Thus the specification order is outermost to innermost, but 2147 they are actually processed from the inside out. 2148 2149* Templates specified to INCLUDE, PROCESS, WRAPPER and INSERT can now 2150 be given a prefix (delimited by ':', as in "file:blahblah.txt" or 2151 "http://www.tt2.org/index.html", for example) which maps them to a 2152 particular template provider or providers. A PREFIX_MAP 2153 configuration option can be specified as a hash array mapping prefix 2154 names to a reference to a list of providers. For convenience, you 2155 can also specify the argument as a string of integers, delimited by 2156 any non-numerical sequence, to indicate indices into the LOAD_TEMPLATES 2157 provider list. e.g. 2158 2159 my $template = Template->new({ 2160 LOAD_TEMPLATES => [ $foo, $bar, $baz, $wiz ], 2161 PREFIX_MAP => { 2162 src => '0, 2', # $foo and $baz 2163 lib => '1, 2', # $bar and $baz 2164 all => '0, 1, 2', # $foo, $bar and $baz 2165 } 2166 }); 2167 2168 Thus [% INCLUDE src:hello.tt2 %] indicates the 'hello.tt2' template 2169 to be provided by $foo or $baz, [% INCLUDE lib:hello.tt2 %] is mapped 2170 to $bar and $baz, [% INCLUDE all:hello.tt2 %] can be provided by 2171 $foo, $bar or $baz, and the default [% INCLUDE hello.tt2 %] is 2172 mapped to the entire LOAD_TEMPLATES list: $foo, $bar, $baz and $wiz. 2173 This is initially useful for things like ttree which would like a way 2174 to differentiate between templates in one place and templates in 2175 another. It can also be used, of course, to provider special providers 2176 for certain file type, as in http://fetch.some.file.com/blah/blah/... 2177 2178* Fixed the parser to accept expressions on the right hand side of 2179 parameter definitions for INCLUDE, etc. e.g. 2180 2181 [% INCLUDE header 2182 title = my_title or your_title or default_title 2183 bgcol = (style == 'dark' ? '#000000' : '#ffffff') 2184 %] 2185 2186* Added the PLUGIN_FACTORY configuration option to Template::Plugins 2187 to allow class names or object prototypes to be specified for plugins. 2188 No module loading is attempted, unlike the existing PLUGINS which 2189 assumes entries are module names which it tries to load. This may 2190 change in a future release (ideally by integration with PLUGINS) so 2191 it remains undocumented for now. 2192 2193 package My::Plugin; 2194 ... 2195 2196 package main; 2197 2198 my $tt = Template->new({ 2199 PLUGIN_FACTORY => { 2200 plugin1 => 'My::Plugin', # class name 2201 plugin2 => My::Plugin->new(), # prototype obj 2202 }, 2203 }); 2204 2205* Added the File and Directory plugins which blossomed from the 2206 Directory plugin written by Michael Stevens and posted to the 2207 mailing list. These give you access to files and directories on 2208 your filesystem and also allow you to create representations of 2209 abstract files/dirs. 2210 2211 WARNING: recognise that this gives the author of any templates you 2212 run access to information about your filesystem. We assume that the 2213 author of your templates is you or someone you trust to have access 2214 to that kind of information. If you're running "untrusted" 2215 templates (we assume you know what you're doing) then you'll very 2216 probably want to disable these plugins. Alas there is no easy way 2217 to disable plugins at the moment other than deleting them or writing 2218 null or error throwing plugins to mask them. Making this easier is 2219 a TODO. 2220 2221* Added the Pod plugin which uses the Pod::POM module to parse a Pod 2222 file or text string and build an object model. You can then walk 2223 it and present it in different ways using templates. Great for 2224 building HTML documentation from Pod and unsurprisingly used to 2225 build the new TT2 docs. 2226 2227* Applied a patch from Chris Nandor to add a new feature to the 2228 PRE_CHOMP and POST_CHOMP options. When set to 1, they continue to 2229 act as before. When set to 2, all whitespace is collapsed into a 2230 single space. CHOMP_NONE, CHOMP_ALL and CHOMP_COLLAPSE are 2231 defined in Template::Constants and can be imported as the :chomp 2232 tagset, for those who want them. 2233 2234* Applied a patch from Doug Steinwand to fix a problem in 2235 Template::Provider which would server stale templates if the 2236 modification time of the files went backwards. In addition, it now 2237 uses the $Template::Provider::STAT_TTL (time to live) variable 2238 (default: 1) to determine how often to stat the files to check for 2239 changes. TT2 now supports time running backwards! :-) 2240 2241* Applied a patch from Vivek Khera which fixes a memory leak in the 2242 MACRO directive, prevalent when using TT under mod_perl. Also added 2243 t/leak.t to test that memory is properly freed and circular references 2244 broken by the delocalisation of the stash. All seems to work as expected 2245 including plugins that contain context references, MACRO definitions, 2246 and so on (but note that this is the test suite run from the command 2247 line, and doesn't explicitly test under mod_perl...) 2248 2249* Applied a patch from Axel Gerstmair to fix a bug in PERL blocks 2250 and filters which caused references to the context and stash to be 2251 kept in global package variables. This meant they stayed alive for 2252 far too long. Added a couple of tests to t/leak.t to check this now 2253 works OK. 2254 2255* Fixed a bug in the parser triggered by [% CATCH DEFAULT %]. Thanks 2256 to Vivek Khera for reporting the problem. This also fixes a problem 2257 reported by Thierry-Michel Barral which was causing bare 'CATCH' 2258 blocks to not catch errors and instead pollute STDERR. 2259 2260* Fixed another bug in the parser preventing double quoted META attributes 2261 from containing single quotes, e.g. [% META title="C'est un test" %]. 2262 Thanks to Philippe Bruhat for reporting the problem. 2263 2264* Added the 'indent' filter to indent a block by prefixing each line with 2265 a specified string, or a number of spaces when the argument is numerical. 2266 2267* Added the 'trim' filter to remove leading/trailing whitespace and 2268 'collapse' filter to additionally collapse multiple whitespace characters 2269 to a single space. 2270 2271* Added escapes for ' (') and " (") to the html filter, thanks 2272 to Lyle Brooks and Vivek Khera. Then, having done that, I removed 2273 the ' escape because my browser didn't recognise ' as a 2274 valid entity. What's going on here? Need to check the HTML spec... 2275 2276* Added tag style 'star' of the form [* ... *] 2277 2278* Changed the Template::Stash get() and set() methods to accept a 2279 compound variables as a single parameter and automatically convert 2280 it to an array. Note that it doesn't correctly handle arguments 2281 to dotted elements (e.g. foo(10).bar(20), but does mean that you can 2282 now write $stash->get('foo.bar.baz') instead of the more laborious 2283 $stash->get(['foo', 0, 'bar', 0, 'baz', 0]). 2284 2285* Fixed a bug in Template::Stash which was raising an error when an 2286 element on the left hand side of a '.' evaluated to a defined, but 2287 empty value. 2288 2289* Fixed an obscure bug in Template::Stash which occurred when calling 2290 a scalar method on a value which contained a valid and visible object 2291 package name. e.g. [% name = 'Foo::Bar'; name.baz() %] called 2292 Foo::Bar->baz(). 2293 2294* Fixed a bug in the Template::Stash 'replace' virtual method which 2295 returned the original string when the replace string was specified 2296 empty. [% var = 'foo99'; var.replace('foo', '') %] now correctly 2297 returns '99' instead of the original string 'foo99'. Thanks to 2298 Tryggve Johannesson and Jeremy Wadsack for reporting the problem. 2299 2300* Added magical handling of the 'import' variable to stash clone() and 2301 update methods. This implements the V1 functionality whereby you can 2302 write [% INCLUDE foo import=myhash %]. Note that 'import' is lower case, 2303 (V1 was upper case IMPORT) as in V2 it is in keeping with the virtual 2304 hash method (e.g. same as myhash.import(another.hash)). Thanks to 2305 Brian Cooper for raising the issue. 2306 2307* Yet another change to Template::Stash. Objects which are blessed 2308 arrays will now honour virtual array methods if the object doesn't 2309 otherwise implement a particular method. For example, you can now 2310 write [% USE Datafile(...) %] and then [% Datafile.size %]. The 2311 '.size' now works as virtual method on the blessed ARRAY which 2312 consitutes the Datafile object. Thanks to Keith Murphy for 2313 identifying the problem. 2314 2315* Fixed another obscure bug, this time in Template::Parser which wasn't 2316 chomping the final newline in the input string. Thanks to Paul 2317 Makepeace for reporting the problem. 2318 2319* Finally identified the cause of an error occasionally being reported 2320 by Template::Service when is thrown a non-reference exception. It 2321 appears to be a problem interacting with CGI::Carp. For now, it's 2322 fixed and tolerated in Template::Service (but could possibly do with 2323 a better long term solution?). Thanks to Jo Walsh, Trond Michelson, 2324 and I'm sure several others who reported this and helped to track 2325 the problem down (and also fixing the confess() bug I introduced 2326 when I added the tracer code. D'Oh!) 2327 2328* Removed some old "delegate-to-another-object" code from Template::Plugin, 2329 including a nasty AUTOLOAD method which prevented derived objects from 2330 acting as transparent hashes. If delegative functionality is required 2331 then it should be implemented as Template::Plugin::Delegate (and may 2332 well be in the fullness of time). 2333 2334* Fixed a whole bunch of typos and spellos thanks to patches from Leon, 2335 Paul Sharpe and Robert McArthur. 2336 2337 2338#------------------------------------------------------------------------ 2339# Version 2.00 1st December 2000 2340#------------------------------------------------------------------------ 2341 2342* Added the repeat(n), search(pattern) and replace(search, replace) 2343 virtual methods for scalars, and fixed a warning in the split() 2344 method raised when an attempt was made to split an undefined value. 2345 2346* Changed the THROW directive to accept multiple parameters which 2347 become named items of the 'error.info' item, thanks to a suggestion 2348 from Piers Cawley. Positional arguments can be addressed as 2349 [% error.info.n %] or as a list as [% error.info.args %]. Named 2350 parameters can be accessed as [% error.info.name %]. 2351 e.g. 2352 [% TRY %] 2353 [% THROW foo 'one' 2 three=3.14 %], 2354 [% CATCH %] 2355 [% error.type %] # foo 2356 [% error.info.0 %] # one 2357 [% error.info.1 %] # 2 2358 [% error.info.three %] # 3.14 2359 [% END %] 2360 2361* Moved the definition of Template::TieString from Template::Directive 2362 into Template::Config (for now) to ensure that its definition is 2363 visible even if the Template::Parser, and through it, the 2364 Template::Directive module, haven't been loaded. This fixes the 2365 bug causing the error "Can't locate object method "TIEHANDLE" 2366 via package Template::String..." raised when using EVAL_PERL with 2367 compiled templates only. In this case, the parser wasn't getting 2368 loaded (because it had no templates to parse, them all being pre- 2369 compiled) and the Template::TieString defintion wasn't visible to 2370 the EVAL_PERL blocks that require it. Added a test to t/compile3.t. 2371 Thanks to Igor Vylusko for reporting the problem. 2372 2373* Changed the Template::Directive Perl generator for EVAL_PERL blocks 2374 to generate code to first test the EVAL_PERL option in the runtime 2375 context and throw a 'perl error - EVAL_PERL not set' exception if 2376 unset. Thus the behaviour for EVAL_PERL when using compiled templates 2377 is now: if the EVAL_PERL option isn't set in the _compiling_ context, 2378 then Perl code will be generated which *always* throws an exception 2379 'perl error - EVAL_PERL not set'. If EVAL_PERL is set, then it will 2380 generate code which tests the EVAL_PERL option in the _running_ 2381 context (which may not be the same context that compiled it), and 2382 throws the same error is the option is not set. Note that [% RAWPERL %] 2383 blocks are added verbatim to the generated code if the EVAL_PERL 2384 option is set in the compiling context and no runtime check for 2385 EVAL_PERL is made. Similarly, [% PERL %] blocks could contain a 2386 Perl BEGIN block, e.g. "BEGIN { # subterfuge code here }" which 2387 will always get executed at runtime, regardless of any runtime 2388 EVAL_PERL option. Thanks to Randal Schwartz for raising this issue. 2389 2390* Fixed an obscure bug in WRAPPER which was causing some variables to 2391 have apparently strange values when within the block content. This 2392 was due to the content being formed into a closure which was called 2393 from within the WRAPPER template, possibly after some variable values 2394 had been changed. e.g. 2395 [% title = "foo" %] 2396 [% WRAPPER outer title="bar" %] 2397 The title is [% title %] 2398 [% END %] 2399 Here, the 'outer' template should be called with a 'title' value of 2400 'bar' but with 'content' set to 'The title is foo'. Previously, 2401 the content would have been processed from within the 'outer' template, 2402 resulting in a 'content' value of 'The title is bar'. The behaviour is 2403 now correct. 2404 2405* Filter failures are now raised as 'filter' exception types, instead 2406 of 'undef'. 2407 2408* Applied a patch from Simon Matthews to fix some minor bugs in the 2409 DBI plugin: 2410 2411 - Added _connect method to Plugin::DBI for backwards compatability with 2412 code from version 1 of Template that subclassed the plugin 2413 2414 - Changed the new mothod on the DBI plugin so that it checks to see if 2415 it is being called by a subclassed object. 2416 2417 - Fixed the return value in the DBI plugin when connect is called more 2418 than once in the lifetime of the plugin 2419 2420* Removed a dubious looking chomp() from Template::Plugins which may 2421 have caused abject stringification of any error object throw by a 2422 failed plugin constructor. Thanks to Piers Cawley for finding the 2423 devious culprit. 2424 2425* Changed ttree to not offer to create a ~/.ttreerc file if it doesn't 2426 exist when the user has specified a '-f file' on the command line. 2427 Thanks to Michael Stevens for raising the issue. 2428 2429* Added the match($result, $expect) subroutine to Template::Test. 2430 2431* Modified the final test of wrap.t to strip any trailing whitespace from 2432 the output due to a problem with Text::Wrap under 5.005_02. Thanks to 2433 Rob Stone for reporting the problem. 2434 2435* Added documentation for DEBUG options and stderr filter. Thanks to 2436 Piers Cawley for spotting the omission. 2437 2438 2439#------------------------------------------------------------------------ 2440# Version 2.00-rc2 14th November 2000 2441#------------------------------------------------------------------------ 2442 2443* Added the 'prev' and 'next' methods to Template::Iterator and 2444 Template::Plugin::DBI::Iterator to return the previous and next 2445 items from the data set. 2446 2447* Added the 'sort' and 'nsort' virtual methods for hash arrays, 2448 thanks to a patch provided by Leon Brocard. 2449 2450* Various fixes to DBI plugin, configuration and test:- modified 2451 Makefile.PL to prompt for DBI DSN specific to user's DBD; changed 2452 DBI plugin to accept DBI attributes (e.g. ChopBlanks) as named 2453 parameters to connect method; fixed t/dbi.t to not munge 'user' 2454 variable in final test; added 'ChopBlanks' attributes to satisfy 2455 tests under certain DBD's (e.g. Pg). Thanks to Jonas Liljegren and 2456 Chris Nandor for their efforts in finding, testing and fixing the 2457 problems. 2458 2459* Modified the XML::DOM plugin to work with XML::DOM version 1.27 2460 which now uses blessed array references instead of hashes as the 2461 underlying data types. Changed Makefile.PL and t/dom.t to require 2462 version 1.27 or later. 2463 2464* Changed the Template::Iterator module to *NOT* automatically expand 2465 the contents of blessed ARRAY objects to construct the iteration data 2466 set. The previous behaviour caused problems with modules such as 2467 XML::DOM where a single object passed to the iterator constructor 2468 would be expanded into a list of the member data, rather than being 2469 treated as a single item list containing that one object. A blessed 2470 ARRAY reference can now provide the as_list() method which the 2471 iterator constructor will call to return list data. 2472 2473* Fixed a bug in Template::Provider to ensure that template metadata 2474 (e.g. name, modtime, etc.) is written to compiled template files. 2475 Thanks to Steven Hetland for reporting the problem. 2476 2477* Changed the Template::Directive::template() generator method to 2478 raise an error if a context reference isn't passed to a template 2479 subroutine as the first argument. 2480 2481* Fixed t/autoformat.t to use locale dependant numerical formatting. 2482 Note that versions of Perl prior to 5.6.0 still have problems and 2483 will cause t/autoform.t tests 23 and 25 to fail under locales that 2484 use a decimal separator other than '.'. The Makefile.PL will issue 2485 a warning in such cases. Thanks to Jonas Liljegren for reporting 2486 the problem. 2487 2488* Applied a patch from Leon Brocard which corrects the behaviour of 2489 the URL plugin to join parameters with '&' instead of '&'. 2490 2491* Fixed a bug in the AUTOLOAD method of the Template::Plugin base 2492 class which caused warnings about not finding _DELEGATE pseudo-hash 2493 method under Perl 5.6.0. 2494 2495* Various minor documentation fixes, thanks to Henrik Edlund and Leon 2496 Brocard. 2497 2498 2499#------------------------------------------------------------------------ 2500# Version 2.00-rc1 1st November 2000 2501#------------------------------------------------------------------------ 2502 2503* Added the push(), pop(), unshift() and shift() virtual list methods 2504 and fixed the parser to allow empty lists to be created (also fixed 2505 the parser to prevent warnings being raised by empty hashes). 2506 Updated test scripts and documentation to include examples. Thanks 2507 to Stas Beckman for raising the issue. 2508 2509* Incorporated the DBI plugin module, written by Simon Matthews. This 2510 features a major reorganisation of the code, fixes a few bugs, removes 2511 some lava flow, and has improved documentation and test script. 2512 2513* Updated the Makefile.PL to prompt for DBI test parameters, check for 2514 external modules (and in particular, versions which may cause problems) 2515 and various other niceties. Also updated the README and TODO files. 2516 2517* Rewrote the XML::DOM plugin, fixing the memory leakage problems and 2518 adding the toTemplate() method and friends, as provided by Simon 2519 Matthews. Note that it's quite easy to send Perl into a deep 2520 recursive loop via the childrenToTemplate() and allChildrenToTemplate() 2521 methods due to a misfeature added by abw. This will be fixed in a 2522 future release and may result in behavioural changes to the 2523 *children* methods, so don't rely on them too heavily for now. 2524 2525* Incorporated the Dumper plugin from Simon Matthews which interfaces to 2526 the Data::Dumper module. 2527 2528* Fixed a bug in the Datafile plugin which was causing the last data field 2529 to be ignored. Credit due (yet again!) to Simon Matthews for finding 2530 the missing chomp(). 2531 2532* Fixed a bug in Template::Directive which was generating a 'Useless use 2533 of scalar ref constructor in void context...' for empty BLOCK 2534 definitions. 2535 2536* Added the Wrap and Autoformat plugins which interface to Text::Wrap 2537 and Text::Autoformat respectively. Thanks to Robert McArthur for the 2538 original Autoformat plugin code. 2539 2540* Added the XML::XPath plugin, test script and documentation. 2541 2542* Fixed a bug in the Template::Service module which was using any 2543 non-word characters to delimit lists of PRE/POST_PROCESS files. 2544 A value such as 'config, header.html' would be interpreted as 2545 [ 'config', 'header', 'html' ]. It now uses the DELIMITER value 2546 which is ':' by default, e.g. PRE_PROCESS => 'config:header.html' 2547 is interpreted as [ 'config', 'header.html' ]. 2548 2549* Fixed a bug in the parser grammar which was failing to correctly 2550 identify compound variables that contained two or more consecutive 2551 numbers. For example, the variable [% pi.3.14 %] was being interpreted 2552 as 'pi' . '3.14', instead of 'pi' . '3' . '14'. 2553 2554* Further modified parser to accept single quoted BLOCK names that would 2555 otherwise choke on 'illegal' characters. e.g. [% BLOCK 'foo bar' %] 2556 2557* Changed the Template::Context::template() method to always throw an 2558 exception when a template can't be found instead of simply setting 2559 an internal error string. Modified other Template::Context and 2560 Template::Service methods to expect this behaviour and act 2561 accordingly. The visible impact of this is that the Template 2562 error() method will now always return an exception object. 2563 Previously there were certain cases where a plain error string would 2564 have been returned. 2565 2566* Change the ROOT_OPS, SCALAR_OPS, HASH_OPS and LIST_OPS virtual 2567 method tables in Template::Stash to incorporate any existing defined 2568 values. Previously, you had to 'use Template::Stash' before 2569 defining any new virtual methods to prevent them being overwritten 2570 when Template::Stash was subsequently loaded. Thanks to Chris 2571 Nandor for identifying the problem and suggesting a fix. 2572 2573* Changed BREAK directive to LAST to keep it in line with Perl (don't 2574 know why I originally chose 'BREAK' - must have had my C head on at 2575 the time). BREAK is still supported as an alias for LAST. 2576 2577* Renamed the Template::Iterator number() method to count(), although 2578 number() is still supported for backwards compatability. The DBI 2579 plugin used count() instead of number() (an oversight, I think) but I 2580 decided that count() was the better name (shorter and more obvious). 2581 Also changed internal Template::Iterator counter variables to UPPER 2582 CASE to allow AUTOLOAD to be more easily reused by derived iterators 2583 such as the one for the DBI plugin. 2584 2585* The Template::Plugin module is now derived from Template::Base. The 2586 only significant ramification of this is that plugins should now 2587 call the error() method on failure in preference to fail(). The 2588 fail() method is still supported and delegates on to error(), but it 2589 raises a deprecation warning. 2590 2591* Fixed a bug in the Table plugin which caused an "undefined variable..." 2592 warning to be emitted when an empty list was provided. 2593 2594* Renamed 'evalperl' filter to 'perl', something that previously 2595 couldn't be done (before ANYCASE) due to 'perl' clashing with 'PERL' 2596 reserved word. 'evalperl' is still provided for backwards 2597 compatability. Also added 'evaltt' as an alias for the 'eval' 2598 filter and 'file' as an alias for 'redirect' (which I claimed to 2599 have done back in beta 3 but obviously hadn't). 2600 2601* Fixed a bug in the perl/evalperl filter which was causing a stash 2602 reference to be bound in a closure that could later become 2603 invalidated. This could lead to variables not getting/setting their 2604 correct values in subsequent calls to the same filter. 2605 2606* Documented the problem identified by Chris Winters where an IF 2607 used as a side-effect to an implied SET directive doesn't behave as 2608 expected. A directive of the form [% foo = 'bar' IF condition %] 2609 should be written explicitly as [% SET foo = 'bar' IF condition %] 2610 2611* Documented the 32k size limit (or typically less) for templates when 2612 the INTERPOLATE option is set. 2613 2614#------------------------------------------------------------------------ 2615# Version 2.00 beta 5 14th September 2000 2616#------------------------------------------------------------------------ 2617 2618* Added define_filter($name, \&filter, $is_dynamic) method to 2619 Template::Context to allow additional filters to be defined at any 2620 time. Arguments are as per the FILTERS configuration option. 2621 These filters persist for the lifetime of the processor. 2622 2623* Changed the Template::Context filter() method to accept a code 2624 reference as the filter name and use it as the filter sub. This 2625 allows filters to be bound to template variables which are then 2626 used as: 2627 2628 [% FILTER $myfilter %] 2629 2630 There is one catch, however. TT will automatically call a subroutine 2631 bound to a variable when evaluated. Thus you must wrap your filter 2632 sub in another sub: $stash->set('foo', sub { \&myfilter }); or bless 2633 it into some class (any class) to fool TT into thinking it's not a 2634 subroutine ref: $stash->set('bar', bless \&myfilter, 'any_old_name'); 2635 2636* Updated documentation for FILTER directive and FILTERS option to 2637 reflect the above changes. 2638 2639* Fixed Template::Document to run cleanly with taint checking enabled. 2640 Unfortunately, this has been achieved by blindly untainting the 2641 generated template Perl code before calling eval(). Given that 2642 we're reading template source from external files, I don't think 2643 there's any way to do reliable taint check anyway. But thankfully 2644 we can trust the parser to generate "safe" code unless EVAL_PERL is 2645 enabled in which case all bets are off anyway. 2646 2647* Updated XML::DOM plugin to include changes made by Thierry-Michel 2648 Barral to accept configuration options for XML::Parser. 2649 2650* Fixed a bug in the Table plugin which caused the first item to be 2651 repeated n times when n items was less than a specified number of 2652 columns. Thanks to Andrew Williams for finding and fixing this 2653 bug. 2654 2655* The Template::Tutorial document really is included in the 2656 distribution this time. Honest. 2657 2658 2659#------------------------------------------------------------------------ 2660# Version 2.00 beta 4 12th September 2000 2661#------------------------------------------------------------------------ 2662 2663* Added the PROCESS config option which allows a template or templates 2664 to be specified which is/are processed instead of the template 2665 passed as an argument to the Template process() method. The 2666 original template is available as the 'template' variable and can be 2667 processed by calling INCLUDE or PROCESS as [% INCLUDE $template %]. 2668 2669* Changed what was the CASE option to now be enabled by default, and 2670 then changed the name of the option to ANYCASE to make it more 2671 obvious as to what it did. You must now specify directive keywords 2672 (INCLUDE, FOREACH, IF, etc) in UPPER CASE only, or enable the 2673 ANYCASE option to revert to the previous behaviour of recognising 2674 keywords in any case. With the increase in reserved words in 2675 version 2, there is more chance of collision with variable names. 2676 It's a real pain not being able to have a variable called 'next', an 2677 exception called 'perl', etc., because there's a reserved word of 2678 the same name. Thus, keywords are now UPPER CASE only by default, 2679 neatly side-stepping the problem. 2680 2681* Changed the PERL directive so that output is generated by calling 2682 print() instead of using the final value in the block. Implemented 2683 by tying STDOUT to an output buffer based on a patch sent in by 2684 Chuck Adams. 2685 2686 new: old: 2687 [% PERL %] [% PERL %] 2688 print "foo\n"; my $output = "foo\n"; 2689 ... ... 2690 print "bar\n"; $output .= "bar\n"; 2691 [% END %] $output; 2692 [% END %] 2693 2694* The IMPORT directive and magical IMPORT variable have been replaced 2695 with a general purpose virtual hash method, import(). 2696 2697 [% hash1.import(hash2) %] # was "hash1.IMPORT = hash2" 2698 [% import(hash1) %] # was "IMPORT hash1" or "IMPORT = hash1" 2699 2700* Modified the Template::Filters provider to examine the FILTERS 2701 package hash reference (changed name from STD_FILTERS) each time a 2702 filter is requested rather than copying them at construction time. 2703 This allows new filters to be added on-the-fly. See t/filter.t for 2704 examples and Template::Filters for more info. 2705 2706* Added the 'nsort' list method which sorts items using a numerical 2707 value sort rather than an alpha sort. 2708 2709 [% data = [ 1, 5, 10, 11 ] %] 2710 [% data.sort.join(', ') %] # 1, 10, 11, 5 2711 [% data.nsort.join(', ') %] # 1, 5, 10, 11 2712 2713* Added 'div' operator to provider integer division (e.g. 'a div b' => 2714 'int(a / b)' and 'mod' which is identical to '%' but added for backwards 2715 compatibility with V1. 2716 2717* Changed the (undocumented) FORNEXT directive to NEXT and documented it. 2718 2719* Fixed a bug in the persistent caching mechanism in Template::Provider 2720 which was failing to write compiled template files for source templates 2721 specifed in the form [% INCLUDE foo/bar %]. Intermediate directories 2722 (like 'foo' in this example) weren't being created and the disk write 2723 was failing. Thanks to Simon Matthews for identifying this problem. 2724 2725* Fixed an obscure bug in the Template::Stash which was ignoring the 2726 last element in a compound variable when followed by an empty 2727 argument list. e.g. [% cgi.param() %] would be treated as [% cgi %]. 2728 Also fixed the DEBUG option so that undefined variables cause 'undef' 2729 exceptions to be raised. Thanks to Jonas Liljegren for reporting the 2730 problems. 2731 2732* Added the reference operator, '\' which allows a "reference" to 2733 another variable to be taken. The implementation creates a closure 2734 around the referenced variable which, when called, will return the 2735 actual variable value. It is really a form of lazy evaluation, rather 2736 than genuine reference taking, but it looks and smells almost the same. 2737 Primarily, it is useful for allowing sub-routine references to be 2738 passed to another sub-routine. This is currently undocumented 2739 because I'm not sure about the validity of adding it, but see t/refs.t 2740 for examples for now. 2741 2742* Changed parser to automatically unescape any escaped characters in 2743 double quoted strings except for \n and \$. This permits strings to 2744 be constructed that include tag characters. e.g. 2745 2746 [% directive = "[\% INSERT thing %\]" %] 2747 2748* Fixed a bug in the use of the 'component' variable when the current 2749 component is a sub-routine rather than a Template::Document. 2750 2751* Added the '--define var=val' option to tpage to allow template 2752 variables to be defined from the command line. Added support to 2753 ttree for various new Template configuration options. 2754 2755* Added $Template::Test::PRESERVE package variable which can be set to 2756 prevent newlines in test output from being automatically mangled to 2757 literal '\n'. 2758 2759* Completed and corrected all knows bugs in the documentation which 2760 now weighs in at around 100 pages for the Template.pm module alone. 2761 The POD documentation should now be installed by default. The 2762 Template::Tutorial document is once again included in the 2763 distribution. 2764 2765 2766#------------------------------------------------------------------------ 2767# Version 2.00 beta 3 10th August 2000 2768#------------------------------------------------------------------------ 2769 2770* Added the WRAPPER directive to include another template, passing the 2771 enclosing block as the 'content' variable. e.g. 2772 2773 somefile: mytable: 2774 [% WRAPPER mytable %] <table> 2775 blah blah blah [% content %] 2776 [% END %] </table> 2777 2778 This is equivalent to: 2779 2780 [% content = BLOCK %] 2781 blah blah blah 2782 [% END %] 2783 [% INCLUDE mytable %] 2784 2785* Added the [% INSERT file %] directive to insert the contents of a disk 2786 file without processing any of the content. Looks for the file in the 2787 INCLUDE_PATH and honours the ABSOLUTE and RELATIVE flags. Added the 2788 insert($file) method to Template::Context which calls the new 2789 load($file) method in Template::Provider which loads the file text 2790 without compiling it. 2791 2792* Added the DEFAULT configuration option which allows you to specify a 2793 default template which should be used whenever a named template 2794 cannot be found. This is ignored for templates specified with absolute 2795 or relative filenames, or as references to an input filehandle or text. 2796 2797* Added a FORNEXT directive to step on to the next iteration of a 2798 FOREACH loop, as suggested/requested by Jo Ellen Wisnosky. I chose 2799 FORNEXT rather than simply NEXT because 'next' is a very common 2800 variable name but I'm open to better suggestions. Perhaps CASE 2801 should be set by default to prevent variable conflict? This might 2802 change. 2803 2804* Reorganised the Template::Filters modules and changed the calling 2805 convention for requesting filters via the fetch() method. This now 2806 expects a reference to the calling Template::Context object as the 2807 third parameter (after filter name and reference to a list of arguments). 2808 Static filter sub-routines are returned as before and the context has 2809 no effect. Dynamic filter factories (denoted by a $is_dynamic flag 2810 in the FILTER_FACTORY table) are called to create a filter sub-routine 2811 (closure) for each request. The context is now passed as the first 2812 parameter, followed by the expansion of any arguments. Filter 2813 factories should return a sub-routine or (undef, $error) on error. 2814 2815* Added several new filters: 2816 - 'stderr' prints the output to STDERR (i.e. for generating output 2817 in the Apache logfile, for example). e.g. [% message | stderr %] 2818 2819 - 'file' is the equivalent of the version 1 redirect() filter which 2820 writes the output to a new file, relative to OUTPUT_PATH. Throws 2821 a 'file' exception if OUTPUT_PATH is not set. There should perhaps 2822 be some other way to disable this without relying on OUTPUT_PATH. 2823 2824 - 'eval' evaluates the input as a template and processes it. Proposed 2825 by Simon Matthews for times when you might be returning templates 2826 fragments from a database, for example. e.g. [% dirtext | eval %] 2827 2828 - 'evalperl' evaluate the input as Perl code, as suggested by Jonas 2829 Liligren. Requires the EVAL_PERL option to be set and will throw a 2830 'perl' error if not (see later item). e.g. [% perlcode | evalperl %] 2831 2832* Fixed a bug in Template::Provider which was mangling the metadata items 2833 for the template name and modification time. The [% template.name %] 2834 and [% template.modtime %] variables now work as expected. 2835 2836* Added 'component' variable, similar to 'template', but which references 2837 the current template component file or block, rather than the top-level 2838 template. Of course, these may be one and the same if you're not nesting 2839 any templates. 2840 2841* Template::Provider now reports errors raised when re-compiling 2842 modified templates rather than ignoring them, thanks to a patch from 2843 Perrin Harkins. 2844 2845* Fixed Template::Context to recognise the RECURSION option once more, 2846 thanks to a patch from Rafael Kitover. 2847 2848* Overloaded "" stringification of Template::Exception to call as_string(), 2849 again thanks to Rafael. In a catch block you can now simply say 2850 [% error %] as well as the more explicit [% error.type %] and/or 2851 [% error.info %]. 2852 2853* Changed Template module (via Template::Service) to return the 2854 exception raised rather than a pre-stringified form. This allows 2855 you to test the type() and/or info() if you want, or just print it 2856 and rely on the automatic stringification mentioned above to format 2857 it as expected. Note that the top-level process($file) method 2858 returns a string rather than an exception if $file can't be found. 2859 This is a bug, or a possible "gotcha" at the very least, and should 2860 get fixed some time soon. For now, test that the error is a 2861 reference before attempting to call info() or type(). 2862 2863* Fixed a bug preventing literal newlines from being used in strings. 2864 Thanks to Simon Matthews for bringing it to my attention by calling 2865 my hotel room at the Perl Conference and saying "Hello? Is that the 2866 Template Toolkit Helpdesk? I have a bug to report..." :-) 2867 (I fixed it on his laptop a few minutes later - good service, eh?) 2868 2869* Changed Template::Parser to not compile PERL or RAWPERL blocks if 2870 EVAL_PERL is not set. Previously they were compiled but switched out 2871 at runtime. This was erroneous as rogue BEGIN { } blocks could still 2872 be executed, as noted by Randal Schwartz. Any PERL or RAWPERL blocks 2873 encountered when EVAL_PERL is disabled will now cause a 'perl' exception 2874 to be thrown. 2875 2876* Added a define_block($name, $block) option to Template::Context to 2877 add a definition to the local BLOCKS cache. $block can be a reference 2878 to a template sub-routine or Template::Document object or template 2879 text which is first compiled. 2880 2881* Any other errors thrown in a PERL blocks (assuming EVAL_PERL set) 2882 are now left unchanged. Previously, these were converted to 'perl' 2883 exceptions which prevented exceptions of other kinds being throw 2884 from within Perl code. 2885 2886* Applied a patch from Chris Dean to fix a bug in the list 'sort' 2887 method which was converting a single element list into a hash. The 2888 sort now does nothing unless there's > 1 elements in the list. 2889 2890* Changed Template::Stash set() method to append the assigned value to 2891 the end of any arguments specified, rather than prepending it to the 2892 front. e.g. The foo() method called by [% myobj.foo(x, y) = z %] now 2893 receives arguments as foo(x, y, z) instead of foo(z, x, y). 2894 2895* Changed Template::Base::error() to accept a reference (e.g. exception) 2896 as the first parameter. In this case, no attempt is made to 2897 concatenate (and thereby stringify) the arguments. 2898 2899* Added a direct stash() accessor method to Template::Context rather 2900 than relying on the slower AUTOLOAD method. 2901 2902* Added an iterator() method to Template::Config to require 2903 Template::Iterator and instantiate an iterator, and changed 2904 generated code for FOREACH to call this factory method. This fixes 2905 a bug with pre-compiled (i.e persistent) templates which were 2906 failing if Template::Iterator wasn't already loaded. Thanks to Doug 2907 Steinwand, Rafael Kitover and Jonas Lilegren who all identified the 2908 problem and hounded me until I fixed it. :-) 2909 2910* Fixed a problem with persistent templates not being reloaded due to 2911 the %INC hash. This caused 1 to be returned from require() instead 2912 of the compiled template. 2913 2914* Added ABSOLUTE and RELATIVE options to tpage by default. 2915 2916* Applied various documentation and test patches from Leon Brocard. 2917 Fixed docs to quote dotted exception types to prevent string 2918 concatenation, as noted by Randal Schwartz. Generally added a 2919 whole lot more documentation. 2920 2921#------------------------------------------------------------------------ 2922# Version 2.00 beta 2 14th July 2000 2923#------------------------------------------------------------------------ 2924 2925* Added COMPILE_DIR option. This allows you to specify a separate 2926 directory in which compiled templates should be written. The COMPILE_DIR 2927 is used as a root directory and each of the INCLUDE_PATH elements is 2928 created below that point. e.g. the following options 2929 2930 COMPILE_DIR => '/tmp/ttcache', 2931 INCLUDE_PATH => '/user/foo/bar:/usr/share/templates', 2932 2933 would create the following cache directories: 2934 2935 /tmp/ttcache/user/foo/bar 2936 /tmp/ttcache/usr/share/templates 2937 2938 Templates originating from source files in the INCLUDE_PATH are thus 2939 written in their compiled form (i.e. Perl) to the relevant COMPILE_DIR 2940 directory. The COMPILE_EXT option may also be used in conjunction with 2941 COMPILE_DIR to append a filename extension to all compiled files. 2942 2943* Fixed memory leaks caused by the huge circular reference that is the 2944 Template::Provider's linked list of cache slots. Added a DESTROY method 2945 which walks the list and explicitly breaks the chains (i.e. the NEXT/PREV 2946 links), thus allowing the compiled Template::Document objects to be 2947 correctly destroyed and their memory repooled. Thanks to Perrin Harkins 2948 for spotting the problem. 2949 2950* Added a work-around in Template::Stash _dotop() to the problem of the 2951 CGI module denying membership of the UNIVERSAL class on subsequent calls 2952 to UNIVERSAL::isa($cgi, 'UNIVERSAL'). It works correctly the first time, 2953 but returns false for all subsequent calls. Changed this generic 2954 "is-an-object" test to UNIVERSAL::can($cgi, 'can') on the suggestion 2955 of Drew Taylor who identified the problem. 2956 2957* Added t/macro.t to test MACRO directive, t/compile4.t and t/compile5.t 2958 to test the COMPILE_DIR option. 2959 2960* More complete documentation, but not yet fully complete. 2961 2962 2963#------------------------------------------------------------------------ 2964# Version 2.00 beta 1 10th July 2000 2965#------------------------------------------------------------------------ 2966 2967* Template::Context include()/process() now works with raw CODE refs. 2968 2969* Template.pm now prefixes OUTPUT with the OUTPUT_PATH when OUTPUT 2970 is a file name. 2971 2972* Cleaned up Template::Iterator. Now derived from Template::Base. 2973 Removed ACTION and ORDER now that they are supported as list pseudo 2974 methods in the Stash LIST_OPS. 2975 2976* Fixed bug in Provider preventing updated files from being automatically 2977 reloaded. Thanks to Perrin Harkins who provided the patch. 2978 2979* Fixed bug in Template::Plugin::Datafile which was preventing a comment 2980 from being placed on the first line of the file. 2981 2982* Fixed bug in parse grammer preventing commas in a META list 2983 2984* Added cache persistence by writing real Perl to file (rather than 2985 the previous Data::Dumper dump of the opcode tree). Had to 2986 re-organise a bunch of code around the parser/provider/document. 2987 Activated by COMPILE_EXT configuration item. 2988 2989* Added a work-around in Template::Stash to the problem of CGI disclaiming 2990 membership of the UNIVERSAL class after the first method call. 2991 2992* Added AUTO_RESET option which is enabled by default. Disable this 2993 (AUTO_RESET => 0) for block persistence across service invocations. 2994 2995* Fixed \@ quoting (and others) in Directive thanks to Perrin Harkins 2996 who reported the bug and Chuck Adams who provided a patch. 2997 2998* Added Date plugin and test, as provided by Thierry-Michel Barral. 2999 3000* Integrated changes to Template::Test from version 1.07 and beyond. Now 3001 supports -- process -- option in expect, mainly for use of t/date.t et al. 3002 3003* Integrated new upper and lower filters from 1.08, and '|' alias for FILTER 3004 from 1.07. 3005 3006* Added new directive.t test to test chomping and comments. 3007 3008* BLOCKS can now be defined as template text which gets automatically 3009 compiled into a Template::Document object. 3010 3011* Integrated XML plugins and tests from version 1.07 3012 3013* Fixed TRIM option to work with all BLOCKs and templates. Moved TRIMing 3014 operation into context process() and include() methods. Also changed 3015 service to call $context->process($template) rather than call the sub/ 3016 doc itself, thus ensuring that the output can get TRIMmed. 3017 3018* Updated Template::Plugin.pm 3019 3020* Added '--define' option to ttree. 3021 3022* Integrated various plugins and filters from v1.07 3023 3024* Moved Template::Utils::output into Template.pm?) and got rid of 3025 Template::Utils altogether. 3026 3027* Fixed bug in Context filter() provider method which wasn't caching 3028 filters with args. 3029 3030* [% CASE DEFAULT %] is now an alias for [% CASE %] (the default case), 3031 in consistency with [% CATCH DEFAULT %] / [% CATCH %] 3032 3033 3034#------------------------------------------------------------------------ 3035# Version 2.00 alpha 1 3036#------------------------------------------------------------------------ 3037 3038* first public alpha release of Version 2.00 3039 3040 3041 3042#======================================================================== 3043# VERSION 2.00 3044#------------------------------------------------------------------------ 3045# The following list outlines the major differences between version 1.* 3046# and version 2.00 of the Template Toolkit. 3047#======================================================================== 3048 3049New Language Features 3050--------------------- 3051 3052* New SWITCH / CASE statement. SWITCH takes an expression, CASE takes 3053 a value or list of values to match. CASE may also be left blank or 3054 written as [% CASE default %] to specify a default match. Only one 3055 CASE matches, there is no drop-through between CASE statements. 3056 3057 [% SWITCH myvar %] 3058 [% CASE value1 %] 3059 ... 3060 [% CASE [ value2 value3 ] %] # multiple values to match 3061 ... 3062 [% CASE myhash.keys %] # ditto 3063 ... 3064 [% CASE %] # default, or [% CASE default %] 3065 ... 3066 [% END %] 3067 3068* New TRY / CATCH / FINAL construct for fully functional, nested 3069 exception handling. The block following the TRY is executed and 3070 output if no exceptions are throw. Otherwise, the relevant CATCH 3071 block is executed. CATCH types are hierarchical (e.g 'foo' catches 3072 'foo.bar') or the CATCH type may be left blank or specified as [% 3073 CATCH default %] to provide a default handler. The contents of a 3074 FINAL block, if specified, will be processed last of all, regardless 3075 of the result (except an uncaught exception which is throw upwards 3076 to any enclosing TRY block). 3077 3078 [% TRY %] 3079 ...blah...blah... 3080 [% CALL somecode %] # may throw an exception 3081 ...etc... 3082 [% INCLUDE someblock %] # may have a [% THROW ... %] directive 3083 ...and so on... 3084 [% CATCH file %] # catch system-generated 'file' exception 3085 ... 3086 [% CATCH DBI %] # catch 'DBI' or 'DBI.*' 3087 ... 3088 [% CATCH %] # catch anything else 3089 ... 3090 [% FINAL %] # optional 3091 All done! 3092 [% END %] 3093 3094* New CLEAR directive to clear the current output buffer. This is typically 3095 used in a CATCH block to clear the output of a failed TRY block. Any output 3096 generated in a TRY block up to the point that an exception was thrown will 3097 be output by default. The [% CLEAR %] directive in a catch block clears 3098 this output from the TRY block. 3099 3100 [% TRY %] 3101 blah blah blah, this is the current output block 3102 [% THROW some.error 'Danger Will Robinson!' %] 3103 not reached... 3104 [% CATCH %] 3105 [% # at this point, the output block contains the 'blah blah...' line 3106 # up to the point where the THROW occured, but we don't want it 3107 CLEAR 3108 %] 3109 Here we can add some more text if we want... 3110 [% END %] 3111 3112 In general, the CLEAR directive clears the current output from the 3113 template or enclosing block. 3114 3115* New META directive allowing you to define metadata items for your 3116 templates. These are attached to the compiled template and wrapped 3117 up as a Template::Document object. The 'template' variable is a 3118 reference to the current parent document and metadata items may be 3119 accessed directly. Of particular note is the fact that the 3120 'template' variable is correctly defined for all PRE_PROCESS and 3121 POST_PROCESS headers. Thus, your headers and footers can access 3122 items from the main template (e.g. title, author, section, keywords, 3123 flags, etc) and display them or act accordingly. 3124 3125 mytemplate: 3126 [% META 3127 title = 'This is a Test' 3128 author = 'Andy Wardley' 3129 copyright = "2000, Andy Wardley" 3130 %] 3131 3132 <h1>[% template.title %]</h1> 3133 blah blah 3134 3135 header: (a PRE_PROCESS template) 3136 <html> 3137 <head><title>[% template.title %]</title></head> 3138 <body> 3139 3140 footer: (a POST_PROCESS template) 3141 <hr> 3142 © Copyright [% template.copyright or '2000, MyCompany' %] 3143 3144* New RAWPERL ... END block directive allows you to write raw Perl 3145 code which is integrated intact and unsullied into the destination 3146 template sub-routine. The existing PERL ... END directive continues 3147 to be supported, offering runtime evaluation of a block which may 3148 contain other template directives, etc, which are first evaluated 3149 (e.g. PERL...END processes the block and filters the output into 3150 Perl evaluation at runtime). 3151 3152* New INSERT directive which inserts the contents of a file without 3153 processing it. 3154 3155* New WRAPPER directive which processes the following block into the 3156 'content' variable and then INCLUDEs the named file. 3157 3158 [% WRAPPER table %] 3159 blah blah blah 3160 [% END %] 3161 3162 [% BLOCK table %] 3163 <table> 3164 [% content %] 3165 </table> 3166 [% END %] 3167 3168* Comments now only extend to the end of the current line. 3169 3170 [% # this is a comment 3171 a = 10 3172 # so is this 3173 b = 20 3174 %] 3175 3176 Placing the '#' character immediately inside the directive will comment 3177 out the entire directive 3178 3179 [%# entire directive 3180 is ignored 3181 %] 3182 3183* The TAGS directive can now be used to switch tag styles by name. 3184 Several new tag styles are defined (e.g. html, asp, php, mason). 3185 3186 [% TAGS html %] 3187 <!-- INCLUDE header --> 3188 3189* The output from any directive or block can now be captured and assigned to 3190 a variable. 3191 3192 [% htext = INCLUDE header %] 3193 [% btext = BLOCK %] 3194 blah blah 3195 [% x %] [% y %] [% z %] 3196 [% END %] 3197 3198 # you can even assign the output of loops, conditions, etc. 3199 [% numbers = FOREACH n = [2, 3, 5, 7, 11, 13] %] 3200 blah blah [% n %] 3201 [% END %] 3202 3203* The handling of complex expressions has been improved, permitting 3204 basic directives to contain logical shortcut operators, etc. All 3205 binary operators now have the same precedence rules as Perl. 3206 3207 [% foo or bar %] # GET foo, or bar if foo is false (0/undef) 3208 [% CALL func1 and func2 %] # func2 only called if func1 returns true 3209 [% name = user.id or cgi.param('id') %]. 3210 3211* A new "x ? y : z" operation is provided as a shorthand for 3212 "if x then y else z" 3213 3214 [% foo = bar ? baz : qux %] 3215 3216* A leading '$' on a variable is now used to indicate pre-interpolation 3217 of that element. This simplifies the syntax and makes it consistent 3218 with double-quoted string interpolation and text block interpolation 3219 via the INTERPOLATE flag. If you've been relying on the version 1 3220 "feature" that ignores the leading '$' then you'll need to change your 3221 templates to remove the '$' characters (except where you really want 3222 them) or set the V1DOLLAR flag to 1 to revert to the version 1 3223 behaviour. See the 'Gotchas' section below for more details. 3224 3225 # version 1 3226 [% hash.${key} %] [% hash.${complex.key} %] 3227 3228 # version 2 3229 [% hash.$key %] [% hash.${complex.key} %] 3230 3231* Various new pseudo-methods have been added for inspecting and manipulating 3232 data. The full list now looks something like this: 3233 3234 [% var.defined %] # variable is defined 3235 [% var.length %] # length of string 3236 [% var.split(delim, limit) %] # split string as Perl does 3237 3238 [% hash.keys %] # return list of hash keys 3239 [% hash.values %] # ditto hash values 3240 [% hash.each %] # ditto keys and values 3241 [% hash.import(hash2) %] # merge hash2 into hash 3242 3243 [% list.size %] # number of items in list 3244 [% list.max %] # last item number (size - 1) 3245 [% list.first %] # first item 3246 [% list.last %] # last item 3247 [% list.push(item) %] # add item to end 3248 [% list.pop %] # remove item from end 3249 [% list.unshift(item) %] # add item to front 3250 [% list.shift %] # remove item from front 3251 [% list.reverse %] # return reversed order 3252 [% list.sort(field) %] # return alpha sorted order 3253 [% list.nsort(field) %] # return numerical sorted order 3254 [% list.join(joint) %] # return items joined into single string 3255 3256 3257Configuration Options 3258--------------------- 3259 3260* Template blocks may be pre-defined using the new BLOCKS option. These 3261 may be specified as template text or as references to sub-routines or 3262 Template::Document objects. 3263 3264 my $template = Template->new({ 3265 BLOCKS => { 3266 header => '<html><head><title>[% title %]</title></head><body>', 3267 footer => '</body></html>', 3268 funky => sub { blah_blah($blah); return $some_text }, 3269 } 3270 }); 3271 3272* Automatic error handling can be provided with the ERROR option. This 3273 allows you to specify a single template or hash array of templates which 3274 should be used in the case of an uncaught exception being raised in the 3275 a template. In other words, if something in one of your templates 3276 throws a 'dbi' error then you can define an ERROR template to catch 3277 this. The original template output is discarded and the ERROR template 3278 processed in its place. PRE_PROCESS and POST_PROCESS templates (e.g. 3279 header and footers) are left intact. This provides a particularly 3280 useful high-level error handling abstraction where you simply create 3281 templates to handle particular exceptions and provide the mapping 3282 through the ERROR hash. 3283 3284 my $template = Template->new({ 3285 ERROR => { 3286 dbi => 'error/database.html', # DBI error 3287 'user.pwd' => 'error/badpasswd.html', # invalid user password 3288 user => 'user/index.html', # general 'user' handler 3289 default => 'error/error.html', # default error template 3290 } 3291 }); 3292 3293* The INCLUDE_PATH is now fully dynamic and can be changed at any time. 3294 The new Template::Provider which manages the loading of template files 3295 will correctly adapt to chahges in the INCLUDE_PATH and act accordingly. 3296 3297* The LOAD_TEMPLATES option allows you to specify a list of one or more 3298 Template::Provider object which will take responsibility for loading 3299 templates. Each provider can have it's own INCLUDE_PATH, caching 3300 options (e.g CACHE_SIZE) and so on. You can sub-class the 3301 Template::Provider module to allow templates to be loaded from a 3302 database, for example, and then define your new provider in the 3303 LOAD_TEMPLATES list. The providers are queried in order as a "Chain 3304 of Responsiblity". Each may return a compiled template, raise an 3305 error, or decline to serve the template and pass control onto the 3306 next provider in line. 3307 3308* The CACHE_SIZE option defines a maximum number of templates that will 3309 be cached by the provider. It is undefined by default, causing all 3310 templates to be cached. A value of 0 disables caching altogether while 3311 a positive integer defines a maximum limit. The cache (now built into 3312 Template::Provider) is much smarter and will automatically reload and 3313 compile modified source templates. 3314 3315* The Template::Provider cache can write compiled templates (e.g. Perl code) 3316 to disk to create a persistent cache. The COMPILE_EXT may be used to 3317 specify a filename extension (e.g. '.ttc') which is used to create 3318 compiled template files. These compiled template files 3319 can then be reloaded on subsequent invocations using via Perl's 3320 require() (which is about as fast as it can get). The Template::Parser 3321 and Template::Grammar modules are loaded on demand, so if all templates 3322 have been pre-compiled then the modules don't get loaded at all. This 3323 is a big win, given that Template::Grammar is the biggy. 3324 3325* The ABSOLUTE and RELATIVE options are now used to enable the loading of 3326 template files (via INCLUDE or PROCESS) that are specifies with absolute 3327 (e.g. /tmp/somefile) or relative (e.g. ../tmp/another) filenames. Both 3328 are disabled by default. 3329 3330* The LOAD_PLUGINS option is similar to LOAD_TEMPLATES but allows you 3331 to specify one or more plugin providers. These take responsibility 3332 for loading and instantiating plugins. The Template::Plugins module 3333 is the default provider and multiplexes requests out to other 3334 Template::Plugin::* plugin modules. Loading of plugins has been 3335 simplified and improved in general The PLUGINS option can be used to 3336 map plugin names to specific modules and PLUGIN_BASE can map plugins 3337 into particular namespaces. The LOAD_PERL option can be used to 3338 load (almost) any regular Perl module and use it as a plugin. 3339 3340* The LOAD_FILTERS option is similar to LOAD_TEMPLATES and LOAD_PLUGINS, 3341 allowing one or more custom providers to be specified for providing 3342 filters. The Template::Filters module is the default provider here. 3343 3344* The TOLERANT option can be used to tailor the behaviour of providers 3345 (e.g. Template::Provider, Template::Plugins, Template::Filters) when 3346 they encounter an error. By default, providers are not TOLERANT (0) 3347 and will report all failures as errors. When TOLERANT is set to 1, 3348 they will ignore errors and return STATUS_DECLINED to give the next 3349 provider a chance to deliver a valid resource. 3350 3351* The INTERPOLATE option is now automatically disabled within PERL and 3352 RAWPERL blocks to prevent Perl $variables from being interpreted as 3353 template variables. 3354 3355 # INTERPOLATE = 1 3356 This $var will get interpolated... 3357 [% PERL %] 3358 # but these won't 3359 my $foo = 'some value'; 3360 my $bar = 'another value'; 3361 # etc... 3362 [% END %] 3363 now we're interpolating variables again, like $var 3364 3365* Added the TRIM option to automatically removed leading and trailing 3366 whitespace from the output of templates and BLOCKs. 3367 3368* The CASE option has now been obsoleted and replaces by the ANYCASE 3369 option. See comments elsewhere in this document ('Gotchas' below and 3370 notes for 2.00 beta 4) for further details. 3371 3372 3373Templates Compiled to Perl Code 3374------------------------------- 3375 3376Templates are now compiled to Perl code, with credit and respect due 3377to Doug Steinwand for providing an implementation around which the 3378new parser was built. This brings a number of important benefits: 3379 3380* Speed and Memory Efficiency 3381 3382 Version 1 used a list of opcodes to represent directives and 3383 lower-level operations. These were evaluated by the hideously 3384 contrived, and darkly sinister Template::Context::_evaluate() 3385 method. In version 2, all templates are parsed and rebuilt as Perl 3386 code. This is then evaluated and stored as a reference to a Perl 3387 sub-routine which can then be executed and re-executed significantly 3388 faster and with far less memory overhead. 3389 3390* Persistence. 3391 3392 Once a template has been compiled to Perl code it can be saved to 3393 disk as a "compiled template" by defining the COMPILE_EXT option. 3394 This allows you to specify a filename extension (e.g. '.ttc') which 3395 is added to the template filename and used to create a new file 3396 containg the Perl code. Next time you use the template, even if 3397 you've shut down your program/server/computer in the mean time, the 3398 compiled template is there in a file as Perl code and is simply 3399 require()d and executed. It all happens significantly faster 3400 because there's no Template::Parser to run. In fact, if all your 3401 templates are "compiled" on disk then the Template::Parser and 3402 Template::Grammar modules won't even be loaded, further reducing 3403 startup time and memory consumption (the grammar file, in particular 3404 is rather large). The Template::Provider module handles the 3405 loading, caching and persistence of templates, and will examine file 3406 timestamps and re-compiled modified templates as required. 3407 3408* Flexibility. 3409 3410 Because "compiled templates" are now nothing more than Perl 3411 sub-routines, you can use anyone or anything to generate them and 3412 run them all under the same roof. Different parser back-ends can 3413 generate Perl code optimised for speed or functionality, for 3414 example. Or different parsers can compile different template 3415 languages (PHP, ASP, Mason, roll-your-own, etc.) and run them 3416 alongside regular templates. Or if you don't trust a parser, you 3417 can even write your own Perl code and have your templates execute as 3418 fast as the code you can write. 3419 3420 3421Other Enhancements and Internal Features 3422---------------------------------------- 3423 3424* Templates (i.e. sub-routines) now return their generated output, 3425 rather than sending it to $context->output(). This speeds things 3426 up and makes the code simpler, as well as allowing greater 3427 flexibility in how template sub-routines can work. 3428 3429* Exceptions are now raised via Perl's die() and caught by an 3430 enclosing eval { } block. Again, this simplifies the code generated 3431 and improves runtime efficiency. The [% RETURN %] and [% STOP %] 3432 directives are now implemented as special case exceptions which are 3433 caught in the appropriate place and handled accordingly. 3434 3435* Local named BLOCK definitions are better behaved and don't permanently 3436 mask any real files. BLOCK definitions remain local to the template in 3437 which they're defined, although they can be accessed from templates 3438 INCLUDEd or PROCESSed from within. The PROCESS directive will export 3439 defined BLOCKs to the caller (as with variables) whereas INCLUDE will 3440 keep them "private". 3441 3442* The Template::Stash object now encapsulates all the magical variable 3443 resolution code. Both simple and compound variables can be accessed 3444 or updated using the get() and set() methods, with all variable binding 3445 magic happening automatically. 3446 3447* The Template::Context object is now greatly simplified. This acts 3448 as a general interface to the Template Toolkit functionality, being 3449 a collection of the various other modules that actually implement 3450 the functionality (e.g. Template::Stash, Template::Provider, 3451 Template::Document, Template::Plugins, etc.) 3452 3453* The Template::Provider object provides a general facility for 3454 retrieving templates from disk (or other source), and if necessary 3455 compiling via a call to a Template::Parser helper object. Multiple 3456 Template::Provider objects may be chained together, each with their 3457 own caching options, and so on. 3458 3459* The Template::Parser object now compiles template text into Perl 3460 code and then evaluates it into a sub-routine reference using Perl's 3461 eval(). This is then wrapped up into a Template::Document object, 3462 including any metadata items and/or additional named BLOCKs defined 3463 in the input template. 3464 3465* The Template::Document object is a thin wrapper around a compiled 3466 template sub-routine. It provides a process() method for processing 3467 the template and a blocks() method for returning a reference to the 3468 hash array of any additional named BLOCKs defined in the original 3469 template text. An AUTOLOAD method returns values of metadata items, 3470 allowing a Template::Document reference to be used as the 'template' 3471 variable. 3472 3473* The Template::Service module provides a high-level service for 3474 processing templates, allowing PRE_PROCESS and POST_PROCESS templates 3475 to be specified along with an ERROR handling hash. 3476 3477* The Template::Base module defines a common base class for many of 3478 the toolkit modules. It implements shared functionality such as a 3479 constructor, error reporting and handling, etc. Modules are now 3480 much easier to sub-class, all using separate new() and _init() 3481 methods. 3482 3483* The Template::Config module provides methods for loading and 3484 instantiating different Template Toolkit modules. Using this 3485 factory-based approach makes it far easier to change the default 3486 object class for a specific part of the toolkit. e.g. 3487 3488 use Template; 3489 use Template::Config; 3490 3491 $Template::Config::PARSER = 'MyOrg::Template::MyParser'; 3492 3493 # $tt object will create and use a MyOrg::Template::MyParser 3494 # object as PARSER 3495 my $tt = Template->new({ ... }) 3496 3497* The Template::Test module has been enhanced to make it easier to test 3498 more advanced TT features. You can now define multiple TT processors 3499 and switch between them for different test with the '-- use name --' 3500 directive. Also added the '-- process --' directive which can be 3501 added after '-- expect --' to hav the expected output processed by 3502 TT before comparison. 3503 3504* The Template module remains, as it ever was, a simple front-end to 3505 the Template Toolkit. This creates a single Template::Service to 3506 which it delegates control for processing templates. Output is 3507 returned according to the OUTPUT options specified for the module 3508 and/or any output option passed explicitly to the process() method. 3509 3510 3511New Filters 3512----------- 3513 3514* 'upper' and 'lower' filters perform case folding of text. 3515 3516* 'eval' can be used to evaluate Template Toolkit directives at runtime. 3517 3518* 'perl' evaluates Perl code if (and only if) the EVAL_PERL flag is set. 3519 3520* 'stderr' is a simple filter to STDERR. 3521 3522* 'file' is a new alias for the 'redirect' filter. The OUTPUT_PATH option 3523 must be set. 3524 3525 3526New Plugins 3527----------- 3528 3529* The DBI plugin is now distributed with the Template Toolkit. 3530 3531* The Date plugin formats dates and times via the POSIX strftime() sub. 3532 3533* The Iterator plugin provides access to the Template::Iterator module. 3534 3535* The Dumper plugin provides an interface to the Data::Dumper module. 3536 3537* The Wrap and Autoformat plugins interface to the Text::Wrap and 3538 Text::Autoformat modules respectively. 3539 3540* The XML::DOM and XML::XPath plugins provide interfaces to the relevant 3541 XML modules. 3542 3543 3544Utility Scripts 3545--------------- 3546 3547* Added the '--define var=val' option to ttree. 3548 3549 3550Gotchas 3551------- 3552 3553Things that have changed between version 1 and 2 that might catch you 3554out. 3555 3556* Bare CATCH blocks are no longer permitted and must be explicitly 3557 scoped with a matching TRY. In most cases, this simply means adding 3558 a [% TRY %] to the start of any templates that define CATCH blocks, 3559 and ensuring that the CATCH blocks are moved to the end of the file 3560 (or relevant place). 3561 3562 # version 1 - no longer supported 3563 blah blah blah...some error occurs 3564 3565 [% CATCH some_kind_of_error %] 3566 handler template... 3567 [% END %] 3568 3569 # version 2 3570 [% TRY %] 3571 blah blah blah...some error occurs... 3572 3573 [% CATCH some_kind_of_error %] 3574 handler template... 3575 [% END %] 3576 3577 Also be aware that this may change the expected output in case of 3578 errors. By default, all output in the TRY block up to the point of 3579 error will be returned, with the relevant catch block, and then and 3580 further template output appended. You can use [% CLEAR %] within a 3581 CATCH block to clear the output from the TRY block, if you prefer. 3582 TRY blocks can be nested indefinately. 3583 3584* The ERROR directive is no longer supported. It was very ill-defined 3585 anyway and serves no purpose that can't be acheived by defining 3586 custom filters, error handlers bound to template variables, or 3587 whatever. I haven't implemented any special error or logging 3588 facilities, other than the general purpose exception handling, but 3589 welcome any thoughts on what or if anything else is needed. 3590 3591* The ERROR option is also different. It could previously be used 3592 to specify an error handling sub-routine, but is no longer required 3593 (see previous point). The ERROR option in version 2 is used to 3594 define a map of error types to template names for automatic 3595 redirection for error handling. 3596 3597* The current exception caught in a catch block is now aliased to the 3598 variable 'error' rather than 'e'. This is much more logical, IMHO, 3599 and was only prevented previously by 'error' being a reserved word. 3600 Note that 'e' is still defined, in addition to 'error'. This may be 3601 deprecated at some point in the future. 3602 3603* The use of a leading '$' on variables is no longer optional, and 3604 should only be used to explicitly to indicate interpolatation of a 3605 variable name. Most of the time you *don't* want to do this, so 3606 leave the '$' off. This represent a slight shift away from the 3607 (optional) Perlness of the language, but I think it's a necessary 3608 step to improve the clarity and consistency of the language. 3609 3610 As previously discussed on the mailing list, in interpolated text 3611 (i.e. a "double quoted" string or regular template text with 3612 INTERPOLATE set), both '$foo' or '${foo}' are interpolated as the 3613 value of the variable 'foo'. This is good because it is a de-facto 3614 standard, consistent with Perl, shell, etc. But inside a directive, 3615 [% $foo %] and [% ${foo} %] mean different things, the first being 3616 equivalent to [% foo %] or [% GET foo %] (the leading '$' is 3617 ignored) but the second actually fetching a variable whose name is 3618 stored in the variable 'foo'. In other words, '${foo}' interpolates 3619 to the value of foo ('bar', say) and then this is used as the 3620 parameter to GET (which itself is optional). Thus, in this case, [% 3621 ${foo} %] is [% GET ${foo} %] is [% GET bar %]. 3622 3623 This makes more sense if you look at the common example of 3624 accesing an entry from a hash array using the value of an variable 3625 as the key (e.g. $hash->{ $key }). In version 1, the leading '$' on 3626 variables is ignored, meaning that the following are NOT identical. 3627 3628 # version 1 3629 [% hash.$key %] # ERROR - '$' ignored => [% hash.key %] 3630 [% hash.${key} %] # OK - '$key' is interpolated first 3631 3632 It gets more confusing if you excercise your right to add optional 3633 leading '$'s in other places (which is one reason why I've always 3634 suggested against their use). 3635 3636 # version 1 - same as above 3637 [% $hash.$key %] 3638 [% $hash.${key} %] 3639 3640 In particular, that last example should demonstrate the 3641 inconsistency. Unlike interpolated text, '$...' and '${...}' are 3642 not treated the same and '$hash' is not interpolate while '${key}' 3643 is. The only consistent solution I can see to this is to make both 3644 '$xxx' and '${xxx}' indicate interpolation in all cases, so that's 3645 what I've done. In version 2, the syntax becomes a lot clearer and 3646 aligns more closely to a markup language than a programming 3647 language. I think this is a Good Thing, but let me know what you 3648 think... 3649 3650 Here's the Version 2 summary, assuming INTERPOLATE is set. 3651 3652 # version 2 3653 my name is $name 3654 my name is $user.name 3655 my name is ${user.name} 3656 3657 3658 [% GET name %] [% name %] 3659 [% GET user.name %] [% user.name %] 3660 [% GET people.fred %] [% people.fred %] 3661 [% GET people.$name %] [% people.$name %] 3662 [% GET people.${user.name} %] [% people.${user.name} %] 3663 3664 [% INCLUDE header 3665 title = "Home Page for $name" 3666 %] 3667 [% INCLUDE header 3668 title = "Home Page for $user.name" 3669 %] 3670 [% INCLUDE header 3671 title = "Home Page for ${user.name}" 3672 %] 3673 3674* Changed default TAG_STYLE to only recognise [% ... %] and not the MetaText 3675 compatability %% ... %% style. Set TAG_STYLE => 'template1' to accept both, 3676 or 'metatext' for just %% ... %% 3677 3678* Changed how error/return values should be returned from user code. 3679 All errors should be thrown via one of the following: 3680 3681 die $error_msg; 3682 die (Template::Exception->new($type, $info)); 3683 $context->throw($msg); 3684 $context->throw($type, $info); 3685 $context->throw($exception); 3686 3687* USERDIR and USERBLOCK are not supported (they were experimental and 3688 undocumented, anyway) 3689 3690* $Template::Directive::While::MAXITER is now 3691 $Template::Directive::WHILE_MAX and may change again. 3692 3693* into() filter is now obsolete. You can now simply assign the output of 3694 another directive or block to a variable. 3695 3696 [% x = INCLUDE foo %] 3697 [% y = BLOCK %] 3698 blah blah blah 3699 [% END %] 3700 3701* The CASE option has been removed and replaced with the ANYCASE option 3702 which is the logical opposite. Directive keywords should now be UPPER 3703 CASE by default and the ANYCASE option can be enabled to revert to 3704 the previous behaviour of accept keywords in any case. 3705 3706* The IMPORT directive and magical variable have been removed and 3707 replaced by a general purpose virtual hash method, import(). 3708 [% IMPORT myhash %] should now be written [% import(myhash) %] 3709 and [% myhash.IMPORT = another.hash %] should be written as 3710 [% myhash.import(another.hash) %] 3711 3712