Can anyone explain to me WHY I must constantly forget and relearn that:
my $sth = $dbh->prepare("SELECT * FROM Something");
$sth->execute();
if($sth->err()){ die $sth->errstr(); }
is functionally equivalent to
my $sth = $dbh->prepare("SELECT * FROM Something");
$sth->execute();
if($dbh->err()){ die $dbh->errstr(); }
???
Because every couple of years I will become frustrated with typing out the error check on the various statement handles.
And then look into how I can make that easier.
And RE-LEARN that I could have been checking the database handle and just copy/pasting that over and over.
So frustrating, a real smack-to-the-forehead kind of moment.
And I think it ties in with why I write code the way I do. I WRITE IT OUT. I take the time to format and indent and line up the code because I have learned 6-months-in-the-future-me will really appreciate it and I don't want him cussing at me, retroactively.
Just needed to vent a little bit, please return to your regularly scheduled activities.