Re: [Templates] Improving performance with TT2

2012-02-19 Thread Perrin Harkins
2012/2/19 Frédéric Buclin lpso...@netscape.net: We at Bugzilla are heavily using Template Toolkit to generate all our templates dynamically. But when doing some profiling with Devel::NYTProf, it appears that TT2 is taking most of the time when processing a CGI script. This means that some

Re: [Templates] Improving performance with TT2

2012-02-19 Thread Perrin Harkins
On Sun, Feb 19, 2012 at 4:20 PM, Perrin Harkins per...@elem.com wrote: [ Please keep replies on the list. ] 2012/2/19 Frédéric Buclin lpso...@netscape.net: Le 19. 02. 12 21:57, Perrin Harkins a écrit : That is slow!  Are you talking about actual CGI, or are you running in a persistent

Re: [Templates] CGI example

2012-02-17 Thread Perrin Harkins
On Fri, Feb 17, 2012 at 5:51 PM, Bill McCormick wpmccorm...@gmail.com wrote: Yes, I think that's what I'm looking for, except for the part where (it seems) he leaves out a lot of details; like there see to be no examples of DB updates via CGI. If you don't know how to update a database in Perl

Re: [Templates] sudo cpan XML::Template

2011-07-27 Thread Perrin Harkins
On Wed, Jul 27, 2011 at 2:03 PM, Oliver Ruebenacker cur...@gmail.com wrote:  I'm confused. TT website talks about the module XML::Template, but cpan does not know that module, but instead a lot of modules that start with XML::Template. The distribution is called Template::XML, and the module

Re: [Templates] File Access from mod_perl2

2011-03-31 Thread Perrin Harkins
2011/3/31 Ta hello200...@yahoo.co.jp: The file exists , and its the same code from the book... The most likely problem is permissions. Try becoming the user who the web server runs as and reading the file. There may be a problem with permissions on an enclosing directory. - Perrin

Re: [Templates] Filter and Hashref

2010-05-24 Thread Perrin Harkins
On Mon, May 24, 2010 at 11:16 AM, E R pc88m...@gmail.com wrote: An alternative would be to implement myfilter as a virtual method and use: [% myhashref.myfilter %] I usually prefer to just pass a reference to a sub in the stash and use it in templates: [% myfilter(myhashref) %] - Perrin

Re: [Templates] INCLUDE, PROCESS, and template compilation

2010-05-20 Thread Perrin Harkins
On Thu, May 20, 2010 at 12:30 PM, Felipe Gasper (cPanel) fel...@cpanel.net wrote: The INCLUDE and PROCESS directives result in Perl code (in the compiled template) that goes to the filesystem and retrieves the INCLUDEd/PROCESSed template at runtime. Only if you've never run this template

Re: [Templates] Fragment caching

2010-01-21 Thread Perrin Harkins
On Thu, Jan 21, 2010 at 4:26 AM, Tobias Kremer tobias.kre...@gmail.com wrote: I'm aware of Template::Plugin::Cache, but I don't like the fact that fragments I'd like to cache have to be included. I'd rather have fragments take care of caching themselves, like Mason's cache_self() method. I

Re: [Templates] passing information back from templates

2010-01-21 Thread Perrin Harkins
On Thu, Jan 21, 2010 at 5:17 PM, E R pc88m...@gmail.com wrote: When using a simple hash for the template variables object, it doesn't seem that a template can modify it, e.g. Is this a physics experiment? The data changes when it is observed? Seriously, it sounds like you're trying to do

Re: [Templates] cache TT's output

2009-09-06 Thread Perrin Harkins
On Sun, Sep 6, 2009 at 3:39 PM, R. Hickssigz...@gmail.com wrote: On 9/2/09 5:34 AM, Jeff Pang wrote: Hello, We're using Template.pm under modperl2. How can we cache TT's output? I mean it won't read and load files from disk each time. Thanks.

Re: [Templates] comparing times from MySQL date format

2009-06-10 Thread Perrin Harkins
On Wed, Jun 10, 2009 at 9:23 AM, Tosh Cooeyt...@1200group.com wrote: My first instinct is to check date.now versus the second representation of the timestamp but I can't see how to make that conversion that using the Date plugin, nor does there seem to be a trivial way to accomplish this. It's

Re: [Templates] comparing times from MySQL date format

2009-06-10 Thread Perrin Harkins
! Thanks! Tosh Perrin Harkins wrote: On Wed, Jun 10, 2009 at 9:23 AM, Tosh Cooeyt...@1200group.com wrote: My first instinct is to check date.now versus the second representation of the timestamp but I can't see how to make that conversion that using the Date plugin, nor does there seem

