Hi list, I am happy to say that I haven't run into any problems using Mathew's patch. It's exactly what I wanted/needed! Thanks!
I do have a feature request though: Currently if I leave out 2 params, it only notifies me that one of them is missing. It would be nice if I was told when both were missing. This issue applies to die_on_bad_params as well, but it's slightly more subtle, because the dying point is different. With die_on_bad_params, you die as soon as the param is set, so no list of bad_params could accumulate. (unless of course you wait until $template->output() to die). Also, I've noticed that if I comment out a <tmpl_var ...> in the template file, die_on_missing_params still thinks I should set it. Likewise, if I set a parameter that has been commented out, die_on_bad_params remains silent. Perhaps this is the intended behavior... after all, somebody may want to fill in html comments from the code. And adding a new comment syntax to template files would detract from it's great simplicity. Besides, commenting out code is considered bad practice anyway, isn't it? :) Again, thanks for the patch! Josh "Ua" Ball On 5/31/07, Mathew Robertson <[EMAIL PROTECTED]> wrote: > > Hi List, > > Patch sent directly to Josh so as to avoid the list noise. If people are > interested, I will post it (and the test cases). > > cheers, > Mathew > > > > Joshua Ball wrote: > Hi Mathew, > > (This is the same Josh as @highgatecross. My e-mail there is down, so > I subscribed from another address. :->) > > That's exactly what I'm looking for. I'm dealing with legacy code > which has highly nested includes in the templates. From what I've been > able to tell, I don't think the original coder relied on implicit > undefness. My main concern is that I want to be warned if there are > subs that I ought to be calling (to fill in template parameters in > things like headers and footers). It's especially easy to overlook > when the tmpl_var's are used for "hidden" information, like URLs and > hidden form fields. > > Where can I find your patch? > > Thanks again, > Josh "Ua" Ball > > On 5/31/07, Mathew Robertson > <[EMAIL PROTECTED]> wrote: > > > Short answer: no there isn't such a feature. > > However I do have a patch I use to add this ability - with one caveat... > the patch changes the behaviour such that if your code never implemented: > > $ht->param(parm_name => undef); > > but did rely on the undef'ness of param_name, then your code would need the > above line added where appropriate. I found that I would often write: > > $ht->param(param_name => get_something()); > > so param_name would be explicitely set to undef, and so the patch works for > me. > > Mathew Robertson > > > > > Joshua wrote: > Greetings. > > (I'm sorry if I double posted this. However, the first time I sent it, I was > not subscribed to the mailing list, so I don't think it went through.) > > I find the "die_on_bad_params => 1" to be a very useful feature. Setting it > to 0 is kind of like debugging Perl without "use strict;". > > However, die_on_bad_params only does half the job. It dies if I try to set > non-existent vars, but it does nothing if I forget to set an existing var. > Is there a way (such as a die_on_missing_params option) that I can turn on > some such warning system? (Perhaps there are some extensions to > HTML::Template that do this?) > > Any help is appreciated. > > Josh "Ua" Ball > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Html-template-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Html-template-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Html-template-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Html-template-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/html-template-users > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users