Re: [Templates] Can a template tell if it has been PROCESSed or INCLUDEd?

2014-09-25 Thread Andy Wardley
Hi Andy Is this possible to do in TT? Nope, there's nothing I can think of that will allow you to determine that from within the template. One work-around would be to INCLUDE a local BLOCK inside the template. [% INCLUDE my_local_block %] [% BLOCK my_local_block %] [% END

Re: [Templates] Can a template tell if it has been PROCESSed or INCLUDEd?

2014-09-25 Thread Andy Wardley
On 25/09/2014 18:35, Andy Lester wrote: The point of the check is for a template that knows that it must be invoked via INCLUDE to complain if it's been invoked with PROCESS. Something else that came to mind while I was out walking the dog... If you don't mind subclassing Template::Context

[Templates] Version 2.26 is out

2014-09-17 Thread Andy Wardley
#section_OUTLINE_TAG Summary of changes below. Cheers Andy #--- # Version 2.26 - 17th September 2014 # * Andy Wardley added outline directives. See Template::Manual

Re: [Templates] Time Display/Formatting Question

2014-08-22 Thread Andy Wardley
Hi Benjamin, I want to format this number of seconds as a number of minutes and a number of seconds. I would rather do this formatting within within the template than by altering the data in the hash from within my Perl script. Perhaps the best approach is to define your own virtual method.

[Templates] New feature: outline directives

2014-04-24 Thread Andy Wardley
Hi all, I got bored of waiting for me to release TT3 so I back-ported outline directives to TT2. This is only on github at the moment, not yet released to CPAN. Short example: %% IF a a is set to [% a %] %% ELSE a is not set %% END Which is equivalent to: [% IF a -%] a is

Re: [Templates] New feature: outline directives

2014-04-24 Thread Andy Wardley
On 24/04/2014 07:54, Octavian Rasnita wrote: Are there any other differences? Nope, that's it. I've had problems with RSI and trapped nerves in the past so I'm glad to save two (or three if you include the '-' post-chomper) characters per directive. But it's not a big deal. Just an itch

Re: [Templates] Using a hash as a Template::Provider

2013-03-15 Thread Andy Wardley
On 15/03/2013 01:13, Philippe Bruhat (BooK) wrote: My question is: did I overlook a simpler way to do this? You can use the BLOCKS configuration item to define templates up front: http://template-toolkit.com/docs/manual/Config.html#section_BLOCKS e.g. my $tt = Template-new( BLOCKS

Re: [Templates] Is Andy still with us?

