Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by Sifmole (3409) on 2003.09.17 11:04 (#24271)
    I don't understand why people keep all kinds of status flags and hold off until the end of a routine to "return". If you know that you will do nothing after a failure at:

          if (!$dbh) {
                    $ok = 0;
                    $msg = "Failed to get connection to databasename in GetValues";
            } else {
                    $sth = $dbh->prepare('Select * from table_name');

    Why not just return instead of checking $ok over and over again later? I would do...

          if (!$dbh) {
                    return (0, "Failed to get connection to databasename in GetValues", \@a);

    $sth = $dbh->prepare('Select * from table_name');