Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Re: Two tips for developing with HTML::Template

by dws (Chancellor)
on Jan 08, 2003 at 03:21 UTC ( #225154=note: print w/replies, xml ) Need Help??

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

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.

Replies are listed 'Best First'.
Re: Re: Re: Two tips for developing with HTML::Template
by seattlejohn (Deacon) on Jan 08, 2003 at 04:44 UTC
    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://225154]
[GotToBTru]: late to the conversation .. but thanks, Corion, for the reminder about Perl::Tidy
[Corion]: GotToBTru: Heh ;) I'm not really endorsing it, as I found that any gains made through it are easily squandered by the hours spent on configuring it. At least in my case :)
[GotToBTru]: Like most Swiss Army Knives, you can cut yourself trying to find the blade you actually want
[GotToBTru]: i am satisfied with the default settings turning the seemingly random formatting into something reliable
[Corion]: GotToBTru: Yeah, I started a quick(ly implemented but slowly running) implementation of a program that would guess the "best" configuration (that is, least amount of changes) from my code, but then found that it stops parsing the source as soon as it ..
[GotToBTru]: sadly, it can't do anything about this
[Corion]: ... encounters sub foo($bar,$baz) {, which is something I like nowadays
[Corion]: GotToBTru: Yeah, that stuff is hard to do away automatically ;)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2017-02-27 14:30 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (387 votes). Check out past polls.