2013-01-16 Thread Andy Wardley
On 15/01/2013 21:57, Sean McAfee wrote: Does anyone know if Template Toolkit creator Andy Wardley is still around? /me waves Sorry Sean, I've been very busy. I've got quite a backlog of unanswered messages in my inbox (if it's any consolation, yours was tagged as important and rendered

Re: [Templates] Accessing template variables after process

2012-06-20 Thread Andy Wardley
Hi Daniel, is there a way to access the (modified) template variables from perl script after calling process? In short, no. However, you can pass in a reference to a hash array that your templates can modify. Your Perl code would look something like this: my $exports = { };

Re: [Templates] Collecting snippets

2012-06-13 Thread Andy Wardley
On 13/06/2012 15:22, Dave Howorth wrote: I'm sure there must be a way to do this, and I'm guessing it probably involves WRAPPER, but my brain is fried. Can anybody give me a hint? Hi Dave, You could have a PRE_PROCESS template define a list for keywords and a MACRO to add a keyword to it:

Re: [Templates] Windows line endings (was: no subject)

2012-04-04 Thread Andy Wardley
On 04/04/2012 14:03, Alex Zwinge wrote: The issue is that when the template is rendered and outputted to a file tt seems like it's adding a bunch of extra line breaks between the lines. So for example if in my template I have These might help:

Re: [Templates] ttree linking files

2012-02-08 Thread Andy Wardley
On 08/02/2012 09:04, Johan Vromans wrote: Some time ago I submitted a feature request ( + patch ) for ttree. Hi Johan, Sorry, I must have missed that one. Attached is the patch updated to version 2.24. It fits smoothly, doesn't affect any existing code, even contains docmentation ;) Any

[Templates] Version 2.24 released

2012-02-07 Thread Andy Wardley
Template Toolkit version 2.24 is on its way to CPAN. If you're impatient you can fetch it from here: http://template-toolkit.org/download/Template-Toolkit-2.24.tar.gz #--- # Version 2.24 - 8th February 2012

[Templates] Version 2.23 released

2012-01-21 Thread Andy Wardley
I've just pushed version 2.23 to CPAN. This includes a bug fix for the XS Stash that causes problems with third party modules that use string eval (e.g. DateTime). It should be on CPAN RSN. It can also be downloaded here: http://tt2.org/download/Template-Toolkit-2.23.tar.gz In other

Re: [Templates] Status of TT3?

2011-09-26 Thread Andy Wardley
Chris Travers wrote: I was wondering what the status of TT3 is. I haven't been able to find any info that looks current. Hi Chris, There hasn't been much progress of late (this year in fact) due to work commitments on my part (not to mention various other bits of shit that life's thrown at

Re: [Templates] Putting an assertion into a TT Template.

2011-08-19 Thread Andy Wardley
On 19/08/2011 14:44, Andrew Black wrote: Toby's solution is the sort of thing I am looking for but I can't see how to send to STDERR http://template-toolkit.org/docs/manual/Filters.html#section_stderr Like so: [% some_content | stderr %] Or if you prefer: [% some_content FILTER

Re: [Templates] TT3 development…?

2011-07-07 Thread Andy Wardley
On 07/07/2011 17:37, Felipe Gasper (cPanel) wrote: According to GitHub, there haven’t been any commits for a year and a half…I’m just curious, what is the status of TT3? Yes, that's right. I got the Perl implementation as far as a working prototype and then started porting the whole

Re: [Templates] convert to lower case in an expression?

2011-03-02 Thread Andy Wardley
On 01/03/2011 22:18, Sean McAfee wrote: If you're not aware, it's quite easy to add your own vmethods: http://tt2.org/docs/manual/VMethods.html#section_Defining_Custom_Virtual_Methods I looks like I never got around to documenting the define_vmethod() method. Mea culpa. My preferred way

Re: [Templates] Hi I'm lazy... JSON plugin

2010-08-09 Thread Andy Wardley
On 08/08/2010 16:35, Dave Cross wrote: When searching for Perl modules, don't use Google - use CPAN. http://search.cpan.org/ Firefox Protip: go to search.cpan.org, click on the icon to the left of the search box on the firefox toolbar and select Add SearchCPAN from the menu. Then you can

Re: [Templates] Template plugin naming question

2010-07-26 Thread Andy Wardley
On 26/07/2010 01:27, A. Sinan Unur wrote: I would like to upload it to CPAN but I do not want to trample on the Template::Plugin namespace without checking first. Is that name OK? Yep, that works for me. Cheers A ___ templates mailing list

Re: [Templates] confused by CONFIGs

2010-07-23 Thread Andy Wardley
On 23/07/2010 00:09, Benjamin Hitz wrote: I set the following: my $tt = Template-new( { INCLUDE_PATH = Config::File-new()-www_stem.'templates/Reports/LocusReport/InteractionServer', TEMPLATE_OPTIONS =

Re: [Templates] Scoping puzzle with WRAPPER MACRO

2010-06-08 Thread Andy Wardley
On 08/06/2010 07:10, Paul Makepeace wrote: What's the best way of doing this? If my approach is wrong I can change that too. Hi Paul, I usually have a PRE_PROCESS template (e.g. site/config) which does something like this: [% USE Date; USE YAML; USE SomeOtherPlugin; PROCESS

Re: [Templates] manage events with tt2

2010-06-08 Thread Andy Wardley
On 08/06/2010 07:23, dark0s wrote: I have two radio buttons and two template file in '/templates/lib'. I want add to html code first template if I choice first radio button and second if I choice second radio button. Can tt2 manage simple javascript event like onclick? Not by itself,

Re: [Templates] another replace interpolation problem

2010-04-21 Thread Andy Wardley
On 21/04/2010 14:51, Travis Basevi wrote: [% a = 'this problem will cost me $50 million to fix'; b = 'WARNING:_err_'; b.replace('_err_', a); %] The '$50' is being interpreted as a back-reference to the 50th set of capturing parens (of which there are none). Escaping the '$' with a backslash

Re: [Templates] another replace interpolation problem

2010-04-21 Thread Andy Wardley
Travis Basevi wrote: Yes, I know that solution, Sorry, I totally missed that in your original message. but lets say the text comes from a database or some other source rather than being hardcoded in the template. Is there a more general/correct solution than something along the lines of:

Re: [Templates] executing an external perl program as a FILTER

2010-03-04 Thread Andy Wardley
On 05/03/2010 04:43, Jim Battle wrote: Question #1: what is the mechanism to add another directory for searching for plugins? ttree --perl5lib c:\path\to\lib Question #2: [% PERL %] sub mycrunch { ... } [% END %] Code written in a PERL block gets re-evaluated

Re: [Templates] executing an external perl program as a FILTER

2010-03-01 Thread Andy Wardley
Hi Jim, I think the best thing you can do is to move the Perl code out of the template. You can define a css_minify filter using a plugin like so (untested): package Template::Plugin::CSSMinify; use base 'Template::Plugin'; sub new { my ($class, $context, $config) = @_;

Re: [Templates] Date and Time Template tool kit

2010-02-03 Thread Andy Wardley
:36'. I just checked in a fix for that, so you might want to grab the latest version from git: http://github.com/abw/Badger Cheers A #!/usr/bin/perl # # Perl script to demonstrate Badger::Timestamp # # Written by Andy Wardley http://wardley.org/ # # 10 June 2009 # use Template; use Badger

Re: [Templates] passing information back from templates

2010-01-22 Thread Andy Wardley
On 21/01/2010 23:19, E R wrote: Actually, it seems that using just one more layer of indirection works: $vars = { foo = { bar = 'original foo.bar' }}; That'll do the trick. Another approach is to pass in an object or function which the templates can call. e.g. (untested) my @images;

Re: [Templates] The Badger Book

2010-01-15 Thread Andy Wardley
On 15/01/2010 10:46, Dermot wrote: particularly as Andrew described TT2 as 'stinking of piss' recently Nah, just smells of piss, not stinks of piss. I said it (with tongue in cheek) in the context of TT2 being 10 years old, which I reckon must be about 120 in internet years. She's old, a bit

Re: [Templates] PROMPT directive?

2010-01-02 Thread Andy Wardley
Alan Evans wrote: I am new to Template Toolkit so please excuse me if I am asking a rudimentary question but what about a PROMPT directive that when used with tpage or ttree would allow dynamic content to be queried from the user. Hi Alan, Yes, that's something I've wanted myself from time to

Re: [Templates] Problem with META

2010-01-02 Thread Andy Wardley
Oleg Kostyuk wrote: === root/src/q1.tt2 === [% META title = 'Q1' %] Q1 === root/src/q2.tt2 === [% PROCESS q2_processed.tt2 %] [...] for q2 page: $VAR1 = bless( {'_DEFBLOCKS' = {},'_BLOCK' = sub { DUMMY },'modtime' = 1262127822,'name' = 'q2.tt2','_HOT' = 0}, 'Template::Document'

Re: [Templates] TT3 is alive!

2010-01-02 Thread Andy Wardley
Kiffin Gish wrote: On the download page http://tt3.template-toolkit.org/download.html you write Do Badger first, then TT3. However, running make test on Badger fails with t/app/app.t Can't locate Template/TT3/Class.pm Oops. My bad. Fixed now. Ta A

[Templates] TT3 is alive!

2009-12-24 Thread Andy Wardley
I'm pleased to report that TT3 has built its first web site. In true eating-your-own-dog-food style, the first web site that it built was its own. http://tt3.template-toolkit.org/ Please be aware that TT3 is pre-alpha code. That means: * Nothing is guaranteed to work * Nothing that works

Re: [Templates] Extracting strings for localization.

2009-12-20 Thread Andy Wardley
On 21/12/2009 04:24, Bill Moseley wrote: What I'm wondering is if I can get the Template parser to build me list of all strings parsed from quoted strings in the template. Hi Bill, Yes, you can, but Clint's already done it. See this message:

Re: [Templates] using a '.' in a variable

2009-12-10 Thread Andy Wardley
Robin Smidsrød wrote: Hi, [% ${my.var} %]. Not quite. You also need quotes around the inner part: Hi, [% ${'my.var'} %]. A @Robin: sorry for the duplicate I didn't CC it to the list first time around ___ templates mailing list

Re: [Templates] Single object list problem by VMethods

2009-12-10 Thread Andy Wardley
On 10/12/2009 10:52, petr.danih...@zf.com wrote: 1) Did I understand TT behavior correctly? Yes. I'm afraid so. 2) What is the reason for such behavior? Isn’t there any way in Perl to determine whether item an object or a hash ref is? It's one hideous hack after another layered on top of an

Re: [Templates] webpage

2009-08-07 Thread Andy Wardley
On 06/08/2009 17:15, Jim Spath wrote: What's up with http://template-toolkit.org/ ? I screwed up the DNS a few weeks back and didn't realise. Everything carried on working until the secondary caches expired some time last night. I've fixed the problem so it should be coming back just as soon as

Re: [Templates] idea: lexically scoped variables

2009-08-02 Thread Andy Wardley
E R wrote: I'm not using the latest version of TT, so maybe this is already implemented. Not in TT2, but yes in TT3. The TT2 parser is rather inflexible and making changes to the grammar is decidedly non-trivial. It's the reason why I've completely re-written it all for TT3 (several times

Re: [Templates] finding all template variable references

2009-07-31 Thread Andy Wardley
ER wrote: After compiling a template, Is there a way to get a list of all variables that it references? It seems that this is something the compiler could keep track of if it doesn't already. Hi ER (love your show on TV, BTW :-) I've just checked in a patch that does this.

[Templates] TT Version 2.22 Released

2009-07-21 Thread Andy Wardley
The latest official version of the Template Toolkit is on its way to CPAN. You can also get it here: http://tt2.org/download/Template-Toolkit-2.22.tar.gz Other than the new version number and a few disabled tests, this is the same as v2.21_02. The summary of changes since 2.21 follows.

Re: [Templates] Using DateTime overload in Template Toolkit causes process to exit() on 64-bit platforms

2009-07-21 Thread Andy Wardley
Update for the list... It's beginning to look like DateTime is in the clear and the problem is caused by a string eval in a Perl subroutine called from the XS Stash. https://rt.cpan.org/Ticket/Display.html?id=47929 I've created a small distribution that contains some failing tests and a

Re: [Templates] RT Ticket 47850 and attached patch

2009-07-20 Thread Andy Wardley
On 20/7/09 14:11, John Napiorkowski wrote: I guess it needs something like: First of all, make sure that your template files define a Byte Order Mark (BOM, see Lhttp://en.wikipedia.org/wiki/Byte_Order_Mark). Yes, I think the best thing here is to re-write the docs to have basic URLs

[Templates] Developer version 2.21_01 released (Win32 test fixes)

2009-07-04 Thread Andy Wardley
I've released a new developer version 2.21_01 to fix some of the annoying test failures on Win32. Unless you're one of the unfortunate souls using Windows then this shouldn't affect you. It also removes the Template::Plugin::Autoformat module which is now available separately from CPAN. It

[Templates] Developer Release v2.21_02

2009-07-04 Thread Andy Wardley
There's another developer release on its way to CPAN or available from here: http://tt2.org/download/Template-Toolkit-2.21_02.tar.gz This fixes all known bugs (well, all those that were reported via rt). https://rt.cpan.org/Dist/Display.html?Queue=Template-Toolkit (look quickly while the

[Templates] Template Toolkit v2.21 released

2009-06-30 Thread Andy Wardley
Version 2.21 is released by popular demand (hi Stuart :-) It's on its way to CPAN or you can get it from here. http://tt2.org/download/Template-Toolkit-2.21.tar.gz My apologies for the delay. There's a UTF8 bug in the XS Stash[*] that I wanted to fix before releasing 2.21, but it's proving

Re: [Templates] comparing times from MySQL date format

2009-06-10 Thread Andy Wardley
seconds (epoch_time()) and 600 it yourself. For anything more substantial, DateTime is probably your best bet. Cheers A #!/usr/bin/perl # # Perl script to demonstrate Badger::Timestamp # # Written by Andy Wardley http://wardley.org/ # # 10 June 2009 # use Template; use Badger::Timestamp; my

Re: [Templates] Error objects

2009-06-10 Thread Andy Wardley
Clinton Gormley wrote: Yeah, I wasn't expecting it to happen for TT2 - more of a request for TT3 really Hi Clinton, Short answer: Yes, I've been burned by this myself. Long answer follows... Although, it could be implemented in such as way that two new error types eg 'file_missing' and

Re: [Templates] Still can't get eval_perl working...

2009-05-26 Thread Andy Wardley
On 26/5/09 19:20, Stabinger, John wrote: I'm sorry to be such a pain (and/or sound like a newb) but I just cannot get eval_perl set. Anyway, I've attached my config file to this email (in txt format) in case anyone can (or has time to!) take a look and advise. Keep in mind that this isn't my

[Templates] Developer Release 2.20_4

2009-05-21 Thread Andy Wardley
TT releases are like buses... [% INSERT punchline %] Developer release 2.20_4 is out. This one fixes some problems under Perl 5.6.2, applies a couple of additional patches and adds a few useful methods to Template::Iterator. Usual story. Fetch it from CPAN or here:

Re: [Templates] Stash.xs - unicode issues with 'length'

2009-05-20 Thread Andy Wardley
On 18/5/09 19:21, Alexey A. Kiritchun wrote: See the attached patch (against my system's 2.14, but should apply to the trunk) and test case. Hi Alexey, Patch applied, many thanks. A ___ templates mailing list templates@template-toolkit.org

[Templates] Developer Release 2.20_3

2009-05-20 Thread Andy Wardley
Hey ho. I introduced another bug into the XS Stash with the last patch that made it fail to compile on threaded Perls. Thanks to Slaven Rezic and the CPAN testers, the problem got picked up pretty quickly. It's fixed now and there's a new developer release out, v2.20_3 (and I've got Yet Another

[Templates] Memory leak in XS Stash 2.20/2.20_1 - fixed in developer release 2.20_2

2009-05-18 Thread Andy Wardley
There's a memory leak in the XS Stash in v2.20. It's a small leak (one, maybe two SVs when you call a list method on a single item), but a leak nonetheless. https://rt.cpan.org/Ticket/Display.html?id=46058 The bug was introduced between 2.19 and 2.20. Jess Robinson provided a patch for the Perl

Re: [Templates] Noob question

2009-05-17 Thread Andy Wardley
On 17/5/09 01:39, Ralph wrote: The tutorial examples seem to assume a one-to-one correspondence between template pages and output pages. What I'm after is being able to use a single template page, and a data file, to generate a separate html page for each name in the data file. Hi Ralph,

Re: [Templates] Called UNIVERSAL::can() as a function, not a method

2009-05-12 Thread Andy Wardley
Chisel Wright wrote: The module in question appears to use UNIVERSAL::can() UNIVERSAL:can is evil and should be killed with fire. :-) but I'm not sure why this has far reaching effects out to the Template code. It monkey-patches the UNIVERSAL module (from which everything inherits) and

Re: [Templates] Called UNIVERSAL::can() as a function, not a method

2009-05-12 Thread Andy Wardley
On 12/5/09 12:27, Chisel Wright wrote: They did all pass: Fair enough, patch applied. http://template-toolkit.org/svnweb/Template2/revision/?rev=1201 Thanks Chisel. That'll get the UNIVERSAL::can() crowd off my back :-) Cheers A ___ templates

Re: [Templates] Missing semicolon doesn't result in parse error.

2009-05-09 Thread Andy Wardley
On 30/4/09 13:21, Randal L. Schwartz wrote: Ahh, yes. TT3 which will come bundled standard as part of Perl6 or Duke Nukem Forever. :) It looks like it'll have to be Perl6 then. http://www.shacknews.com/featuredarticle.x?id=1127 A ___ templates

Re: [Templates] Problem with TT's substitution filters, uri and url

2009-05-08 Thread Andy Wardley
On 8/5/09 09:08, kakim...@tpg.com.au wrote: using | uri === - passes W3C validation You should only use the uri filter for encoding query values in the url. e.g. [% term = 'Ben Jerry' %] a href=http://foo.com/search?term=[% term | uri %].../a This generates: a

Re: [Templates] Problem with TT's substitution filters, uri and url

2009-05-08 Thread Andy Wardley
On 8/5/09 10:08, Andy Wardley wrote: [% USE search = URL('http://foo.com/search') %] a href=[% search_link(term=Ben Jerry, page=20) %]GO/a ^ Oops. There's one _link too many in that. It should be: [% USE search = URL('http://foo.com/search

Re: [Templates] extra ^Ms in output files on Windows

2009-04-23 Thread Andy Wardley
Dustin Frazier wrote: Anyone have any idea A) what's going on, and/or B) how best to debug this? Hi Dustin, I can offer some insight into why this is happening now. From the CHANGES file: ttree - * Applied patch from Lyle Brooks to add binmode to the process() call in ttree.

Re: [Templates] Patch: recursive ttree processing

2009-04-09 Thread Andy Wardley
Lyle Brooks wrote: I agree it could be dangerous if used incorrectly, but it also can be quite powerful. I don't think it's any more dangerous than the -s option. And after all, ttree is a tool for processing template trees, so it's very much in keeping with its original purpose. I applied

[Templates] Developer Release 2.20_1

2009-04-07 Thread Andy Wardley
I've just released version 2.20_1 which is a developer pre-release for 2.21. It's on its way to CPAN. In the mean time you can download it here. http://tt2.org/download/Template-Toolkit-2.20_1.tar.gz This release was prompted by my public shaming: http://perlmonks.org/?node_id=755790

Re: [Templates] verbose flag -- too granular?

2009-04-07 Thread Andy Wardley
Jim Battle wrote: What I'd like most of the time is a middle position -- report only newly created directories and files, modified files, and errors. [...] Locally I've made an ugly patch to add a new flag, minverbose. Here is the patch for my two minute quick and dirty fix: Hi Jim,

Re: [Templates] Patch for Template::Iterator::get_all

2009-04-07 Thread Andy Wardley
Jonathon Padfield wrote: The comments in code for Template::Iterator::get_all indicate it should work without needing to call get_first first. It's a little cumbersome to create an iterator, call get_first, then call get_all, and then combine the values. So here's a small patch so that

Re: [Templates] Template::Test trivial incompatiblity with TAP

2009-04-07 Thread Andy Wardley
Andrew Ford wrote: Here is a patch: Darn. Why is there always one patch that I find just *after* I make a release? :-) Oh well, it's in for next time. Thanks Andrew. A ___ templates mailing list templates@template-toolkit.org

Re: [Templates] Patch: add a built-in filter for xml entities

2009-04-07 Thread Andy Wardley
Robin Berjon wrote: I use TT almost exclusively to produce XML (even if it's XHTML), and there's a small missing bit that's been annoying me: it has no built-in way of escaping XML's built-in entities. [...] Either way, tell me if you like it or not so I know if I have to go about it some

Re: [Templates] Captchas

2009-02-17 Thread Andy Wardley
Kelly Thompson wrote: So if I don't use captchas (having tons of trouble with all of them, due to dependencies, and being on a shared host) what is a good text method? Or any method actually that will help with spam, and DOS attacks... Another approach is to put a honeypot field in the form.

Re: [Templates] The ghost of templates future

2009-02-16 Thread Andy Wardley
Hi Sean, The way I normally approach this is to have a PRE_PROCESS config file which does something like this: [% page = { headers = [ ] } %] Then in the main template, or a template called from it, you can write: [% page.headers.push('script .../') %] The final

Re: [Templates] Captchas

2009-02-16 Thread Andy Wardley
Ask Bjørn Hansen wrote: recaptcha.net makes Captchas that aren't completely impossible to use (and have audio support etc) and at the same time they have strong security. They also have the benefit of helping to digitise books in the process. http://recaptcha.net/learnmore.html There's

Re: [Templates] Tests for defined nested hash

2008-11-13 Thread Andy Wardley
Todd Rinaldo wrote: We have a situation where we needed to render a template where the Template object was created with {TOLERANT = 0, EVAL_PERL = 0}. Hi Todd, Those are the default values for both those options, and they don't have any bearing on this issue anyway. So you don't need to worry

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Andy Wardley
Kelly Thompson wrote: I suggest you move the DBI interaction into the perl, script. Just a thought... For most applications, yes, a clear separation of concerns is a Good Thing[tm]. But then the DBI plugin exists specifically for those occasions when you can't, don't want to, or don't need to

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Andy Wardley
Josh Rosenbaum wrote: My guess is that the execute() routine does not handle an arrayref being passed Your guess would be correct. My bad. Possible Solutions: *) Get Andy to fix it I've committed a fix to the subversion repository.

Re: [Templates] SVN for Template-Toolkit unavailable?

2008-11-10 Thread Andy Wardley
T.G. Mutato wrote: svn co svn://svn.tt2.org/Template-Python/trunk Template-Python Sorry, that should be: svn co svn://svn.tt2.org/tt/Template-Python/trunk Template-Python ^^ My bad. I'll fix the web site ASAP. By coincidence, I'm in the process of moving the

Re: [Templates] How do I find out why unique doesn't seem to be working.

2008-10-27 Thread Andy Wardley
M wrote: It all works fine apart form the uniquing stage which does nothing That's most puzzling. list.unique definitely works (for the definition of works that I just tried): [EMAIL PROTECTED] ~] tpage [% list = [10 20 10 11 1 20 21 'foo' 'Foo' 'bar' 'foo']; list.unique.join

Re: [Templates] Upgraded to perl 5.8.8 and TT 2.20 and now every line has a trailing CR

2008-10-24 Thread Andy Wardley
Jim Battle wrote: The new html has a bonus CR on each and every line of output. In vim it appears not as double spaced lines, but as a ^M at the end of each line. vim says fileformat=dos. Hi Jim, Sorry to hear about your problems. This is using ttree, right? I believe what you're

Re: [Templates] Nested tags issue with creating useful SQL queries in simple Template.#

2008-10-24 Thread Andy Wardley
M wrote: [% query = DBI.prepare('SELECT * FROM customer ORDER BY ?') %] [% FOREACH customer = query.execute('$baz') %] That should be: [% FOREACH customer = query.execute(baz) %] Like Perl, TT doesn't interpolate variables inside 'single quotes'. You need to use double quotes if you want

Re: [Templates] Restricting available directives

2008-10-20 Thread Andy Wardley
Perrin Harkins wrote: If performance is a consideration, Sean's will be better than using AUTOLOAD. One of my favorite tricks in this situation is to have the AUTOLOAD generate the method (or in this case, alias to it) the first time it is called. Then you get the benefit of auto-generated

Re: [Templates] ttree fails to recurse subdirectories in TT 2.20

2008-09-24 Thread Andy Wardley
Dave Miller wrote: We picked up the upgrade to perl-Template-Toolkit 2.20 off rpmforge last night, and our website build scripts that use it failed to recurse subdirectories when building the website. Hi Dave, From the Changes: ttree - * Changed the --accept option in ttree to match

Re: [Templates] Upgrading from 2.19 to 2.20 problems

2008-09-24 Thread Andy Wardley
Oleg Burlaca wrote: I see that 2.19 wasn't replaced by 2.20, what should I do to fix this? Hi Oleg, Is it possible that you installed 2.19 with the XS Stash enabled and 2.20 without it (or perhaps the other way around)? It looks like Perl is getting confused between versions. If 2.20 works

Re: [Templates] Performance documentation

2008-09-24 Thread Andy Wardley
Chris Travers wrote: Any idea where I can find performance information for Template Toolkit? Hi Chris, Have a look at Template::Timer: http://search.cpan.org/~petdance/Template-Timer-0.04/Timer.pm Unless you're doing something computationally expensive (in which case, you're better off

Re: [Templates] loop first, loop last in current version

2008-09-22 Thread Andy Wardley
Sean McAfee wrote: sub tokenise_directive { my $self = shift; my $tokens = $self-SUPER::tokenise_directive(@_); for (my $i = 0; $i @$tokens; $i += 2) { if ($tokens-[$i] eq 'LAST' $i 0 $tokens-[$i-2] eq 'DOT') { splice @$tokens, $i, 2, 'IDENT', 'last'; } }

Re: [Templates] Copyright notice for Template-Python

2008-09-18 Thread Andy Wardley
the original copyright message. Something like this: The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008, derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved. Strictly speaking, you should include the copyright notice

Re: [Templates] Call a macro by reference

2008-09-17 Thread Andy Wardley
Michael Wichmann wrote: I hope there is a way :-) Hi Michael, There is. You can take a reference to something using a backslash. html = { checked = \checked } This feature is officially undocumented, but it's been in TT2 so long now that it's not going away. So it's safe to

Re: [Templates] Meet the Badger (TT3's half-cousin) Redux

2008-09-09 Thread Andy Wardley
Hi Stevan, Thanks for taking the time to set me straight. I apologise for making such a bad job of comparing the two. I can assure you that it was only my own ignorance at fault and no malice was intended. I hope I didn't cause any offense. After writing that message I did a little more digging

Re: [Templates] Meet the Badger (TT3's half-cousin)

2008-09-02 Thread Andy Wardley
Bill Cowan wrote: For your consideration, why invent new modules when *existing *would seem to work? Hi Bill, Good question. In fact that's now #2 on the good questions list. http://badgerpower.com/docs/FAQ.html#section_Is_Badger_Re_Inventing_Wheels_ I'll also elaborate a bit on your

Re: [Templates] Meet the Badger (TT3's half-cousin)

2008-08-29 Thread Andy Wardley
Jason Gottshall wrote: Looks cool, Andy. At the risk of sounding ignorant, can you help me understand how Badger differs from Moose[1]? (other than height, weight, diet, coloration, presence of antlers, and Linnaean taxonomy, of course :-) That's a good question. Unfortunately you've used

Re: [Templates] question for iterating over array

2008-08-29 Thread Andy Wardley
Stefan Wehinger wrote: [% FOREACH setting IN parameters.keys %] [% DO STUFF HERE - about 100 lines %] [% END %] Hi Stefan, try this: [% FOREACH key IN order_of_keys; setting = parameters.$key %] [% DO STUFF HERE - about 100 lines %] [% END %] HTH A

[Templates] Meet the Badger (TT3's half-cousin)

2008-08-28 Thread Andy Wardley
Badger is a toolkit for building Perl applications. It contains all the generic bits of TT3 and a few other things thrown in for good measure. It provides a set of foundation classes upon which applications (like TT3) can be built. It's free, 100% pure Perl and dependency free for portability

Re: [Templates] hash key interpolation

2008-08-28 Thread Andy Wardley
Dylan William Hardison wrote: Spake Michael Lackhoff on Tuesday, August 12, 2008 at 03:26PM +0200: Here is what I tried: [% msg.${'htmlhead_title_' _ conf.location} %] [% msg.htmlhead_title_${conf.location} %] I believe you want the item() vmethod: [% msg.item('html_title_' _

Re: [Templates] TAG_STYLE, START_TAG, END_TAG

2008-08-26 Thread Andy Wardley
Sean Allen wrote: Back to caching, as I'm a little unclear when caching gets defeated: If you pass TT a template as a string (including anything going via eval), the it has to re-parse it each time. how is the caching different? does it cache a compiled template for each different file that

Re: [Templates] TAG_STYLE, START_TAG, END_TAG

2008-08-24 Thread Andy Wardley
Dave Cross wrote: Let's not get into this debate. It never ends with everyone satisfied. Agreed. I'm invoking the Holy War Avoidance Protocol (HWAP). Any further transgressions and I shall be forced, once the number three (being the number of the counting) be reached, to lobbeth the Holy Hand

Re: [Templates] Makefile.PL will no longer install examples, libraries, HTML docs, etc

2008-08-14 Thread Andy Wardley
Clinton Gormley wrote: The only bit I use a lot (at all) are the local HTML docs - they're very handy. More handy than having them remotely available, but if they were available with an optional download, that would be a good compromise. Now available from here.

[Templates] Template Toolkit v2.20 released.

2008-08-13 Thread Andy Wardley
I've squashed the last bug and tested it on all the platforms I can lay my hands on. v2.20 is released. It should be appearing on CPAN soon. In the mean time, you can get it here: http://tt2.org/download/Template-Toolkit-2.20.tar.gz This version fixes all known bugs (that are fixable).

[Templates] Developer release 2.19_03

2008-08-12 Thread Andy Wardley
And another... http://tt2.org/download/Template-Toolkit-2.19_03.tar.gz A ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Developer release 2.19_02

2008-08-11 Thread Andy Wardley
Éric Cholet wrote: -$binmode ? {binmode = $binmode} : undef) +$binmode ? {binmode = $binmode} : {}) and +'template_encoding|encoding=s', + --encoding=value Set encoding of input files Thanks Éric, both applied. A

[Templates] Developer release 2.19_02

2008-08-08 Thread Andy Wardley
Here's another developer version. This fixes a couple of minor installation problems and improves the kwalitee. It's also on its way to CPAN. http://tt2.org/download/Template-Toolkit-2.19_02.tar.gz A ___ templates mailing list

Re: [Templates] [patch] Template::Plugin::Date accept Y-M-D H:M:S

2008-08-07 Thread Andy Wardley
Fayland Lam wrote: when will a new release kick out? No-one has come forward with anything I've missed so I'll be kicking out a developer release in the next hour or so. A ___ templates mailing list templates@template-toolkit.org

[Templates] TT3 scalar/list context (was: allow undefined values in Stash)

2008-08-07 Thread Andy Wardley
Paul Seamons wrote: This is another plug for Andy to simplify scalar, smart, and list contexts using the Perl 6 @() and $(). Yes, the plug has been plugged in and the volume turned up to eleven. To recap what I said here:

Re: [Templates] TT3 scalar/list context

2008-08-07 Thread Andy Wardley
Ash Berlin wrote: On 7 Aug 2008, at 11:33, Andy Wardley wrote: list_ref = @feed_me() # [10, 20, 30] This too me isn't what I'd expect it to do - I'd expect that to behave like : (list_ref,_,_) = @feed_me() Yes, I agree that one's a bit weird. I wasn't sure about

[Templates] Makefile.PL will no longer install examples, libraries, HTML docs, etc

2008-08-07 Thread Andy Wardley
Is anyone likely to object strongly if I remove all the installation of all the extra cruft from the Makefile.PL? Things like HTML docs, various template libraries, examples, etc. The HTML docs have been superceded by what's on the web site (which I'll bundle into a separate dist some time RSN

  1   2   3   4   5   6   7   8   >