As a thought, you could try something like this: print Dumper($ht->{param_map}); I haven't tested it, but it may work... Mathew Boon Chew wrote: Thanks Carl, useful tip. Taking your idea one step further, I think having an option such asshow_all_params => 1 that shows all the params passed to the template in a Dumper fashion will be quite useful. - boon --- Carl Franks <[EMAIL PROTECTED]> wrote:If you make sure die_on_bad_params => 1 is set in your HTML::Template constructor, then any variable which isn't set in the template, or is misspelt will cause the page to die - the designer can then tell what's wrong by simply looking at the error message. Carl On 02/12/05, Boon Chew <[EMAIL PROTECTED]> wrote:Well, I guess I should have explained the need ofthiswith a more solid real world use case. Recently I am involved in a project using Krang, aCMSsystem written in Perl that utilizesHTML::Template.Now here is the thing, we are fairly new to thecodebase, but in a few days of going through the codeandpoking around the code, we were able to implement quite a few new features for the client. But our understanding of the system is stillimmatureand incomplete, and there are times the templatevaris being set somewhere in the inheritance chain,andwe know a template can access a specific variable (through incomplete doc and tmpl_if test), butthereis no way to know how to access the variablewithoutgoing through the code tracing out where and whatissent to the template. And what if thedocumentationmisses talking about a var that is sent to the template? No one you can find out unless you poke around the code, but the process can be timeconsumingas not all the templates are being set in one file (due to OO). I find it surprising that people expect problemscanbe solved with documentation, or communicationwiththe frontend folks. In the real world,documentationis never as complete as should, I mean, it's hard enough to get some to comment their code! And inthereal world, you don't always start a project withcodethat you have written as well. The need to beable tointrospect and access what is sent to the template without having the perl code is a useful and justifiable feature of any server-side scripting framework. - boon --- "Webmaster Techcode.NET"<[EMAIL PROTECTED]>wrote:----- Original Message ----- From: Boon Chew I want a way to quickly display all the info inavar - a Dumper output if you will. But morethanthat, like in some other server-side language,youcan query the column lists (or hash keys) andloopthrough those and use a piece of generic codewhenall you intend to do is to display everything inthevar. ----- Original Message ----- I agree - something like Data::Dumper in HTML::Template context would be great. And you can also "you can query the column lists(orhash keys) and loop through those" in Perl justlikein any other server-side language ... foreach(@array){ print $_,"\n<br>"; } ----- Original Message ----- The tight coupling of knowledge between what'sbeingsent from the perl code and the HTML can beavoided,that's the whole point of the design of thetemplatemodule (vs Mason where you mingle Perl code with display code) right? It just seems ugly when Ihaveto tell a designer to go look at the perl filetosee what he is getting in the var. He should be able to find that out fro m some sensible constructs. ----- Original Message ----- You missed the point ... I mean - designer shouldn't need to take a lookatPerl code to figure out what you are outputing...And "some sensible constructs" are documentsthatfolow every project. Have you ever heared oftermslike API or Interface? You and you designer needtoagree on "Interface" - in your case the data hecanuse in the template ... Anyway - the quick and simple solution that just crossed my mind ;) Make something a rule - for each template - you could create a special variable. Say you canname it: "the_dump" or whatever. And simply dump via Data::Dumper all variablesthatyou (plan) populate the template with - or sendtotemplate. Actualy - this could be made as part of HTML-Template ... Anyway - then your designer could just add<tmpl_varname="the_dump"> at the end of the template ifhe isnot sure what data he can access. Of course - next thing he will complain is whyinthe hell he can't do a preview in Dreamweaverwithtest data already populated ... Cheers, Alex. N¬HY޵隊X¬²š'²ŠÞu¼'¦[§?‰ÜŒ¨º Þ¦Øk¢è!–ˆŠW¬~Šé(r)†åzk¶ŠC£å¡§m…éÞÀ[EMAIL PROTECTED]ÇšÈ^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë±æ¬É«,º·âža{›å?,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'ïûjYhr'ׯ:æŠrXœ?{f–צ¦Vzë(r)ÉšŠX§‚X¬´{f–צ¦Vzë(r)Éb²Û,¢êÜyú+?éÞ¶m¦Ïÿ–+-²Ê.ÇŸ¢¸?ë–+-³ùb²Ø§~?á¶imzjej×(r)±êì__________________________________________ Yahoo! DSL – Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com-------------------------------------------------------This SF.net email is sponsored by: Splunk Inc. Doyou grep through log filesfor problems? Stop! Download the new AJAX searchengine that makessearching your log files as easy as surfing theweb. DOWNLOAD SPLUNK!http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click_______________________________________________ Html-template-users mailing list=== message truncated === __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users |
- Re: [htmltmpl] loop through a... Mathew Robertson
- Re: [htmltmpl] loop through a... Boon Chew
- Re: [htmltmpl] loop through a... Mathew Robertson
- Re: [htmltmpl] loop through a... Boon Chew
- Re: [htmltmpl] loop through a... Jonathan Lang
- Re: [htmltmpl] loop through a... Webmaster Techcode.NET
- Re: [htmltmpl] loop through a... Boon Chew
- Re: [htmltmpl] loop through a... Carl Franks
- Re: [htmltmpl] loop through a... Octavian Rasnita
- Re: [htmltmpl] loop through a... Boon Chew
- Re: [htmltmpl] loop through a... Mathew Robertson
- Re: [htmltmpl] Re: HTML::Template bug report: Probl... Mathew Robertson