Re: [Templates] custom vmethods

2016-02-24 Thread Dave Howorth
On 2016-02-24 14:17, Tom Molesworth wrote: Hi Dave, On 24/02/16 14:07, Dave Howorth wrote: On 2016-02-24 13:01, Tom Molesworth wrote: On 24/02/16 12:44, Dave Howorth wrote: I'm trying to define a custom vmethod but not succeeding. I tried using the way described in the manual and also

Re: [Templates] custom vmethods

2016-02-24 Thread Dave Howorth
On 2016-02-24 13:01, Tom Molesworth wrote: Hi Dave, On 24/02/16 12:44, Dave Howorth wrote: I'm trying to define a custom vmethod but not succeeding. I tried using the way described in the manual and also by calling define_vmethod. Both ways appear to have set up methods in the Template::Stash

[Templates] custom vmethods

2016-02-24 Thread Dave Howorth
I'm trying to define a custom vmethod but not succeeding. I tried using the way described in the manual and also by calling define_vmethod. Both ways appear to have set up methods in the Template::Stash::SCALAR_OPS hashref but neither of them appears to work, even with a very simple body. Any

Re: [Templates] debugging

2015-12-11 Thread Dave Howorth
Lathan Bidwell wrote: > Is this related to TT's strict? I don't know, but I need to locate my problem to find out! ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] debugging

2015-12-11 Thread Dave Howorth
the error. Any thoughts on why that doesn't fix the error too? Cheers, Dave Dave Howorth wrote: > I'm sure I've forgotten something simple about how to debug templates. > > I have DEBUG_ALL on and I'm seeing this message: > > > keyword-index: Template undef error - id is undefin

[Templates] debugging

2015-12-10 Thread Dave Howorth
I'm sure I've forgotten something simple about how to debug templates. I have DEBUG_ALL on and I'm seeing this message: keyword-index: Template undef error - id is undefined keyword-index.tt is a template but it doesn't have any variable or component of a variable called id Neither do I see

Re: [Templates] Iterate over a blessed reference

2014-02-04 Thread Dave Howorth
Ziermann, Markus wrote: Is there an easy way to iterate over nested perl objects (blessed hashrefs) in template toolkit? If not, perhaps an easy way to convert a complex structure of nested objects to hashes? It depends on the objects. You just invoke the objects' methods in the template, so

Re: [Templates] unicode data in ascii template

2014-01-10 Thread Dave Howorth
Solved it ... The major pieces that we all knew about were: - decoding the database results via mysql_enable_utf8 - decoding the templates using ENCODING = 'utf8' - encoding the template output, using $Template::BINMODE = ':utf8' (easier than arguments to each and every process call) The two

Re: [Templates] unicode data in ascii template

2014-01-10 Thread Dave Howorth
Bill Moseley wrote: On Fri, Jan 10, 2014 at 6:51 AM, Dave Howorth dhowo...@mrc-lmb.cam.ac.ukwrote: Solved it ... Cool. I spoke too soon. I've got a different problem now (more below ...) - one module used by my main program was making its own connection to the database (for historical

Re: [Templates] unicode data in ascii template

2014-01-09 Thread Dave Howorth
Ben Bullock wrote: I have a web page which answers your question here: http://www.lemoda.net/perl/template-encoding/index.html Yes, I found that page yesterday. It's a lot more helpful this morning with all the additional examples. Thanks, Ben! I believe I got this answer from this mailing

Re: [Templates] unicode data in ascii template

2014-01-09 Thread Dave Howorth
Bill Moseley wrote: On Wed, Jan 8, 2014 at 9:22 AM, Dave Howorth dhowo...@mrc-lmb.cam.ac.ukwrote: I have some templates that generate web pages. The templates themselves only contain ASCII*. ASCII is a subset of UTF-8, so I'd use: ENCODING = 'UTF-8'. Then Template::Provider

[Templates] unicode data in ascii template

2014-01-08 Thread Dave Howorth
I have some templates that generate web pages. The templates themselves only contain ASCII*. They include some data that is extracted from a database and some of the data values are now Unicode UTF-8 (they contain non-break space and some quote marks). But the resultant HTML file that is generated

Re: [Templates] accessing template variables in perl code

