A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Perl: Debugging DBIx::Class with DBI

If your code uses DBIx::Class, but you want to debug using DBI:

     while (my ($name, $s) = each %{{
         'MySQL' => ...->get_schema(),
         'SQLite' => ...->get_schema(),
     }}) {
         diag("\n\n>> $name schema\n\n");
         foreach my $table qw(a b c) {
             my $r;
             eval { $r = $s->storage->dbh->selectall_arrayref("SELECT * FROM $table"); };
             if ($@) { note("No table $table"); }
             else { note(scalar(@$r)." rows in $table"); }
         }
     }