[Templates] sorting on data structures

2009-09-15 Thread Felipe Gasper (cPanel)
Hi all, I wonder if these abilities may be added? 1) Sort lists of lists This seems super-easy: -- 459a460,462 >elsif (ref($item) eq 'ARRAY') { >@keys = map { $item->[ $_ ] } @$fields; >} -- 2) Sort hashes by key/index So, if you have %myhas

[Templates] subroutine reference in TT?

2009-09-30 Thread Felipe Gasper (cPanel)
Hello, Is there a way in TT2 that I can access a subroutine reference? e.g.: [% do_something( sub_ref ) -%] sub do_something { my $sub_ref = shift(); my $obj = shift(); return &{ $sub_ref }( $obj ); } -FG -- Felipe Gasper Linux/BSD development cPanel of

[Templates] double variable lookup in interpolated string?

2009-10-22 Thread Felipe Gasper (cPanel)
Hi all, What is the syntax I am looking for here? - FOR key = hash.keys; "The value for $key is ${hash.$key}."; END; - The above syntax produces errorsI assume there is a way to do what I want to do? -F -- Felipe Gasper Linux/BSD development cPanel of Tex

Re: [Templates] double variable lookup in interpolated string?

2009-10-22 Thread Felipe Gasper (cPanel)
Dave Cross wrote on 22 10 2009 1:52 PM... > On 10/22/2009 07:31 PM, Felipe Gasper (cPanel) wrote: >> Hi all, >> >> What is the syntax I am looking for here? >> >> - >> FOR key = hash.keys; >> "The value for $key is ${hash.$key}.

[Templates] reply to all - default?

2009-10-22 Thread Felipe Gasper (cPanel)
Can this list not be set for an individual subscriber to have reply-to-all as the default reply option? I know it can be set that way for the entire list...I just want to set it that way for myself. Thanks! -F -- Felipe Gasper Linux/BSD development cPanel of Texas, LLC 3701 Kirby Dr., suite

[Templates] variable literals and virtual methods

2009-11-02 Thread Felipe Gasper (cPanel)
Hi all, Is the practice of doing virtual methods on variable literals something that was purposely omitted from TT? In Javascript, for example, you can do this: var transformed = [1,2,3].someFunc(); ...but in TT, you would have to do: SET transformed = [1,2,3]; transformed = t

Re: [Templates] Variables within subroutine calls

2009-11-04 Thread Felipe Gasper (cPanel)
Quoth Dermot on 11/4/2009 7:03 AM... > LID=[% userid %] # This appears correct (EG 1234) > interpolated=[% $userid %] # This is empty. > interpolated=[% ${user.id} %] # This is empty. > > > > I can't seem to get the userid variable interpolated within the call > to subs.makeUserLink() . $useri

[Templates] return variable type in TT?

2009-11-20 Thread Felipe Gasper (cPanel)
How can I tell what kind of data a given variable is in TT? (Analogous to ref() in perl.) -F -- Felipe Gasper Linux/BSD development cPanel of Texas, LLC 3701 Kirby Dr., suite 428 Houston, TX 77098 office 713-529-0800 x4096 cell 832-633-8092 fax 713-559-3206 ___

[Templates] return value of undef?

2009-12-02 Thread Felipe Gasper (cPanel)
Hello, It appears that TT is converting an "undef" value that I return from a function called from a template into the empty string, e.g.: USE Myplugin; SET foo = Myplugin.myfunc() %] sub myfunc { return undef; } ...at least, foo.defined() is evaluating as true in thi

[Templates] Can I “DELETE some_var”?

2009-12-11 Thread Felipe Gasper (cPanel)
Is there a way to delete a variable from the stash in TT2? If not, does something let me define a custom directive to do this? -F -- Felipe Gasper Linux/BSD development cPanel of Texas, LLC 3701 Kirby Dr., suite 428 Houston, TX 77098 office 713-529-0800 x4096 cell 832-633-8092 fax 713-559-3206

Re: [Templates] TT3 is alive!

2009-12-24 Thread Felipe Gasper (cPanel)
COOL!! :) I am guessing this will be easy to implement if it’s not already, but will TT3 spit out text “on the fly”, or will it process to a buffer and then flush in one fell swoop? The former approach is useful for web interfaces to long-running processes. -FG Quoth Andy Wardley on 12/24/2009

