On Thu, Feb 01, 2001 at 10:09:57AM -0000, David Adams wrote:
> I'm new to the DBI module and have had no previous experience of the OO
> style which the DBI module uses. I'm puzzled by some of the examples given
> in the DBI perldoc, for example:
>
> $dbh = DBI->connect($data_source, $username, $password)
> || die $DBI::errstr;
>
> Am I wrong to think that this is better coded as:
>
> ( $dbh = DBI->connect($data_source, $username, $password))
> || die $DBI::errstr;
>
> What if the call to 'die' was replaced by some other action, eg 'warn', or
> some other error handing routine?
Few people like adding the extra parenthesis. Some people prefer:
$foo = blah or die "...";
which would work more as expected if the die was changed to a warn
because the 'or' has a lower precidence than the assignment.
Tim.