Re: [Templates] Django-style extends directive?

2009-02-12 Thread Perrin Harkins
On Thu, Feb 12, 2009 at 7:17 AM, Chris Czub ashgromn...@gmail.com wrote: The extends block means, roughly, to take index.html and replace any blocks inside of it with the ones defined in the current file, photos.html. I do something similar in TT by varying the include path. I have default

Re: [Templates] TT2 and Plugin CGI: GET params are not being updated

2009-02-07 Thread Perrin Harkins
On Sat, Feb 7, 2009 at 5:07 AM, Marc Sebastian Pelzer m...@knusperfisch.de wrote: (I need this kind of URL2template matching for different reasons) and then started the build in web-server (./script/my_app_server.pl -d -p 8080). When I call the template for the first time with some 'test' GET

Re: [Templates] Restricting available directives

2008-10-20 Thread Perrin Harkins
On Mon, Oct 20, 2008 at 3:27 AM, Mihai Bazon [EMAIL PROTECTED] wrote: I rewritten it with AUTOLOAD, though not sure which one is better: If performance is a consideration, Sean's will be better than using AUTOLOAD. - Perrin ___ templates mailing list

Re: [Templates] Restricting available directives

2008-10-18 Thread Perrin Harkins
On Sat, Oct 18, 2008 at 3:39 PM, Mihai Bazon [EMAIL PROTECTED] wrote: Thanks. It's not very orthodox if you ask me, but it's a good solution, in lack of anything else. :-) There's a simple option for turning off the things considered dangerous, like EVAL. Including other template isn't

Re: [Templates] template toolkit and AUTOLOAD

2008-10-07 Thread Perrin Harkins
On Tue, Oct 7, 2008 at 5:03 PM, Matt Hucke [EMAIL PROTECTED] wrote: Is there any way to prevent TT from calling functions that don't exist and falling into AUTOLOAD? I think you want to implement can() in your module. - Perrin ___ templates mailing

Re: [Templates] template toolkit and AUTOLOAD

2008-10-07 Thread Perrin Harkins
On Tue, Oct 7, 2008 at 5:54 PM, Matt Hucke [EMAIL PROTECTED] wrote: I use can() within Autoload. I don't think that will help. I seem to recall that TT calls can() on your module to see if it should call the thing as a method or not. Implement can() in your module and see if it helps. Should

Re: [Templates] Performance documentation (Resolved)

2008-09-24 Thread Perrin Harkins
On Wed, Sep 24, 2008 at 2:56 PM, Chris Travers [EMAIL PROTECTED] wrote: Just letting everyone know, I believe I have resolve the performance problems in the template. The following two changes appear to have cut the time on the dev box from around 8 minutes to about 90 sec Certainly makes the

Re: [Templates] Performance documentation

2008-09-23 Thread Perrin Harkins
On Tue, Sep 23, 2008 at 4:02 PM, Chris Travers [EMAIL PROTECTED] wrote: Any idea where I can find performance information for Template Toolkit? You can use Devel::NYTProf to profile your code. I have a template which is taking forever to render and I am trying to find ways to speed it up.

Re: [Templates] LOAD_PERL parameter

2008-06-23 Thread Perrin Harkins
On Mon, Jun 23, 2008 at 3:10 PM, Keddie, Diane [EMAIL PROTECTED] wrote: Any reason why the default is 0? Security. Turning it on means you can load anything in @INC and call methods on it. - Perrin ___ templates mailing list

Re: [Templates] TT equivilent to Mason autohandler

2008-04-26 Thread Perrin Harkins
On Sat, Apr 26, 2008 at 4:38 AM, Aaron Trevena [EMAIL PROTECTED] wrote: Is there a TT equivalent to HTML::Masons autohandler, or a recipe that avoids needing it? WRAPPER is equivalent to what most people use autohandlers for. http://tt2.org/docs/manual/Directives.html#section_WRAPPER

Re: [Templates] TT equivilent to Mason autohandler