2013-11-11 Thread Dave Howorth
Stuart A Johnston wrote: You could wrap your function in a closure over the name of the template at the time you call process: my $template = 'template/name'; $tt-process($template, { get_func = sub { get_params($template) } }); Er, then again couldn't you just retrieve your data before

Re: [Templates] accessing template variables in perl code

2013-11-11 Thread Dave Howorth
Felipe Gasper (cPanel) wrote: On 11/8/13 10:54 AM, Dave Howorth wrote: I expect my brain is fried and I'm doing it all wrong, but I'd appreciate advice about how to access template variables in perl code. I have a perl function that retrieves some data and returns it. I've put the function

Re: [Templates] accessing template variables in perl code

2013-11-11 Thread Dave Howorth
Dave Howorth wrote: Felipe Gasper (cPanel) wrote: On 11/8/13 10:54 AM, Dave Howorth wrote: I expect my brain is fried and I'm doing it all wrong, but I'd appreciate advice about how to access template variables in perl code. I have a perl function that retrieves some data and returns

[Templates] accessing template variables in perl code

2013-11-08 Thread Dave Howorth
I expect my brain is fried and I'm doing it all wrong, but I'd appreciate advice about how to access template variables in perl code. I have a perl function that retrieves some data and returns it. I've put the function in the stash so I can call it in a template. It needs to decide what data to

Re: [Templates] Some virtual methods do not work

2013-04-09 Thread Dave Howorth
Kiss Gabor (Bitman) wrote: Dear folks, I'm pretty new to TT. I was just creating my first project when I noticed that virtual method trim produces empty output. I read http://www.template-toolkit.org/docs/manual/VMethods.html several times but it did not help. Finally I wrote this

Re: [Templates] Some virtual methods do not work

2013-04-09 Thread Dave Howorth
Kiss Gabor (Bitman) wrote: What version of TT are you using? What does the VMethods manual page say on your machine? trim only became a VMethod in the latest release, for example. Before that it is [only] a filter. Oh! What a lamer am I! :-) Not at all. I only guessed what the reason might

Re: [Templates] First template attempt: how to INCLUDE a list of subfiles?

2012-12-17 Thread Dave Howorth
Michael Friendly wrote: This is my first attempt to use the Template system tpage to refactor some old web pages to make them more flexible for further development. The web page I'm working on is at http://www.datavis.ca/gallery/missed.php and I simply want to generate each of the table

Re: [Templates] Using Constants as Hash Keys

2012-11-29 Thread Dave Howorth
Stuart Johnston wrote: Trying to use a constant as a hash key gives this error: unexpected token (.). Here is what I am trying to do: [% { constants.foo = value } %] This works but is a bit ugly: [% { ${constants.foo} = value } %] Any other suggestions? I don't understand what

Re: [Templates] Pre-Processing new template and variables

2012-09-06 Thread Dave Howorth
Mark Haney wrote: I'm trying to get the INCLUDE_PATH in my template to include a perl variable. Here's the code I'm trying to use: my $tmplID=epic; my $user_id=`id -u`; if ($user_id = 1000){my $tmplID = markh;} Did you really mean to always assign the string 1000 as the value of

Re: [Templates] .uri() scalar vmethod?