[Templates] Template::Stash::XS override not working on FreeBSD?

2010-01-13 Thread Felipe Gasper (cPanel)
We have a custom module to override the undefined() method in the TT Stash module. To do the override, we do eval "require $Template::Config::STASH;"; sub new { my $this = $Template::Config::STASH->new(); return bless $this, shift(); } and then

[Templates] specify keys() vmethod

2010-03-15 Thread Felipe Gasper (cPanel)
Hello, If I have the following template code: -- SET test_hash = { 'keys' => 'foo', 'bar' => 'baz', }; GET test_hash.keys(); -- ...what I get back is “foo” rather than an array reference. The .items() hash vmethod allows me to specify that I want an ite

[Templates] add thousands separator to number

2010-04-23 Thread Felipe Gasper (cPanel)
Hey all, What is the best way in TT to add thousands separators to numbers, e.g. 1234567 -> '1,234,567'? -FG ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

[Templates] special characters in TT double quotes

2010-05-10 Thread Felipe Gasper (cPanel)
How can I do this from perl: print "\x{201c}"; ...in Template? -F ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

[Templates] INCLUDE, PROCESS, and template compilation

2010-05-20 Thread Felipe Gasper (cPanel)
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. Is it possible to have a directive that actually *compiles* the INCLUDEd/PROCESSed template at compile time and inserts it dire

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

2010-08-07 Thread Felipe Gasper (cPanel)
Don’t forget to wrap the JSON plugin to catch "" in your JSON string.especially if you’re spitting out data that came from “the wild”. -FG On 8/7/10 2:38 PM, Jens Rehsack wrote: > On 08/06/10 23:46, Tosh Cooey wrote: >> I have a template that delivers HTML, yay! I would like to have the >>

[Templates] load template into TT variable

2010-09-08 Thread Felipe Gasper (cPanel)
How can I do this? [% SET included_template = PROCESS 'external.tt2'; -%] ...without having the contents of external.tt2 displayed in the page? -FG ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/li

[Templates] forcing TT to do a vmethod

2010-10-27 Thread Felipe Gasper (cPanel)
If I have: perl -MTemplate -MTemplate::Stash -le 'Template->new({STASH=>Template::Stash->new()})->process(\"Hi. [% FOREACH key IN x.keys() %]Key [% key %], [% END %]",{x=>{a=>2,b=>3,keys=>[4,5,6]}});' ...one would think, not being familiar with TT, that “x.keys()” is a method call. As many o

Re: [Templates] forcing TT to do a vmethod

2010-11-01 Thread Felipe Gasper (cPanel)
=> 2, b=> 3, keys => [4,5,6], } }; Template->new()->process(\$tt2, $data); - I don’t see an RT about thishas there been discussion of this before? -FG Felipe Gasper (cPanel) wrote on 27 Oct 2010 14:56 ... > If I have: > > perl -MTemplate -MTempla

[Templates] TT3 development…?

2011-07-07 Thread Felipe Gasper (cPanel)
Hi all, 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? -Felipe Gasper Houston, TX ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.or

Re: [Templates] TT3 development…?

2011-07-07 Thread Felipe Gasper (cPanel)
Sweet! :) -F On 7/7/11 11:45 AM, Clinton Gormley wrote: > On Thu, 2011-07-07 at 11:37 -0500, Felipe Gasper (cPanel) wrote: >> Hi all, >> >> 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

[Templates] uri() vmethod?

2012-03-27 Thread Felipe Gasper (cPanel)
Any interest for a .uri() scalar vmethod, similar to the .html() one that 2.24 just added? Seems like it’d be very useful. -FG ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

[Templates] .uri() scalar vmethod?

2012-07-31 Thread Felipe Gasper (cPanel)
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 => \&Template::Filters::uri_filter, }; It seems like

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

2012-07-31 Thread Felipe Gasper (cPanel)
On 7/31/12 9:56 AM, Dave Howorth wrote: 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 => \&

Re: [Templates] accessing template variables in perl code

2013-11-08 Thread Felipe Gasper (cPanel)
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 in the stash so I can call it in a