2008-04-26 Thread Perrin Harkins
On Sat, Apr 26, 2008 at 6:20 AM, Mihai Bazon [EMAIL PROTECTED] wrote: Now, in /admin/autohandler you can have the following: % if ($has_admin_privileges) { % $m-next_comp; # display admin page % } else { ... display login form ... % } When /admin/SOMETHING.html is requested, the

Re: [Templates] TT equivilent to Mason autohandler

2008-04-26 Thread Perrin Harkins
On Sat, Apr 26, 2008 at 9:19 AM, Andy Wardley [EMAIL PROTECTED] wrote: This is the bit that TT doesn't support. You have to define a single PROCESS template up front. You can't just drop a new one in a directory like you can with Mason. You sort of can. If you set the INCLUDE_PATH based

Re: [Templates] Ok, which filter do I need this time.

2008-04-21 Thread Perrin Harkins
On Sat, Apr 19, 2008 at 3:59 PM, Sherwood Botsford [EMAIL PROTECTED] wrote: Now when I move foo, all I need to do is update foolinklabel in the database, and all the links are fixed on the next build. This is a basic CMS feature that pretty much all of them have. I've never heard of

Re: [Templates] Ok, which filter do I need this time.

2008-04-21 Thread Perrin Harkins
On Mon, Apr 21, 2008 at 9:59 PM, Sherwood Botsford [EMAIL PROTECTED] wrote: So far TT2+Markdown has been a win-win, except for this cross link problem. Might as well try to extend Markdown or write your own plugin then. One of TT's best features is how easy it is to write a simple perl class

Re: [Templates] Passing $context to the providers, good or bad idea?

2008-02-19 Thread Perrin Harkins
On Feb 18, 2008 3:07 PM, Yann Kerhervé [EMAIL PROTECTED] wrote: My users can write templates (kind of...) and specify [% INCLUDE 'my:header.tt' %] I want my provider to know that 'header.tt' comes from one specific user and not another (to be able to load the correct one). I'd probably

Re: [Templates] Passing $context to the providers, good or bad idea?

2008-02-19 Thread Perrin Harkins
On Feb 19, 2008 2:35 PM, Yann Kerhervé [EMAIL PROTECTED] wrote: Yeah, I thought about that but it looked more complicated with the TT singleton instance I'm using It shouldn't be. If you're not sure how to change INCLUDE_PATH on an existing object, search the mailing list archive. and less

Re: [Templates] Passing $context to the providers, good or bad idea?

2008-02-18 Thread Perrin Harkins
On Feb 17, 2008 7:04 PM, Yann Kerhervé [EMAIL PROTECTED] wrote: If this is a bad idea, how could I do it differently (and correctly?) What are you trying to do that requires access to the context? - Perrin ___ templates mailing list

[Templates] amusing template engine story

2008-02-08 Thread Perrin Harkins
This one is Python, but I'm sure you all get the joke: http://www.codeirony.com/?p=9 - Perrin ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Dual pass template processing

2008-01-29 Thread Perrin Harkins
On Jan 29, 2008 3:39 PM, Mark Knoop [EMAIL PROTECTED] wrote: One of the features of my system is that one set of tags gets processed when the site is built ie the pages are prerendered to an extent. The rest of the tags then get processed at request time by my CGI script. The documentation

Re: [Templates] Findng Errors in Template files

2008-01-10 Thread Perrin Harkins
On Jan 10, 2008 8:27 AM, Clayton Scott [EMAIL PROTECTED] wrote: I believe that he's looking for a method of checking his templates for check for template syntax errors, essentially the equivalent of perl -c perlfile for perl syntax errors. I assumed he must already have tried running the

Re: [Templates] Findng Errors in Template files

2008-01-09 Thread Perrin Harkins
On Jan 9, 2008 2:59 PM, David Martin [EMAIL PROTECTED] wrote: I have a template with an error in it that I just can't seem to track down. What's the message you're getting? I seem to recall from years ago that there is a way to tell the TT compiler to compile the template file and in that way

Re: [Templates] Proposal - Add ADD_LOCAL_PATH configuration item.

2007-12-12 Thread Perrin Harkins
On Dec 12, 2007 11:35 AM, Paul Seamons [EMAIL PROTECTED] wrote: Using globals sometimes, sure - but nearly always? Ick. Well, you have to keep it persistent or the caching won't work. Only my persistent TT or TA object in a mod_perl situation has ever been global - I hardly ever use a

Re: [Templates] Proposal - Add ADD_LOCAL_PATH configuration item.

2007-12-11 Thread Perrin Harkins
On Dec 11, 2007 11:20 AM, Paul Seamons [EMAIL PROTECTED] wrote: From time to time I see people requesting allowing finding templates relative to the current template. I just responded to an email this morning with how to do so in Template::Alloy. I would propose having it as an option in

Re: [Templates] Proposal - Add ADD_LOCAL_PATH configuration item.

2007-12-11 Thread Perrin Harkins
On Dec 11, 2007 1:18 PM, Paul Seamons [EMAIL PROTECTED] wrote: If by easy you mean passing the current template object as a weakened reference to the closure, attempting to find the current path, manipulating the current path and adding it to INCLUDE_PATH, then you are right - it is easy. I

Re: [Templates] Storing compiled templates to memcached?

2007-09-09 Thread Perrin Harkins
On 9/9/07, Peter Hartzler [EMAIL PROTECTED] wrote: Right, they have to be in memory *while in use*. Then they can be forgotten, e.g., not cached in TT's cache, and when needed again, pulled from the one central copy provided by memcached. Well, yes, but you'd have to recompile them again

Re: [Templates] Enabling caching of templates under mod_perl?

2007-07-19 Thread Perrin Harkins
On 7/19/07, Andrew Light [EMAIL PROTECTED] wrote: The one thing I have to figure out now, is how to manage the global varialbe thing. To be honest, I have never heard about the Apache::Registry hack, I just pop in all of my regular CGI files in a mod_perl environment and don´t really have any

Re: [Templates] Performance cost of 'namespaces'

2007-05-03 Thread Perrin Harkins
On 4/25/07, Clinton Gormley [EMAIL PROTECTED] wrote: One of the issues that I am finding in my templates as they become more complex, is the problem of namespace collision, ie just remembering what variables I have used where, and whether using this variable name is going to cause problems at a

Re: [Templates] Template with mod_perl2

2007-01-15 Thread Perrin Harkins
michael higgins wrote: I was hoping you could expand a bit on your answers... Sure. Let me see if I can break it down for you, and give you some references for further reading. First, there's TT. It's a templating tool that takes a template and some data and merges them. It doesn't care

Re: [Templates] Re: Restricting access when RELATIVE is on

2007-01-14 Thread Perrin Harkins
Mihai Bazon wrote: That's exactly what I wanted to avoid. :-) I want to process a template relative to the current one. With HTML::Mason, for instance, I can say: ./foo to process a component relative to the current directory (which is the directory of the template that's currently

Re: [Templates] Template with mod_perl2

2007-01-12 Thread Perrin Harkins
On Fri, 2007-01-12 at 17:06 -0500, Jonathan Mangin wrote: What do I need to use TT with mod_perl2? You don't need anything. Go ahead and use it. I see Apache::Template but a CPAN install eventually tries to install modperl 1.29. That can't be right. If you want something to automatically

Re: [Templates] Flexible set of templates

2006-12-08 Thread Perrin Harkins
David Vergin wrote: That way, part of the development of a new template would be to document its data needs in a leading comment in the template itself or in the companion file. Then the rest would take care of itself. That last part is kind of key... I'm not sure exactly what problem you're

Re: [Templates] differentiating hash entries / methods with same name

2006-11-08 Thread Perrin Harkins
On Tue, 2006-11-07 at 14:47 +0100, Dami Laurent (PJ) wrote: Suppose an object $obj has both a hash entry $obj-{foo} and a method $obj-foo(). If I pass this object to a template, [% obj.foo %] performs a method call. Is there a way to access the hash entry instead? You could pass in a

Re: [Templates] Process vs Macro ?

2006-09-22 Thread Perrin Harkins
Evan Carroll wrote: Could someone please juxtapose PROCESS w/ ARGS, vs, MACRO? I'm confused as to which one to use. It's a matter of scope. If want to split out some repeated code that no other template will use, make it a MACRO in the current template. If you have something that other

Re: [Templates] Caching Output of Components

2006-08-11 Thread Perrin Harkins
On Thu, 2006-08-10 at 12:01 -0500, Stuart Johnston wrote: I thought about using ajax on those pages so they can be cached and update the user's name and menu on page load. But, I'm not ready to make javascript required yet. I assume the logged-in users are designated with a cookie?

Re: [Templates] Caching Output of Components

2006-08-11 Thread Perrin Harkins
On Fri, 2006-08-11 at 13:13 -0400, Buddy Burden wrote: We take our templates that have such substitutions and turn them into two pass generation templates. We use two different pairs of delimiters to distinguish between variables that can be substituted and then cached, and variables which

Re: [Templates] Lists and rand like http://faq.perl.org/perlfaq4.html#How_do_I_select_a_ra

2006-07-18 Thread Perrin Harkins
On Tue, 2006-07-18 at 19:52 +0100, Gavin Henry wrote: Well, this is for Catalyst, so it's classed as View logic, so I kept it in the template. Be that as it may, if you had written the logic in Perl, you would have known how to do it without asking. When you have to wonder how to do something

RE: [Templates] Template::Plugin::XML::Writer

2006-07-13 Thread Perrin Harkins
but I do see several problems with this approach: - It's not a template. In what sense? The example was pretty contrived but how I actually use it is to pass in a bunch of vars to substitute into the XML. Seems like a template to me. You could argue that any program that produces output

Re: [Templates] Two issues - Processing problem and caching problem (bug?)

2006-07-12 Thread Perrin Harkins
On Wed, 2006-07-12 at 10:12 -0500, Evan Kaufman wrote: # print content-type and process template $request-content_type('text/html'); $TT-process($request-filename(), { 'uri' = $request-uri }, $request ) || do { $request-log_reason( $TT-error() );

Re: [Templates] Two issues - Processing problem and caching problem (bug?)

2006-07-12 Thread Perrin Harkins
On Wed, 2006-07-12 at 13:48 -0500, Evan Kaufman wrote: I'm importing the constants: use Apache2::Const qw(:common); and sending the headers: $request-content_type($ContentType); Ah, ok, so you're using mod_perl 2. In that case, don't pass the Apache::RequestRec to TT. I don't

Re: [Templates] Template::Plugin::XML::Writer

2006-07-11 Thread Perrin Harkins
On Tue, 2006-07-11 at 14:33 +0100, Addison, Mark wrote: =head1 SYNOPSIS # Load the plugin and set writer options. [% xw = XML.Writer( DATA_MODE = 1, DATA_INDENT = 2 ); %] # Create XML document [% xw.xmlDecl; xw.startTag( 'website', id='webzone1' );

RE: [Templates] Template::Plugin::XML::Writer

2006-07-11 Thread Perrin Harkins
On Tue, 2006-07-11 at 18:25 +0100, Addison, Mark wrote: We have an export system and presentation layer built around TT for output generation (multiple formats, not just XML). I didn't want to enable PERL blocks in the templates or change the exporter code adding an extra path to pass a

Re: [Templates] Template::Plugin::XML::Writer

2006-07-11 Thread Perrin Harkins
On Tue, 2006-07-11 at 14:06 -0700, mark wrote: Any why against the DBI plugin? Same reasons mostly: poor dev environment, weak syntax checking, less efficient use of DBI, etc. The other problem is that it breaks any concept of separation between your templates and your code, MVC or otherwise.

Re: [Templates] Performance and caching

2006-05-18 Thread Perrin Harkins
Nigel Metheringham wrote: However the TT documentation implies to me that setting COMPILE_DIR is only of use when a process is restarted - so a long lived FastCGI or mod_perl process would gain little benefit (and potentially take a hit if it stats the cached files). But these processes do die

Re: [Templates] Can there be two?

2006-05-11 Thread Perrin Harkins
On Thu, 2006-05-11 at 10:23 -0600, Paul Seamons wrote: The benchmark_template.pl was sent as a reply to that same thread. But to make things easy here it is again - and with the results as an attachment (the results are also embedded in the benchmark_template.pl). I can't tell what this

Re: [Templates] mod_tt - whither the enthusiasm?

2006-04-17 Thread Perrin Harkins
On Thu, 2006-04-13 at 10:34 +0100, Simon Wistow wrote: Which is a shame because personally I think it rocks, especially since I spent a p[ortion of last week trying to remember how to battle with mod_perl and memory bloat and leaks and slowness and starup.pl and handler($$) and you

Re: [Templates] Templates in Database

2006-01-13 Thread Perrin Harkins
Bill Moseley wrote: As a programmer, it's hard not to expect everything to be under revision control. Exactly. Are you sure you want to do this? I'm trying to get the templates OUT of the database in the CMS system I use. - Perrin ___ templates

Re: [Templates] Hello, and a DBI question

2006-01-07 Thread Perrin Harkins
brian toscano wrote: In mod_perl I had some wrappers around the DBI code and it would tell me the query string and the error. It made troubleshooting much easier! Why did you change it? Doing the DBI work in perl before running the template is usually better, and easier to debug as you

Re: [Templates] Everyone Uses TT

2005-11-18 Thread Perrin Harkins
Dave Cross wrote: Of course I wasn't surprised to see that Catalyst[2] uses TT, but when Simon Willison showed an example of Django[3] (a Python Framework) templates, it looked really similar to TT (they use {% ... %} instead of [% ... %]). Apparently they borrowed the ideas from Smarty[4], so

Re: [Templates] mod_perl, INCLUDE_PATH, and Singletons

2005-10-04 Thread Perrin Harkins
On Tue, 2005-10-04 at 14:09 -0400, Brett Sanger wrote: I'm caching to disk, but I can save instantiation time. Caching to disk only is a lot slower than the memory cache. You may want to try it and see if the extra speed is worth some more RAM to you. - Perrin

Re: [Templates] Cleanly redirect from Apache::Template?

2005-08-22 Thread Perrin Harkins
On Sun, 2005-08-21 at 23:42 -0400, Garrett, Philip (MAN-Corporate) wrote: Surely there's a better way... ? One better way is to stop using Apache::Template and write an MVC app instead. Then you can do the redirect and not run the template at all. - Perrin

RE: [Templates] Cleanly redirect from Apache::Template?

2005-08-22 Thread Perrin Harkins
On Mon, 2005-08-22 at 13:48 -0400, Garrett, Philip (MAN-Corporate) wrote: What I'm actually attempting to accomplish is to require (cookie-based) site login on some pages and not on others. I would prefer the pages to all have the same extension, and they can't really be separated by

Re: [Templates] Re: CDBI,CGIAPP, and TT

2005-07-22 Thread Perrin Harkins
On Thu, 2005-07-21 at 16:19 -0500, Will wrote: Another reason to roll my own is that my host doesn't ( I don't think ) support Catalyst or Maypole. Both can run under CGI. May not be fast though. Besides, would it be best to learn how to do it on my own, then once I understand the

Re: [Templates] CDBI,CGIAPP, and TT

2005-07-21 Thread Perrin Harkins
On Thu, 2005-07-21 at 11:19 -0700, apv wrote: Maybe this is a good place to start instead: http://catalyst.perl.org/ I haven't used it yet but I'm planning to because of all the nice reviews/feedback it's getting. I think it uses its own CDBI implementation/wrapper and TT but not CGI::App.

Re: [Templates] CMS Integration

2005-05-24 Thread Perrin Harkins
On Tuesday 24 May 2005 4:20 pm, Brett Sanger wrote: Bricolage isn't faring well so far due to its complexity, but it's not out of the running. What else would people recommend I consider? Krang is simpler, although nothing with workflow and versioning support could truly be called simple in

Re: [Templates] serializing/freezing the TT object

2005-04-07 Thread Perrin Harkins
On Thu, 2005-04-07 at 15:52 +0200, Nick Sutterer wrote: is it possible to freeze the Template object for later deserialization? No. What problem are you trying to solve? - Perrin ___ templates mailing list templates@template-toolkit.org

Re: [Templates] serializing/freezing the TT object

2005-04-07 Thread Perrin Harkins
On Thu, 2005-04-07 at 18:12 +0200, Nick Sutterer wrote: my web-environment saves all necessary objects as serialized objects between different requests. i know i could do that with plenty of existing modules, but it's a testing environment that uses as less components as possible. so i

RE: [Templates] processing template chunks in parallel

2005-03-08 Thread Perrin Harkins
On Tue, 2005-03-08 at 11:12 -0700, Cahill, Earl wrote: Perhaps I could put two tags on the top of the page. [...] The only drawback is it means you need to know what needs to be done for the page at the start of the page. What I was trying to say was that you should drop the idea of a

Re: [Templates] TT and PHP

2005-02-25 Thread Perrin Harkins
Everyone else is having so much fun with this topic, I just can't resist: Make a mod_perl 2 filter that processes the output of the PHP scripts as TT templates. Then you can use your TT header/footer from PHP. - Perrin ___ templates mailing list

Re: [Templates] rounding numbers

2005-02-17 Thread Perrin Harkins
Shanta McBain wrote: I have a need to round number. Found some code in the archives to truncate number to 2 or more decimals. I need to roundup and rounddown. Is there a way to do this in ttml? You'd be much better off doing it in perl or using Template::Plugin::Number::Format. - Perrin

Re: [Templates] Image plugin

2005-02-07 Thread Perrin Harkins
On Mon, 2005-02-07 at 19:20 +0100, Tosh Cooey wrote: I'm not a fan of the server having to determine the size of an image file, but my designer is a bit of a standards fanatic and pefectionfascist and wants height and width tags for the images. This has changed over time, but it used to be

Re: [Templates] Re: Accessing files from templates

2005-01-30 Thread Perrin Harkins
On Sun, 2005-01-30 at 09:46 +0100, Johan Vromans wrote: Yes, TIMTOWTDI. Two problems, though: First, it is not just Template::Plugin::Directory, it applies to all other file-accessing plugins as well (File, Image, ...). Second, I need it for a software package and I cannot require the end

Re: [Templates] Accessing files from templates

2005-01-29 Thread Perrin Harkins
On Sat, 2005-01-29 at 22:22 +0100, Johan Vromans wrote: Template::Plugin::Directory is a good start, but unfortunately it has a different view on the file system than would be intuitive. For example, to show all images in the current directory: USE dir = Directory(dirpath); FOREACH file

Re: [Templates] Patch to implement USE_SINGLETON idea in CAP::TT

2005-01-27 Thread Perrin Harkins
On Thu, 2005-01-27 at 22:52 -0500, Cees Hek wrote: Instead of configuring the object by calling $self-tt_config(...) you can now provide all the options when you 'use' the module. package My::App; use base qw(CGI::Application); use CGI::Application::Plugin::TT (

Re: [Templates] Server load skyrockets as soon as newer template gets installed

2005-01-24 Thread Perrin Harkins
[Please keep it on the list...] On Mon, 2005-01-24 at 14:08 +0100, Tobias Begalke wrote: We use rsync -t so the time stamps of unchanged files are being preserved. I've managed to track down the problem to one file that's included in virtually every template. As soon as said file is uploaded

Re: [Templates] TT in callback

2005-01-09 Thread Perrin Harkins
Bill Moseley wrote: How can you avoid setting variables? [...] [% BLOCK show_list %] [% FOREACH item = list; Item = [$item]\n; END; %] [% END %] You're right, that would modify item in the stash. I guess the reasons that this is

Re: [Templates] TT in callback

2005-01-08 Thread Perrin Harkins
On Sat, 2005-01-08 at 11:22 -0800, Bill Moseley wrote: That's the point, I guess. How do I know if I need to prevent side-effects or not? If your approach to TT is to gather your data ahead of time and pass it in, you probably aren't setting variables, or setting so few that you are aware of

Re: [Templates] TT in callback

2005-01-07 Thread Perrin Harkins
On Fri, 2005-01-07 at 10:39 +, Harry Jackson wrote: Would you then alias INCLUDE to PROCESS? Yes. You know a lot more about the work involved than me but for backwards compatibility but would it not be easier to make INCLUDE_FAST an alias to PROCESS. I think people do not read the

Re: [Templates] TT in callback

2005-01-07 Thread Perrin Harkins
On Fri, 2005-01-07 at 08:11 -0800, Bill Moseley wrote: Is the issue about side-effects? My data comes in from a $t-process hash or from a single template where I PROCESS defaultvars.tt in a common wrapper or PRE_PROCESS. It's rare that I PROCESS a template for side-effect of setting some

RE: [Templates] TT in callback

2005-01-07 Thread Perrin Harkins
On Fri, 2005-01-07 at 16:53 +, Simon Matthews wrote: I still think that changing the default behaviour will cause untold mayhem for the vast number of people who have been using INCLUDE in the past. I seriously doubt that, since only people who set variables in their templates AND step on

Re: TT Caching (Was: Re: [Templates] TT in callback)

2005-01-06 Thread Perrin Harkins
On Thu, 2005-01-06 at 09:29 +0200, Octavian Rasnita wrote: Ok, I think that I will need to create a program that will save the final HTML page, and each time the program is accessed with a browser, it will check if the saved html page is new enough, and if it is, it will get and present it,

Re: [Templates] TT in callback

2005-01-06 Thread Perrin Harkins
On Thu, 2005-01-06 at 11:08 +, Andy Wardley wrote: I must admit it worries me slightly that I come down 90% in favour of one approach and you're swung 99.9% the other way. Assuming the efficiency problem goes away in TT3, is your position that non-localising is the correct behaviour by

Re: TT Caching (Was: Re: [Templates] TT in callback)

2005-01-06 Thread Perrin Harkins
On Thu, 2005-01-06 at 22:32 +0200, Octavian Rasnita wrote: I don't know, maybe Cache-Cache requires a C compiler... It doesn't for the Cache::FileCache subclass that my plugin uses. I have never tried any of this stuff on Win32 though. My plugin doesn't do very much, so you could always just

Re: TT Caching (Was: Re: [Templates] TT in callback)

2005-01-05 Thread Perrin Harkins
On Wed, 2005-01-05 at 18:13 +, Simon Wistow wrote: On Wed, Jan 05, 2005 at 01:07:14PM -0500, Perrin Harkins said: No, but the COMPILE_DIR option means that at least the compile to perl step will be skipped. If there was a way to store compiled perl code and load it faster, it would

Re: TT Caching (Was: Re: [Templates] TT in callback)

2005-01-05 Thread Perrin Harkins
On Wed, 2005-01-05 at 10:52 -0800, Len Weisberg wrote: I have another question about caching in this sort of environment: I would like to be able to indicate for a particular run of process(): a) do NOT use the compilation cached in the COMPILE_DIR b) but DO store the results of this run

