http://www.perlmonks.org?node_id=284537


in reply to Re: Re: DBI recipes
in thread DBI recipes

Error checking is an idiom in itself.

Is it? If you were to discuss idiom for reading in a file line-by-line, would you present something like:

open my $fh, "/path/to/file"; while (<$fh>) { chomp; ... }

and dismiss the checking of the return value of open "it being an idiom in itself"? Error checking should be part of the idiom, and not something you bolt on later, when you are more experienced.

Abigail
--
Now that you have passed your driving test, let me introduce you to the function of safety belts.

Replies are listed 'Best First'.
Re: Re: DBI recipes
by demerphq (Chancellor) on Aug 18, 2003 at 18:11 UTC

    would you present something like:

    Hmm, I guess you would be upset with me if I wrote that as

    @ARGV=qw(/path/to/file); while (<>) { chomp; ... }

    which of late ive taken to doing in quick and dirty scripts? *grin*


    ---
    demerphq

    <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...
      Hmm, I guess you would be upset with me if I wrote that as
      ...
      which of late ive taken to doing in quick and dirty scripts?

      Only if you present that as "Perl idiom" in a tutorial.

      Abigail