2012-07-31 Thread Dave Howorth
Felipe Gasper (cPanel) wrote: Any chance this could make it into a forthcoming TT release? our $TEXT_VMETHODS = { ... dquote = \text_dquote, html= \Template::Filters::html_filter, xml = \Template::Filters::xml_filter, uri =

Re: [Templates] How to use multiple checkboxes with the same name in TT / Perl?

2012-06-28 Thread Dave Howorth
Khalid Akram wrote: Hi, I am having an issue using multiple checkboxes with the same name with TT. Well firstly, this has nothing to do with TT! If I have some checkboxes like this: input type=checkbox name=options value=1 input type=checkbox name=options value=2 input type=checkbox

Re: [Templates] Collecting snippets

2012-06-14 Thread Dave Howorth
Andy Wardley wrote: 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

[Templates] Collecting snippets

2012-06-13 Thread Dave Howorth
So I'm generating some web pages and as I go through each page, I want to record some keywords that depend on the content (related to whether an IF or ELSE was processed, or the names processed in various lists etc). The comes the kicker; I want the keywords to appear in a meta element at the

Re: [Templates] multiple fields from SQL query

2012-05-24 Thread Dave Howorth
Mark Haney wrote: I've got a query in my perl code to pull 2 fields from a database (abbreviation, factory_id), one of which is used to populate a dropdown box (abbreviation). However, I will need to pass /both/ fields to the CGI script that I'm calling from the form that has the dropdown

[Templates] [Fwd: Re: help needed in template toolkit module]

2011-11-02 Thread Dave Howorth
veeru reddy wrote: I am very new to this mailing list so I directly replied to you.Thanks in advance. So don't do that then Original Message Subject: Re: [Templates] help needed in template toolkit module Date: Tue, 1 Nov 2011 21:08:10 +0100 From: veeru reddy

Re: [Templates] help needed in template toolkit module

2011-11-01 Thread Dave Howorth
veeru reddy wrote: Hi, I have XML file with more number of university's like this as shown below OK, now we see the structure, we know that the XML is not relevant. I used XML::Simple to store this data into one hash data structure variable $data and that information is like this And we

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-09 Thread Dave Howorth
Todd Wade wrote: Ok, how about: touch lets the system set the permissions, File::Temp sets the mode of the file explicitly. Is that accurate? $ umask 0 $ touch junk $ ls -l junk -rw-rw-rw- 1 me users 0 2011-09-09 10:45 junk ___ templates

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-09 Thread Dave Howorth
Todd Wade wrote: Ok, how about: touch lets the system set the permissions, File::Temp sets the mode of the file explicitly. Is that accurate? Actually, just read the code of touch and you will see that it too sets the mode of the file explicitly. In its case, it uses 666.

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-08 Thread Dave Howorth
Todd Wade wrote: From: Dave Howorth dhowo...@mrc-lmb.cam.ac.uk Todd Wade wrote: My problem is because the umask is 0002, the files should be g+r,g+w The umask does not SET the mode, the umask MASKs the mode set by the application. Where did I say that a umask sets the mode? Here: Todd

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-07 Thread Dave Howorth
Todd Wade wrote: File::Temp forces the file to 0600 and therefore doesn't respect the starting users/processes umask (contrary to the mailing list archives :0). $ umask 0002 Am I missing something? This mask says never allow write permission for others ... $ pwd /home/me/foo $ ls -l

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-07 Thread Dave Howorth
Todd Wade wrote: My problem is because the umask is 0002, the files should be g+r,g+w The umask does not SET the mode, the umask MASKs the mode set by the application. It can't cause extra bits to be set. You need to change the application if you want extra bits set. BTW, please don't send me

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

2011-08-19 Thread Dave Howorth
Andrew Black wrote: I am trying to put some assertions into a template. The sort of thing I want is [% myvar = 0 # . soemthing that modfies myvar if myvar != 5 print STDERR 'myvar should be 5, actual $myvar' %] But I can't get my head around the syntax. Are there

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

2011-08-19 Thread Dave Howorth
Larry Leszczynski wrote: Maybe he did try that, and upon reading that page realized it obviously only checks for undefined values, which is not what he is looking for? Well, if he had, he should have told us, don't you think :-P And if he hadn't, it doesn't say much for his research. And as

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

2011-08-19 Thread Dave Howorth
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 Your best solution is probably to write yourself a simple vmethod in Perl. Or even just add a regular method to an object you pass to the template. But if you're doing computations

Re: [Templates] TT and UTF-8 string length/format problem

2011-07-20 Thread Dave Howorth
Ekki Plicht (DF4OR) wrote: On Wed, Jul 20, 2011 at 07:51, Bill Moseley mose...@hank.org wrote: And frankly I kind of think the text vs. html argument is a bit out dated, so I'd just use HTML in the email and let the client format it correctly into tables. I suspect that would solve a lot of

Re: [Templates] list of hashes problem

2011-05-11 Thread Dave Howorth
Jiří Pavlovský wrote: Hi, I have an object passed to my template, which has a method that returns list of hashes. I want to iterate over this list. Problem is that if the list contains just one hash, it iterates over this hash. Can I do anything else then detect number of items in the

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-12 Thread Dave Howorth
Cees Hek wrote: Check what version of Template Toolkit you are using. This was something that was changed in v2.20: * Applied a patch to Template::Stash from Jess Robinson which allows you to call a list method on a single object and have it automatically upgraded to a single item

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-12 Thread Dave Howorth
Cees Hek wrote: Check what version of Template Toolkit you are using. This was something that was changed in v2.20: * Applied a patch to Template::Stash from Jess Robinson which allows you to call a list method on a single object and have it automatically upgraded to a single item

[Templates] bug - Patch to call a list method on a single object doesn't work - Was Re: DBIx::Class resultsets with 0, 1, 2 items

2011-04-12 Thread Dave Howorth
Dave Howorth wrote: Cees Hek wrote: Check what version of Template Toolkit you are using. This was something that was changed in v2.20: * Applied a patch to Template::Stash from Jess Robinson which allows you to call a list method on a single object and have it automatically upgraded

[Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-11 Thread Dave Howorth
I'm sure this must be answered somewhere on the web but I haven't been able to find it. In my templates I produce short lists of items from resultsets. Up to now I've been using code that looks like items = some_resultset_rs ; IF items.count 0 ; 'ul' ; WHILE (item = items.next) ;

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-11 Thread Dave Howorth
Oleg Kostyuk wrote: May be, you want this? items = [ some_resultset_rs.all ]; Without [], if rs have one element, you will have not an array. Yes, I tried that and it could be part of the answer but the results appear to need considerable massaging: items [ some_resultset_rs.all

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-11 Thread Dave Howorth
Dave Howorth wrote: I was hoping there's a better answer. Well, I've made this template code work: items = some_resultset_rs.all_ref ; IF items.0; 'ul' ; FOREACH item IN items ; 'li' ; item.name ; END ; '/ul' ; END ; by dint of a naughty line of perl: *DBIx::Class

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-11 Thread Dave Howorth
Larry Leszczynski wrote: I think you can do: IF items.list.size 0; See: http://template-toolkit.org/docs/manual/VMethods.html#section_list Hi Larry, Tried that one too :( If items is a single object, .list is the hash vmethod and .size just tells you how many attributes there are.

Re: [Templates] Accessing array from Perl DBI using Template Toolkit

2010-08-11 Thread Dave Howorth
MySelf rdtan.net wrote: I've actually asked this over the mailing list beginn...@perl.org, not knowing that there is a mailing list for TT. :p Well you've come to the right place now :) I'm trying to pickup CGI web application programming using Perl, DBI TT (Template Toolkit). This small

Re: [Templates] another replace interpolation problem

2010-04-21 Thread Dave Howorth
Travis Basevi wrote: Yes, I know that solution, 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: b.replace('_err_', a.replace('$','\$')); I think you

Re: [Templates] pagination with TT2

2010-04-06 Thread Dave Howorth
Jim Spath wrote: On 4/1/2010 7:27 AM, dark0s wrote: If search results are more of fifty, then I'd like to place remaining results in other page and I want to put link to subsequent page. How can I solve this problem? An alternative to limiting how many you display in the template output

Re: [Templates] error calling a external method with a hash param

2010-03-31 Thread Dave Howorth
Juan Ladetto wrote: I call this function from any perl file with no problem at all but when I call this function from tt, I'm getting a hash o hash, is that true? What am I doing wrong? Not reading the manual?

Re: [Templates] problem in passing values in template

2010-03-02 Thread Dave Howorth
dark0s wrote: What is the problem? How can I to obtain to fill template values? You might get more feedback if you were clearer about what you have tried. You don't show any output (and in your previous query you didn't even show any input). You don't explain why you're trying to do these

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Dave Howorth
Dermot wrote: Can anyone offer any hints? Template variables don't start with a dollar ?! ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] RT Ticket 47850 and attached patch

2009-07-20 Thread Dave Howorth
Slaven Rezic wrote: I think that the pod2html renderer used at perldoc.perl.org is broken. If you compare both versions on search.cpan.org, then there's no difference: http://search.cpan.org/~nwclark/perl-5.8.7/pod/perlpod.pod#Formatting_Codes

Re: [Templates] RT Ticket 47850 and attached patch

2009-07-20 Thread Dave Howorth
John Napiorkowski wrote: If we agree I can make those changes tonight and submit a new patch. Let me know what you think. (1) Please quote mail in the normal way. It makes it much easier to read. (2) Please don't send extra copies to me. I read the list. (3) I have no view (or influence)

Re: [Templates] The new xml filter

2009-07-10 Thread Dave Howorth
Larry Leszczynski wrote: On Thu, 09 Jul 2009 12:48 -0700, Sean McAfee eef...@gmail.com wrote: On Thu, Jul 9, 2009 at 3:39 PM, Larry Leszczynski but this is: meta name=some key content=some value Er... Reference? My understanding is that XHTML is XML, and XML allows either type of

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

2009-06-17 Thread Dave Howorth
Robin Smidsrød wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think I've spotted a bug in either DateTime or Template. The bug is described here: http://github.com/robinsmidsrod/datetime-template-bug/tree/master Did you try my $tt = Template-new( DEBUG = 'all' ); If any of

Re: [Templates] Help EVAL_PERL settings

2009-05-12 Thread Dave Howorth
Stabinger, John wrote: We're using a third part app that makes use of Template. I'd like to use some perl directly in the templates via the perl blocks. However, no matter what I set, I keep getting the eval_perl not set error. I'm using the latest Template install from cpan. I'm calling

Re: [Templates] Net::IP

2009-02-12 Thread Dave Howorth
Brian Sherwood wrote: Thank you all. A lot of good ideas, but so far no luck :( Simon recommended writing a plugin, or wrapping Net::IP using Template::Plugin::Class I tried using the Template::Plugin::Class, but it would throw an exception. I used the following code: [% connector1 =

Re: [Templates] Net::IP

2009-02-11 Thread Dave Howorth
Brian Sherwood wrote: ... I don't seem to be getting an error, or any kind of output. ... Any help/suggestions are welcome. Nobody has mentioned the general answer to your question yet. Have you tried debugging it? http://template-toolkit.org/docs/manual/Config.html#section_DEBUG Specifically

Re: [Templates] Date Plugin

2009-01-23 Thread Dave Howorth
David Stewart wrote: -mm-dd hh:mm:ss [% date.format('2000/12/21 4:20:36') %] Anyone have any idea what might be going on here? '-' != '/' ? ___ templates mailing list templates@template-toolkit.org

Re: [Templates] Applying Filters in an IF condition

2008-10-31 Thread Dave Howorth
Michael Wichmann wrote: But I want to split the information into two tables without querying the database again. Several people have made suggestions of 'work arounds' to avoid breaking this assumption. But I think it's worth pointing out that making two databases queries, one for each of the

Re: [Templates] in array function?

2008-03-06 Thread Dave Howorth
Sean McAfee wrote: $Template::Stash::SCALAR_OPS-{isOneOf} = sub { my $str = shift; $str eq $_ and return 1 for @_; return 0; }; Or for added pzazz, something like: use Perl6::Junction qw/ any /; $Template::Stash::SCALAR_OPS-{isOneOf} = sub { my $str = shift;

Re: [Templates] Dual pass template processing

2008-01-30 Thread Dave Howorth
Mark Knoop wrote: 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.

Re: [Templates] Error: 'Not a GLOB reference' in Provider.pm

2008-01-08 Thread Dave Howorth
Josh Rosenbaum wrote: Jeremiah C. Foster wrote: Hello, I am getting a 'Not a GLOB reference' error on a SuSE 64 machine, (perl 5.8.8). I have tried to correct it by looking at the offending code in the Provider.pm (line 611) but no luck. My template and variable is trivially simple but I

Re: [Templates] Bread-crumbing; FOREACH / WHILE scope probs?

2008-01-07 Thread Dave Howorth
Craig Skinner wrote: It seems that I can not access crumbs.n inside the WHILE loop. I can access crumbs (prints an array ref), but not the array elements. Is this an out of scope problem? crumbs.$n AFAIK. Cheers, Dave ___ templates mailing list

Re: [Templates] How To Throw Exception on Missing Method

2007-07-27 Thread Dave Howorth
Bill Ward wrote: On 7/25/07, Matisse Enzer [EMAIL PROTECTED] wrote: How do get Template Toolkit to throw an exception if it encounters a call to a non-existent method? In the following example zoo is an object, but there is no get_animals() method - so I want TT to throw an exception at

Re: [Templates] Re: PROPOSAL: Add COMMENT BLOCK directive.

2007-06-14 Thread Dave Howorth
Harald Joerg wrote: Robert Hicks [EMAIL PROTECTED] writes: Paul Seamons wrote: Text::Tmpl has a COMMENT directive. Both to enhance cross compatibility as well as to add features, it would be nice for TT to support this directive. It would most likely have to be added at the TT3 release.

Re: [Templates] 10 lines of whitespace at top of page

2007-05-09 Thread Dave Howorth
Harald Joerg wrote: Call it a dirty solution if you want - but my method to fix this is to simply put a plain [% CLEAR %] at the end of every template file which is not designed to output anything. This enables me to write extensive comments between the block declarations, without even

Re: [Templates] How to report on non-existent macros?

2007-04-30 Thread Dave Howorth
Mark Anthony wrote: Hi, Another newbie question. I found the MACRO directive, and it does what I need: replacing a collection of macros into multiple lines. Each macro gets replaced by 2 to 5 lines, so I put all the macros into 1 file and then [% PROCESS ... %] to pull in the

Re: [Templates] POST_CHOMP backward compatibility

2007-04-10 Thread Dave Howorth
Станка Далекова wrote: I have a question regarding Template::Parser::split_text. We have upgraded from version 2.14 to version 2.18 and we have used in our template configuration PRE_CHOMP=1 and POST_CHOMP=1. The effect was to clear white spaces before and after directives. With the new

Re: [Templates] Site-wide macros

2007-04-10 Thread Dave Howorth
Bill Moseley wrote: I have a number of macros that I keep in a macros.tt file and they are included when I pre-process my config.tt file. I'd like to have the macros available to a number of applications, so what would be the recommended way to share a single macros file? Rewrite as a

Re: [Templates] New releases

2007-02-09 Thread Dave Howorth
Jess Robinson wrote: On Thu, 8 Feb 2007, Simon Wilcox wrote: Just in case anyone missed it, there have been two releases of TT recently which only seem to have been announced in someone's use.perl journal. http://use.perl.org/~Alias/journal/32236 [2.16] snip Yes, just chatted to Alias

Re: [Templates] Template and line breaks.

2006-12-05 Thread Dave Howorth
Éric Depagne wrote: I the content of one of the variable I use to fill my template contains a line break this \n is not taken into account, and is send as it is, meaning that rather than having a line break in my page, I only have a \n printed. Since if I modify the pages without using

Re: [Templates] Newbie Question: Calling a method of an object passed to template?

2006-09-27 Thread Dave Howorth
Lee Goddard wrote: http://www.template-toolkit.org/docs/plain/Manual/Variables.html I've been reading the Manual to confirm that [% cgi.param('foo') %] is an object named 'cgi' having its method 'param' called with a value of 'foo'. Is there anything that needs to be activated or switched

Re: [Templates] Using DBI plugin to access a remote database

2006-09-12 Thread Dave Howorth
Jeremiah Foster wrote: I am using a plugin with TT, the DBI interface and I am having trouble accessing a remote host. If I slip the remote host in with my dbh definition the program hangs despite the fact that the SQL works, the remote host is reachable, the pass and user correct, etc.

Re: [Templates] path to current template

2006-04-04 Thread Dave Howorth
Dustin Frazier wrote: I thought that .name on component/template gave only the base filename, but further testing showed that I was mistaken. Thanks!! Dustin Randal, Dustin, Now I'm confused! I too thought that .name only gave the filename, because that's what the badger book seems to

Re: [Templates] path to current template

2006-04-04 Thread Dave Howorth
Nic Gibson wrote: On Apr 4, 2006, at 09:43, Dave Howorth wrote: and here's what appears on the page: template = 'view.tt' component = 'footer.tt' So what am I doing different? As far as I can see from Template::Provider template.name will contain whatever you originally input

Re: [Templates] Missing Variable Question

2006-03-30 Thread Dave Howorth
Randal L. Schwartz wrote: Thomas == Thomas Falgout [EMAIL PROTECTED] writes: Thomas Instead of substituting a blank, how can I get $template-process() to Thomas give me an error if there's any variables that aren't defined? I know Thomas that I shouldn't have any missing variables, but I'm

Re: [Templates] hash key

2006-02-15 Thread Dave Howorth
Josh Rosenbaum wrote: Here's another method if Tim is just looking for a shorter way to do things. (Sorted by the keys in hash (ie: 'box_1') which seems to be the original intent.) [% FOREACH key IN hash.keys.sort() %] If all the keys in the hash are of the form box_n and if the OP wants to

Re: [Templates] test failures

2005-07-28 Thread Dave Howorth
David Charles Todd wrote: So, I have tried three different versions of tt2: 2.14, 2.13, 2.08. Each fails some portion of their tests. I have a hard time believing I am the first to discover this. I don't have such a hard time believing it; there are several possible reasons. Firstly, SuSE

Re: [Templates] dbi plugin install test fails

2005-06-21 Thread Dave Howorth
I wrote: Maybe it's because it's Friday afternoon but my brain is refusing to tell me what I've done wrong here. I'm trying to install TT 2.14 on a newish box and it's failing in dbi.t, both in the CPAN shell and if I run dbi.t directly: Template process failed: DBI error - DBI connect

[Templates] dbi plugin install test fails

2005-06-17 Thread Dave Howorth
Maybe it's because it's Friday afternoon but my brain is refusing to tell me what I've done wrong here. I'm trying to install TT 2.14 on a newish box and it's failing in dbi.t, both in the CPAN shell and if I run dbi.t directly: suse3:~/.cpan/build/Template-Toolkit-2.14 # perl t/dbi.t 1..63

Re: [Templates] ttree not ignoring

2005-05-23 Thread Dave Howorth
Harald Joerg wrote: Steve Kelem writes: I'm trying to use ttree's config file to tell it to ignore the files administered under subversion. Subversion files are stored in subdirectories named .svn. I tried including the following line in my ttree.cfg file: ignore = \b(CVS|RCS|\.svn|xml)\b

Re: [Templates] how to see error messages

2005-04-14 Thread Dave Howorth
Dave Howorth wrote: Andy Wardley wrote: Dave Howorth wrote: my $tt = Template-new(); Try this: my $tt = Template-new( DEBUG = 'undef' ); # yes, the string u n d e f Hi Andy, Thanks for your reply. The problem with this suggestion is that I also have lots of templates that say things like

Re: [Templates] how to see error messages

2005-04-13 Thread Dave Howorth
Andy Wardley wrote: Dave Howorth wrote: my $tt = Template-new(); Try this: my $tt = Template-new( DEBUG = 'undef' ); # yes, the string u n d e f Hi Andy, Thanks for your reply. The problem with this suggestion is that I also have lots of templates that say things like: [% IF fred

[Templates] how to see error messages

2005-04-11 Thread Dave Howorth
A while ago I posted a question about how to retrieve diagnostic information but didn't get any replies. So I'd like to rephrase my question to see if anybody can help. In my template, I say something like: [% USE c = Class('MyClass') ; v = c.some_method(args) %] My problem is that

[Templates] Template::Plugin::Class use diagnostics

2005-02-09 Thread Dave Howorth
My application just fell over with long error messages like that at the bottom of the message. I think I've tracked the problem down to the most excellent Template::Plugin::Class (v0.12). It tries to load the class you've asked to use and decides whether it found an error with an RE: 12 #

[Templates] missing fatal errors

2005-01-05 Thread Dave Howorth
I'd like to see all errors that occur when I'm processing a template but it seems that some are suppressed. I have a library module that is dying because I didn't configure it properly but I'm not seeing any indication of the problem either in my logs or in the generated output. The module

[Templates] Template::Plugin::Class and moniker

2004-10-20 Thread Dave Howorth
I'm trying to use Template::Plugin::Class to access the moniker method of my class. My moniker method overrides the UNIVERSAL::moniker method in the base class I inherit from (Class::DBI). So in my template I have: [% class_name = 'foo' ; class_obj = USE Class(class_name) ;

Re: [Templates] Template::Plugin::Class and moniker

2004-10-20 Thread Dave Howorth
Dave Howorth wrote: class_obj = USE Class(class_name) ; That should be USE class_obj = Class(class_name) ; of course. Dave ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] TTK directive chomping weirdness

2004-09-24 Thread Dave Howorth
Arnett, Bruce wrote: The directive chomping flags [%- and -%] are not working on the Linux/Apache server Don't panic! The chomping does work properly under Linux. I use it as do many others on the list. Any ideas? Unfortunately, I don't use Windows so I can't suggest any specific things to

Re: [Templates] Pass through perl?

2004-07-21 Thread Dave Howorth
Chris Huegle wrote: [% IF 'bar' = 'foo' %] translates to if ('bar' = 'foo') { which returns true, since 1 == 1. Chris, I must apologize to you. You are quite correct as to the translation. I made the mistake of relying on the Badger book, which says (p138): The comparison operators ==, !=, , =,

Re: [Templates] Pass through perl?

2004-07-20 Thread Dave Howorth
Chris Huegle wrote: [% PERL %] is close, but the main place where we're having the problems are within [% IF %] statements. = works, but 'ge' and 'gt' (text comparitors) don't work. In TT '=' *is* a text comparison operator! Another thing that we had problems with were '-' in hash keys.

Re: [Templates] Template::Provider::HTTP

2004-04-29 Thread Dave Howorth
darren chamberlain wrote: * Jason Gottshall jgottshall at capwiz.com [2004/04/28 14:39]: I'm interested in creating/utilizing the Template::Provider::HTTP module as described in the badger book. Has anyone out there already done the grunt work of typing in the example? If so, can you post it

Re: [Templates] PROCESS/INCLUDE on relative files

2004-02-18 Thread Dave Howorth
Chris Ochs wrote: what I want is to have the system look for files included via PROCESS/INCLUDE directives in the templates directory if they dont' exist in the catalog. Perrin Harkins wrote: No, you don't, you just need to put all of the directories to be searched, in the correct order, into

Re: [Templates] Turning templates over to a non-programmer

2004-02-06 Thread Dave Howorth
Thomas, Mark - BLS CTR wrote: I envision: 1. A graphical representation of the data structure (perhaps GraphViz::Data::Grapher or something similar). The output of Data::Dumper is not friendly enough. I just tried GraphViz::Data::Grapher and GraphViz::Data::Structure in connection with

[Templates] sort method on hashes

2004-01-20 Thread Dave Howorth
Sometimes I have trouble with sorting hashes. For example, the following TT code: table [% FOREACH sccs = s_to_c.sort %] tr td[% sccs %]/td [%FOREACH code = s_to_c.$sccs.sort %] td[% code %] ([% s_to_c.$sccs.$code %])/td [%END %] /tr [% END %] /table (s_to_c is a hash)

Re: [Templates] Developer Version 2.12a

2004-01-14 Thread Dave Howorth
Dave Cash wrote: I'm seeing some curious test behaviors, but I don't know if they are new to 2.12/2.12a. They don't appear to be anything serious; I just though I'd mention them. I usually skip the DBI tests, but decided not to now. I have a test database in mysql called 'test' with a user

[Templates] underscores as hash keys

2004-01-13 Thread Dave Howorth
In Template Toolkit, any hash key starting with an underscore is hidden from the template. Is there any way to turn this off? I have a data set where one set of keys is single characters, including underscore. It would be difficult to change the key values, because there's lots of other code

Re: [Templates] underscores as hash keys

2004-01-13 Thread Dave Howorth
Andy Wardley wrote: Dave Howorth wrote: In Template Toolkit, any hash key starting with an underscore is hidden from the template. Is there any way to turn this off? No, not really. Your best bet would be to replace the 'item' hash virtual method with one which honours underscore keys. my $tt

Re: [Templates] FOREACH enhancement request

2003-10-02 Thread Dave Howorth
[EMAIL PROTECTED] wrote: I am using TT2 v2.10, and I am having problems with my loops. and I am importing a XML file with XML::Mini It looks to me that the problem is an inconsistency in the behaviour of XML::Mini, rather than TT. If there's more than one book (more than one element in an XML

  1   2   >