Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: DBI conditional insert (and things of those nature)

by Masem (Monsignor)
on Jan 26, 2002 at 03:04 UTC ( #141681=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: DBI conditional insert (and things of those nature)
in thread DBI conditional insert (and things of those nature)

True, though I'm not a big fan a RaiseError in production code (as it sorta hides what you are trying to do). But the original code had a bare execute() outside of an eval block, and this is the key step that would be need an error check if the unique ID route was taken.

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important


Comment on Re: Re: Re: DBI conditional insert (and things of those nature)
On using RaiseError
by lachoy (Parson) on Jan 26, 2002 at 09:51 UTC

    I strongly disagree about RaiseError. It forces you to wrap every DBI call in an eval block. While people are free to ignore $@ after the block, those same people are much more likely to not do any error checking at all. The eval block at least turns on the siren that they should be doing something, much like try/catch blocks in Java.

    All MO, of course :-)

    Chris
    M-x auto-bs-mode

      To the experienced user, RaiseError is a good thing, and as you say, it does force you to wrap things into eval loops to handle errors. However, newer programmers may forget to wrap the DBI calls in evals, or will write several lines of DBI code that don't fail to work, and then be completely confused when something small changes and their program dies, and they'll be wondering what went wrong. I'd rather see people not used to DBI or perl in general use the "or die" approach, such that they understand that every "prepare" and "execute" statment in DBI should be checked for errors. Once they've understood that, then moving them on to RaiseError and eval's are a good thing. But again, IMO as well.

      -----------------------------------------------------
      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      "I can see my house from here!"
      It's not what you know, but knowing how to find it if you don't know that's important

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-07-30 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls