html-template-users Mailing List for HTML::Template (Page 5)
Brought to you by:
samtregar
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(42) |
Jul
(80) |
Aug
(77) |
Sep
(97) |
Oct
(65) |
Nov
(80) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(63) |
Feb
(47) |
Mar
(45) |
Apr
(63) |
May
(67) |
Jun
(51) |
Jul
(78) |
Aug
(37) |
Sep
(45) |
Oct
(59) |
Nov
(50) |
Dec
(70) |
2004 |
Jan
(23) |
Feb
(90) |
Mar
(37) |
Apr
(53) |
May
(111) |
Jun
(71) |
Jul
(35) |
Aug
(58) |
Sep
(35) |
Oct
(35) |
Nov
(35) |
Dec
(20) |
2005 |
Jan
(51) |
Feb
(19) |
Mar
(20) |
Apr
(8) |
May
(26) |
Jun
(14) |
Jul
(49) |
Aug
(24) |
Sep
(20) |
Oct
(49) |
Nov
(17) |
Dec
(53) |
2006 |
Jan
(12) |
Feb
(26) |
Mar
(45) |
Apr
(19) |
May
(19) |
Jun
(13) |
Jul
(11) |
Aug
(9) |
Sep
(10) |
Oct
(16) |
Nov
(17) |
Dec
(13) |
2007 |
Jan
(9) |
Feb
(12) |
Mar
(28) |
Apr
(33) |
May
(12) |
Jun
(12) |
Jul
(19) |
Aug
(4) |
Sep
(4) |
Oct
(5) |
Nov
(5) |
Dec
(13) |
2008 |
Jan
(6) |
Feb
(7) |
Mar
(14) |
Apr
(16) |
May
(3) |
Jun
(1) |
Jul
(12) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(1) |
May
|
Jun
(6) |
Jul
(5) |
Aug
(3) |
Sep
(7) |
Oct
(1) |
Nov
(15) |
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(3) |
Mar
|
Apr
(28) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(3) |
Oct
|
Nov
(8) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Matias A. G. <ma...@ni...> - 2009-07-07 12:49:38
|
Thanks Jason. I love cpan! On Tue, Jul 7, 2009 at 9:11 AM, Jason Purdy <ja...@jo...> wrote: > I've heard good things about HTML::Template::Dumper: > > > http://search.cpan.org/~tmurray/HTML-Template-Dumper-0.1/lib/HTML/Template/Dumper.pm<http://search.cpan.org/%7Etmurray/HTML-Template-Dumper-0.1/lib/HTML/Template/Dumper.pm> > > - Jason > > Matias Alejo Garcia wrote: > >> >> Hello, >> >> I am writing some tests for a web site. I would like to check that all >> parameters in a given template have been set to a value (or to undef). >> >> I wonder is anyone could give me a lead about how to implement this in a >> good way. Thanks a lot! >> >> matías >> >> -- >> Ing. Matías Alejo García >> Gerente de Producto Confronte.com >> Clarín Global >> http://confronte.com | http://blog.matiu.com.ar | +54(11) 4546-5397 >> >> >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------------ >> Enter the BlackBerry Developer Challenge This is your chance to win up to >> $100,000 in prizes! For a limited time, vendors submitting new applications >> to BlackBerry App World(TM) will have the opportunity to enter the >> BlackBerry Developer Challenge. See full prize details at: >> http://p.sf.net/sfu/blackberry >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Html-template-users mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/html-template-users >> > -- Ing. Matías Alejo García Gerente de Producto Confronte.com Clarín Global http://confronte.com | http://blog.matiu.com.ar | +54(11) 4546-5397 |
From: Matias A. G. <ma...@ni...> - 2009-07-07 03:21:37
|
Hello, I am writing some tests for a web site. I would like to check that all parameters in a given template have been set to a value (or to undef). I wonder is anyone could give me a lead about how to implement this in a good way. Thanks a lot! matías -- Ing. Matías Alejo García Gerente de Producto Confronte.com Clarín Global http://confronte.com | http://blog.matiu.com.ar | +54(11) 4546-5397 |
From: Roger B. W. <ro...@fi...> - 2009-06-10 09:39:02
|
On Wed, Jun 10, 2009 at 06:05:00PM +1000, Sanjeewa Fernando wrote: >I think I would try using the (scalarref => $ref_to_template_text) method. >I now have to experiment with figuring out how to use wget within a perl script. While this may well work, I think that getting some proper hosting will cause you vastly less grief in the long term. Roger |
From: Sanjeewa F. <san...@ho...> - 2009-06-10 08:05:32
|
Hi Mark and Mathew, Thanks for both your suggestions. I think I would try using the (scalarref => $ref_to_template_text) method. I now have to experiment with figuring out how to use wget within a perl script. Regards, Sanjeewa Date: Wed, 10 Jun 2009 08:56:19 +1000 From: mat...@ne... To: htm...@li... Subject: Re: [htmltmpl] FW: Error using html::template Other than that, I'd suggest you ask your sys-admin to fix their security policy.... What about using wget or curl to read the file, and then use the feature of H::T's "new" method to load a template from a variable? (scalarref => $ref_to_template_text). I agree that disallowing opening files on a system seems obsessive. An "strace wget file:///home/..." shows that wget uses the open() system call. I'd suspect that wget would also fail for the same reason. For wget to succeed (in this conext), I suspect that it would need make a request to a http-daemon, which itself serves the file. cheers, Mathew Robertson _________________________________________________________________ Looking for a new car this winter? Let us help with car news, reviews and more http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT |
From: Mathew R. <mat...@ne...> - 2009-06-09 22:56:37
|
>> Other than that, I'd suggest you ask your sys-admin to fix their >> security policy.... >> > > What about using wget or curl to read the file, and then use the > feature of H::T's "new" method to load a template from a variable? > (scalarref => $ref_to_template_text). > > I agree that disallowing opening files on a system seems obsessive. > An "strace wget file:///home/..." shows that wget uses the open() system call. I'd suspect that wget would also fail for the same reason. For wget to succeed (in this conext), I suspect that it would need make a request to a http-daemon, which itself serves the file. cheers, Mathew Robertson |
From: Mark F. <azf...@gm...> - 2009-06-09 16:54:51
|
On Mon, Jun 8, 2009 at 6:11 PM, Mathew Robertson <mat...@ne...> wrote: > Other than that, I'd suggest you ask your sys-admin to fix their > security policy.... What about using wget or curl to read the file, and then use the feature of H::T's "new" method to load a template from a variable? (scalarref => $ref_to_template_text). I agree that disallowing opening files on a system seems obsessive. Mark |
From: Mathew R. <mat...@ne...> - 2009-06-09 02:12:01
|
> I have tried to use html::template for the first time and tried to run > the script shown in the synopsis of cpan documentation. > > #!/usr/bin/perl -w > use HTML::Template; > > # open the html template > my $template = HTML::Template->new(filename => 'test.tmpl'); > > # fill in some parameters > $template->param(HOME => $ENV{HOME}); > $template->param(PATH => $ENV{PATH}); > > # send the obligatory Content-Type and print the template output > print "Content-Type: text/html\n\n", $template->output; > > > The following error is logged in to error log, > failed to open log file > fopen: Permission denied > [Wed Jun 3 12:38:13 2009] [error] [client 218.215.16.114] > Premature end of script headers: /cgi-bin/bpo/test.cgi > > When I checked with the hosting server admin their reply is they have > restricted the use of FOPEN function and to use WGET or CURL. > Not sure how to resolve this error could someone please help? > wget/curl is not a replacement for the fopen() function call. Presumably your sys-admin has the idea that locking down a specific function call, will help reduce their likelyhood of being 'owned'. Additionally, fopen() is used in lots of programs that reads/writes local files, so this restriction would break a huge amount of code. H::T uses the perl function "open()" to read the file, which (presumably) is calling the underlying system call "fopen()". One possible solution might be to use the LD_PRELOAD environmental variable, to intercept fopen(), then redirect it to wget... (good luck with that... :) Other than that, I'd suggest you ask your sys-admin to fix their security policy.... cheers, Mathew Robertson |
From: Sanjeewa F. <san...@ho...> - 2009-06-04 01:01:28
|
Hi, I have tried to use html::template for the first time and tried to run the script shown in the synopsis of cpan documentation. #!/usr/bin/perl -w use HTML::Template; # open the html template my $template = HTML::Template->new(filename => 'test.tmpl'); # fill in some parameters $template->param(HOME => $ENV{HOME}); $template->param(PATH => $ENV{PATH}); # send the obligatory Content-Type and print the template output print "Content-Type: text/html\n\n", $template->output; The following error is logged in to error log, failed to open log file fopen: Permission denied [Wed Jun 3 12:38:13 2009] [error] [client 218.215.16.114] Premature end of script headers: /cgi-bin/bpo/test.cgi When I checked with the hosting server admin their reply is they have restricted the use of FOPEN function and to use WGET or CURL. Not sure how to resolve this error could someone please help? Regards, Sanjeewa. _________________________________________________________________ Looking for a new car this winter? Let us help with car news, reviews and more http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT |
From: <ma...@co...> - 2009-04-01 15:12:57
|
just a follow-up to let you know that getting mod_perl working (i didn't realize it was so involved) was the key to speeding things up. you were absolutely correct that the speedup from mod_perl is way more helpful than caching templates. thanks for the help and my apology for accusing html::templates of being slow. :) tom tourists don't know where they've been. travelers don't know where they're going. -- paul theroux |
From: Sam T. <sa...@tr...> - 2009-03-25 01:49:02
|
2009/3/24 mailbin <ma...@co...> > thanks for the fast response, guys. i really appreciate the help. you're > correct that i'm not running mod_perl. i thought simply loading mod_perl > was sufficient but obviously i was wrong, so i'm now in the process of > puzzling how to get this mod_perl thingy working. :) > Cool. The mod_perl mailing list is a good place for questions about that, as is Perl Monks. I think you'll find the speedup from using mod_perl is way more helpful than caching templates! -sam |
From: <ma...@co...> - 2009-03-25 00:44:52
|
thanks for the fast response, guys. i really appreciate the help. you're correct that i'm not running mod_perl. i thought simply loading mod_perl was sufficient but obviously i was wrong, so i'm now in the process of puzzling how to get this mod_perl thingy working. :) cheers, tom tourists don't know where they've been. travelers don't know where they're going. -- paul theroux |
From: Sam T. <sa...@tr...> - 2009-03-24 22:18:44
|
On Tue, Mar 24, 2009 at 5:39 PM, Dawid Joubert <djs...@gm...> wrote: > One problem you may find with the built-in caching is how it determines > if a file has changed. It does this by getting the last modified time of the > file and then comparing it to the cache version. > > You should look into whether the modification time is cached. > Good advice generally, but that doesn't appear to apply here. The log messages show the files coming back with the same cache signature. I'm guessing he's not running mod_perl which makes an in-memory cache pretty useless, or he is and he's not pre-caching during startup. > We wrote our own cache system with a preparser that used memcache. As we > had over 10 webapps servers we only needed to store one copy of the template > and that was on the memcached server. > Memcached is a neat system. -sam |
From: Dawid J. <djs...@gm...> - 2009-03-24 21:40:09
|
One problem you may find with the built-in caching is how it determines if a file has changed. It does this by getting the last modified time of the file and then comparing it to the cache version. You should look into whether the modification time is cached. I do not suggest you use the built-in cache as you should use one caching system for your entire setup. Memcached is the recommended one as once it runs out of memory it will discard the least accessed caches. We wrote our own cache system with a preparser that used memcache. As we had over 10 webapps servers we only needed to store one copy of the template and that was on the memcached server. Regards Dawid Joubert ----- Original Message ----- From: Sam Tregar To: ma...@co... Cc: htm...@li... Sent: Tuesday, March 24, 2009 8:45 PM Subject: Re: [htmltmpl] using cache 2009/3/24 <ma...@co...> as a new user to html::templates i've found it pretty easy to use but quite slow. i've turned on cache'ing but there is still no improvement and apache's log indicates that the files are being loaded each time. so, what am i doing wrong? i've included the perl code i use to create the template and the results shown in apache's log. this shows, i believe, that each file is being loaded each time it's referenced. it also shows another problem, that i encounter every so often, that the file can't be found when, in fact, it's there. if i simply reload the page the file is found the 2nd time. very confusing. Are you running mod_perl? Are you pre-loading your cache during apache startup as described in the docs? And finally, what makes you sure HTML::Template is the source of your performance problem? It's actually pretty rare in my experience. -sam ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ------------------------------------------------------------------------------ _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Sam T. <sa...@tr...> - 2009-03-24 21:06:53
|
2009/3/24 <ma...@co...> > as a new user to html::templates i've found it pretty easy to use but > quite slow. i've turned on cache'ing but there is still no > improvement and apache's log indicates that the files are being loaded > each time. so, what am i doing wrong? i've included the perl code i > use to create the template and the results shown in apache's log. > this shows, i believe, that each file is being loaded each time it's > referenced. it also shows another problem, that i encounter every so > often, that the file can't be found when, in fact, it's there. if i > simply reload the page the file is found the 2nd time. very confusing. > Are you running mod_perl? Are you pre-loading your cache during apache startup as described in the docs? And finally, what makes you sure HTML::Template is the source of your performance problem? It's actually pretty rare in my experience. -sam |
From: <ma...@co...> - 2009-03-24 20:37:42
|
as a new user to html::templates i've found it pretty easy to use but quite slow. i've turned on cache'ing but there is still no improvement and apache's log indicates that the files are being loaded each time. so, what am i doing wrong? i've included the perl code i use to create the template and the results shown in apache's log. this shows, i believe, that each file is being loaded each time it's referenced. it also shows another problem, that i encounter every so often, that the file can't be found when, in fact, it's there. if i simply reload the page the file is found the 2nd time. very confusing. any help is greatly appreciated. thanks, tom code snippet: $tmpl = new HTML::Template(filename => "$page.html", die_on_bad_params => 1, cache => 1, cache_debug => 1); /var/log/apache2/error_log [Tue Mar 24 14:06:11 2009] [notice] Apache/2.2.9 (Unix) PHP/5.2.6 mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations [Tue Mar 24 14:06:26 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : main.html => 2f37e6f23ab3b64bc5f135082a0bdd86, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:06:34 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : main.html => 2f37e6f23ab3b64bc5f135082a0bdd86, referer: http://xwww.meds4vets.biz/index.pl?page=logout [Tue Mar 24 14:06:45 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : aboutus.html => ffcd98c513174dbb29b79e75747db33f, referer: http://xwww.meds4vets.biz/index.pl?page=login [Tue Mar 24 14:06:57 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : aboutus.html => ffcd98c513174dbb29b79e75747db33f, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:07:05 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : products_01.html => e5f8705ae116b48a34bf98650f2f0d91, referer: http://xwww.meds4vets.biz/index.pl?page=aboutus [Tue Mar 24 14:07:13 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : products_02.html => c4627d7e66e4f65f5a00bec98907dd5b, referer: http://xwww.meds4vets.biz/index.pl?page=products_01 [Tue Mar 24 14:07:22 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : products_03.html => d9c4c240921ca93f2e302fdf56e01904, referer: http://xwww.meds4vets.biz/index.pl?page=products_02&name_id=000001 [Tue Mar 24 14:07:33 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : products_02.html => c4627d7e66e4f65f5a00bec98907dd5b, referer: http://xwww.meds4vets.biz/index.pl?page=products_03 [Tue Mar 24 14:08:33 2009] [error] [client 127.0.0.1] HTML::Template- >new() : Cannot open included file products_01.html : file not found. at /Library/Perl/5.8.8/HTML/Template.pm line 1658, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:08:33 2009] [error] [client 127.0.0.1] \tHTML::Template::_init_template('HTML::Template=HASH(0x8b60f0)') called at /Library/Perl/5.8.8/HTML/Template.pm line 1238, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:08:33 2009] [error] [client 127.0.0.1] \tHTML::Template::_init('HTML::Template=HASH(0x8b60f0)') called at / Library/Perl/5.8.8/HTML/Template.pm line 1124, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:08:33 2009] [error] [client 127.0.0.1] \tHTML::Template::new('HTML::Template', 'filename', 'products_01.html', 'die_on_bad_params', 0, 'cache', 1, 'cache_debug', 1, ...) called at /var/vhosts/meds4vets.biz/www/index.pl line 162, referer: http://xwww.meds4vets.biz/index.pl [Tue Mar 24 14:09:02 2009] [error] [client 127.0.0.1] ### HTML::Template Cache Debug ### CACHE LOAD : products_01.html => e5f8705ae116b48a34bf98650f2f0d91 tourists don't know where they've been. travelers don't know where they're going. -- paul theroux |
From: Dan H. <dan...@re...> - 2009-03-18 20:45:39
|
ad...@sp... said: >>> I'm using HTML::Template from CGI::Application. My template is getting >>> data via a SQL query where exactly one row >>> retrieved, and it is displayed using <TMPL_LOOP>. >>> >>> What is the proper way set & display values returned from DBI when only >>> one row is printed? I think the method described below may have a >>> better alternative. >>> >>> >>> Currently showing all records using a loop: >>> >>> 1. $template->param( >>> 2. RESULTS => $self->dbh->selectall_arrayref(' >>> 3. SELECT age, day FROM table WHERE id = ?', >>> 4. { Slice => {} }, >>> 5. $self->session->param('id') ) >>> 6. ); >>> >>> >>> Template: >>> >>> 1. <TMPL_LOOP NAME="RESULTS"> >>> 2. <TMPL_VAR NAME="age"><TMPL_VAR NAME="day"> >>> 3. </TMPL_LOOP> >>> >>Why not use selectrow_hashref()... then you get just the fields? >> >>Mathew > > So how would my above example look different if I used > selectrow_hashref()? My trys aren't working. > > Can you dump the output of the select using your original array_ref? I believe what you have should work, but it could be something that we can't see (e.g. Have you set case sensitivity in your template instantiation? Oracle will return its column names in upper case) |
From: <ad...@sp...> - 2009-03-18 18:46:47
|
>> I'm using HTML::Template from CGI::Application. My template is getting >> data via a SQL query where exactly one row >> retrieved, and it is displayed using <TMPL_LOOP>. >> >> What is the proper way set & display values returned from DBI when only >> one row is printed? I think the method described below may have a >> better alternative. >> >> >> Currently showing all records using a loop: >> >> 1. $template->param( >> 2. RESULTS => $self->dbh->selectall_arrayref(' >> 3. SELECT age, day FROM table WHERE id = ?', >> 4. { Slice => {} }, >> 5. $self->session->param('id') ) >> 6. ); >> >> >> Template: >> >> 1. <TMPL_LOOP NAME="RESULTS"> >> 2. <TMPL_VAR NAME="age"><TMPL_VAR NAME="day"> >> 3. </TMPL_LOOP> >> >Why not use selectrow_hashref()... then you get just the fields? > >Mathew So how would my above example look different if I used selectrow_hashref()? My trys aren't working. |
From: Mathew R. <mat...@ne...> - 2009-03-17 22:51:32
|
> I'm using HTML::Template from CGI::Application. My template is getting > data via a SQL query where exactly one row > retrieved, and it is displayed using <TMPL_LOOP>. > > What is the proper way set & display values returned from DBI when only > one row is printed? I think the method described below may have a > better alternative. > > > Currently showing all records using a loop: > > 1. $template->param( > 2. RESULTS => $self->dbh->selectall_arrayref(' > 3. SELECT age, day FROM table WHERE id = ?', > 4. { Slice => {} }, > 5. $self->session->param('id') ) > 6. ); > > > Template: > > 1. <TMPL_LOOP NAME="RESULTS"> > 2. <TMPL_VAR NAME="age"><TMPL_VAR NAME="day"> > 3. </TMPL_LOOP> > Why not use selectrow_hashref()... then you get just the fields? Mathew |
From: <ad...@sp...> - 2009-03-17 02:47:30
|
I'm using HTML::Template from CGI::Application. My template is getting data via a SQL query where exactly one row retrieved, and it is displayed using <TMPL_LOOP>. What is the proper way set & display values returned from DBI when only one row is printed? I think the method described below may have a better alternative. Currently showing all records using a loop: 1. $template->param( 2. RESULTS => $self->dbh->selectall_arrayref(' 3. SELECT age, day FROM table WHERE id = ?', 4. { Slice => {} }, 5. $self->session->param('id') ) 6. ); Template: 1. <TMPL_LOOP NAME="RESULTS"> 2. <TMPL_VAR NAME="age"><TMPL_VAR NAME="day"> 3. </TMPL_LOOP> -Thanks |
From: Mathew R. <mat...@ne...> - 2009-01-30 03:46:28
|
>> I did some performance profiling of H::T some time ago -> it turns out >> that there is quite a bit of speed up (somewhere between 10% and 10x, >> depending on the page) by re-writing part of the code located around >> line 2660. >> > > Does this pass all the .t tests? If it does then shouldn't this get > accepted into H::T as a patch? Care to supply the change as a diff? > > Sorry for the shameless blog plug, but I only learnt how to use diff and > patch recently and blogged about how to to do:- > http://perl.bristolbath.org/blog/lyle/2009/01/how-to-submit-perl-patches.html#more > Not sure if it passes every test -> I use a heavily modified version of H::T which supports dynamic loading of escape-modules, support for arbitrary TMPL_xxx syntax, an odd bug fix + some other goodies... so I haven't specifically tested it against 2.10. That same reason also makes it hard to generate an isolated patch. I have posted this code before, but AFAICR there wasn't much discussion of merging it. cheers, Mathew |
From: Lyle <web...@co...> - 2009-01-30 00:02:10
|
Mathew Robertson wrote: > >>> Is there a version that works with HTML::Template::Pro? I'm using a >>> template system that loads HTML::Template::Pro if available (for the >>> speed enhancements) >>> >> >> Really? Did you do benchmarks and find that your templating was bottleneck? And if so, how much of a >> gain did you get from HTML::Template::Pro? If page takes 1 sec to create on the server and your >> templating takes only 10% of your execution time (and I've never had a real page where that was the >> case, it's usually closer to 2-5%) and you increase the speed of your templating by 25x (that's the >> max claimed by H::T::P) then you've taken a full 0.096 sec off. > I did some performance profiling of H::T some time ago -> it turns out > that there is quite a bit of speed up (somewhere between 10% and 10x, > depending on the page) by re-writing part of the code located around > line 2660. Does this pass all the .t tests? If it does then shouldn't this get accepted into H::T as a patch? Care to supply the change as a diff? Sorry for the shameless blog plug, but I only learnt how to use diff and patch recently and blogged about how to to do:- http://perl.bristolbath.org/blog/lyle/2009/01/how-to-submit-perl-patches.html#more Lyle |
From: Mathew R. <mat...@ne...> - 2009-01-29 23:42:38
|
>> Is there a version that works with HTML::Template::Pro? I'm using a >> template system that loads HTML::Template::Pro if available (for the >> speed enhancements) >> > > Really? Did you do benchmarks and find that your templating was bottleneck? And if so, how much of a > gain did you get from HTML::Template::Pro? If page takes 1 sec to create on the server and your > templating takes only 10% of your execution time (and I've never had a real page where that was the > case, it's usually closer to 2-5%) and you increase the speed of your templating by 25x (that's the > max claimed by H::T::P) then you've taken a full 0.096 sec off. > > That little gain is just not worth it to me if you have to jump through hoops to make other things > with with the module (like you're trying to do with H::T::Sec). Plus it doesn't support query() > which I find extremely handy. > I did some performance profiling of H::T some time ago -> it turns out that there is quite a bit of speed up (somewhere between 10% and 10x, depending on the page) by re-writing part of the code located around line 2660. hope this helps, Mathew patch -> replace the options{associate} conditional with this: # support the associate magic, searching for undefined params and # attempting to fill them from the associated objects. if (scalar(@{$options->{associate}})) { my @undef_params; foreach my $param (keys %{$self->{param_map}}) { next if (defined $self->param($param)); push @undef_params, $param; } if (scalar(@undef_params)) { my $value; # if case sensitive mode or no CGI objects, we can use the fast path if ($options->{case_sensitive} or (grep { !/^1/ } map { UNIVERSAL::isa($_,'HTML::Template') } @{$options->{associate}}) == 0) { foreach my $param (@undef_params) { foreach my $associated_object (reverse @{$options->{associate}}) { $value = $associated_object->param($param); next unless (defined $value); $self->param($param, scalar $value); last; } } } else { my %case_map; foreach my $associated_object (@{$options->{associate}}) { map { $case_map{$associated_object}{lc($_)} = $_ } $associated_object->param(); } my $associated_param; foreach my $param (@undef_params) { foreach my $associated_object (reverse @{$options->{associate}}) { $associated_param = $case_map{$associated_object}{$param}; next unless (defined $associated_param); $value = $associated_object->param($associated_param); next unless (defined $value); $self->param($param, scalar $value); last; } } } } } |
From: Michael P. <mp...@pl...> - 2009-01-29 21:26:38
|
Lyle wrote: > Is there a version that works with HTML::Template::Pro? I'm using a > template system that loads HTML::Template::Pro if available (for the > speed enhancements) Really? Did you do benchmarks and find that your templating was bottleneck? And if so, how much of a gain did you get from HTML::Template::Pro? If page takes 1 sec to create on the server and your templating takes only 10% of your execution time (and I've never had a real page where that was the case, it's usually closer to 2-5%) and you increase the speed of your templating by 25x (that's the max claimed by H::T::P) then you've taken a full 0.096 sec off. That little gain is just not worth it to me if you have to jump through hoops to make other things with with the module (like you're trying to do with H::T::Sec). Plus it doesn't support query() which I find extremely handy. -- Michael Peters Plus Three, LP |
From: Lyle <web...@co...> - 2009-01-29 21:15:25
|
Roger Burton West wrote: > On Thu, Jan 29, 2009 at 03:21:59AM +0000, Lyle wrote: > > >> But that doesn't work. Is there a way to pickup data from a template >> you've read in? >> > > This is quite a common question, and the answer is "yes". My own > HTML::Template::Set extension is one approach. See the list archives. > Is there a version that works with HTML::Template::Pro? I'm using a template system that loads HTML::Template::Pro if available (for the speed enhancements) otherwise defaults to the normal HTML::Template. I'd need to be able to use HTML::Template::Set with both of them. Lyle |
From: Lyle <web...@co...> - 2009-01-29 12:15:34
|
Roger Burton West wrote: > On Thu, Jan 29, 2009 at 03:21:59AM +0000, Lyle wrote: > > >> But that doesn't work. Is there a way to pickup data from a template >> you've read in? >> > > This is quite a common question, and the answer is "yes". My own > HTML::Template::Set extension is one approach. See the list archives. > Hi Roger, Excellent! Just what I was looking for. My bad I should have thought to look in the HTML::Template namespace. Lyle |