Re: [Templates] TT in callback

2005-01-04 Thread Perrin Harkins
On Tue, 2005-01-04 at 09:46 -0500, Sean T Allen wrote: Michael Peters wrote: Why do you say not to use INCLUDE? After seeing that I did a quick google but didn't see anything. I'll keep looking though... Probably because in this case, include wouldnt work... as the toolbar needs to be

Re: [Templates] TT in callback

2005-01-04 Thread Perrin Harkins
On Tue, 2005-01-04 at 00:14 +, Tony Bowden wrote: On Mon, Jan 03, 2005 at 06:21:14PM -0500, Perrin Harkins wrote: I structure my web applications so that common code can be added to all requests in a central place (some kind of common setup hook). I usually put my $tt-process inside

Re: [Templates] TT in callback

2005-01-04 Thread Perrin Harkins
On Mon, 2005-01-03 at 21:38 -0500, Cees Hek wrote: I don't know exactly how Perrin does this, but I thought it might be a good time for me to mention CGI::Application::Plugin::TT which is a Template Toolkit plugin for CGI::Application. It does pretty much what Perrin is describing above (in

Re: [Templates] TT in callback

2005-01-04 Thread Perrin Harkins
On Tue, 2005-01-04 at 21:39 -0500, Cees Hek wrote: It might boost performance, but it can also have unexpected consequences. If I am running several different applications on the same mod_perl server, then the TT singleton is going to be configured by the first app that is executed, even

