Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Two tips for developing with HTML::Template

by seattlejohn (Deacon)
on Jan 08, 2003 at 03:08 UTC ( #225151=note: print w/ replies, xml ) Need Help??


in reply to Two tips for developing with HTML::Template

Rather than changing your coding habits to wrap all the template-related calls in eval, wouldn't it be simpler to use CGI::Carp qw(fatalsToBrowser) at the beginning of your script, or perhaps set up a $SIG{__DIE__} handler? Or is there something unusual about the way that HTML::Template dies that makes this inappropriate?

        $perlmonks{seattlejohn} = 'John Clyman';


Comment on Re: Two tips for developing with HTML::Template
Re: Re: Two tips for developing with HTML::Template
by dws (Chancellor) on Jan 08, 2003 at 03:21 UTC
    Wouldn't it be simpler to use CGI::Carp qw(fatalsToBrowser) at the beginning of your script, or perhaps set up a $SIG{__DIE__} handler?

    Both of those are reasonable approaches, though I found that using eval gave me a bit more control. With an eval, you can make a case-by-case decision to continue or really die. Some HTML::Template errors, particularly complaints about parameters, are safe to continue past when you're debugging.

      Ah, I see... though I would probably be inclined to zero HTML::Template's die_on_bad_params if I just wanted to continue past non-fatal errors while debugging.

      I guess as a matter of principle I tend to prefer handling the die-now-or-let-it-slip logic on a more global level rather than sprinkling the checking throughout the code. Then I can toggle it on or off globally, define different handlers for debug vs. production behavior in one place, and not have to worry about remembering anything extra when I'm coding the core page-generation logic.

              $perlmonks{seattlejohn} = 'John Clyman';

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://225151]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-07-13 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls