in reply to RE: RE: Re: DBI dots
in thread DBI dots

This may be true, but using {RaiseError} gets you into good habits, just like use strict does -- it might be painful at first, but after you get used to it you never have to worry about certain annoying little things again. This leaves your mind ready for certain annoying big things :)

Replies are listed 'Best First'.
RE: RE: RE: RE: Re: DBI dots
by merlyn (Sage) on Oct 23, 2000 at 21:05 UTC
    Yes, and you can always use an eval {} block around a bunch of code, or a local value for RaiseError in a block.

    The default should still be die to require you to think about why something might break. Yes, it's like use strict.

    -- Randal L. Schwartz, Perl hacker

      You're right, I was leaving too much unsaid. Even examples I post to the DBI list look like:

      my ( $sth ); eval { $sth = $dbh->prepare( qq/ select blech from blah / ); $sth->execute; }; if ( $@ ) { die "Something screwed up! Error: $@"; } ...

      That's how much I've drilled it into myself. I even dream in eval {} blocks! (Takes care of all those nasty nightmares...)

        I must say, that does look cool. It would be the better way to do it. I have yet to make any real use of eval()...to my shame. but i suppose it is just this sort of thing it comes in handy for. thanks.

        "sometimes when you make a request for the head you don't
        want the big, fat body...don't you go snickering."
                                                 -- Nathan Torkington UoP2K a.k.a gnat