Re: [Templates] TT in callback

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 14:13 -0500, Arshavir Grigorian wrote: I have a package subroutine that requires an Apache request object and will return a list of privileges (based on a session id stored in pnotes). So I am wondering whether I should be using TT's Plugin interface to make this

Re: [Templates] basic VARIABLES question

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 14:03 -0500, Sean T Allen wrote: $t = new Template( VARIABLES = { blah } ); $t-process( , OTHERBLAH ); does it do: create template doing substitutions for blah process what was left over after blah using OTHERBLAH so that if i ran $t-process( , OTHERBLAH1

Re: [Templates] TT in callback

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 16:55 -0500, Arshavir Grigorian wrote: I thought about that, but it would mean passing this data to every page, then code every page to relay it to the toolbar library template on each include. The stash contents should be passed to all templates that you call already.

Re: [Templates] basic VARIABLES question

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 17:42 -0500, Sean T Allen wrote: if I need to only instantiate 1 instance of Template ( so long as options passed to the constructor don't change ). then it would make sense for me to create the instance as a singleton. using say Apache::Singleton::Process yes? Yes.

Re: [Templates] TT in callback

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 17:39 -0500, Arshavir Grigorian wrote: The stash contents should be passed to all templates that you call already. That's the default behavior. I am not sure what you mean. Could you please explain this a little more? My assumption is that you have templates which

Re: [Templates] basic VARIABLES question

2005-01-03 Thread Perrin Harkins
On Mon, 2005-01-03 at 18:05 -0500, Sean T Allen wrote: Perrin Harkins wrote: Yes. And keep in mind that you can change the INCLUDE_PATH without creating a new TT object. I havent come across that in the manual... how do i do that.. or where in the manual would i find said info

Re: [Templates] [ANNOUNCE] Apache::Template 0.09 ported to mod_perl 2.0

2004-12-29 Thread Perrin Harkins
Octavian Rasnita said: But let's say I have a directory structure like the following, with same .tt templates in each directory: classic index.tt header.tt footer.tt etc.tt modern index.tt header.tt footer.tt etc.tt ...and I want to call a template

Re: [Templates] [ANNOUNCE] Apache::Template 0.09 ported to mod_perl 2.0

2004-12-28 Thread Perrin Harkins
On Tue, 2004-12-28 at 23:41 +0200, Octavian Rasnita wrote: Newbie: Can you please tell me what's the difference between using this module (Apache::Template) and using: PerlModule Template ...in httpd.conf? Apache::Template is a module that maps web requests to Template Toolkit templates,

Re: [Templates] Template::Plugin::Clickable

2004-12-23 Thread Perrin Harkins
Stephen Quinney wrote: Any thoughts on how to get around this problem? Change the regex in the Clickable plugin. - Perrin ___ templates mailing list templates@template-toolkit.org http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] [OT] Apache2 speed with TT

2004-12-22 Thread Perrin Harkins
On Wed, 2004-12-22 at 08:10 -0500, Robert wrote: I am just wondering if CGI has a speedup with Apache2 over Apache1. I have not googled anything that compares them in that way. So I was wondering if any of you that are using TT have moved to A2 and noticed a speedup. Anyone who cares about

  1   2   3   >