Data::Printer::Filter::DB - pretty-printing database objects (DBI, DBIx::Class, etc)
In your .dataprinter file:
.dataprinter
filters = DB
You may also customize the look and feel with the following options:
filter_db.expand_dbh = 1 # you can even customize your themes: colors.filter_db_connected = #00cc00 colors.filter_db_disconnected = #cc0000
That's it!
This is a filter plugin for Data::Printer that displays (hopefully) more relevant information on database objects than a regular dump.
If it's a database handle, for example, this filter may show you something like this:
SQLite Database Handle (connected) { dbname: file.db Auto Commit: 1 Statement Handles: 2 (1 active) Last Statement: SELECT * FROM some_table }
And if you have a statement handler like this (for example):
my $sth = $dbh->prepare('SELECT * FROM foo WHERE bar = ?'); $sth->execute(42); use DDP; p $sth;
This is what you'll get:
SELECT * FROM foo WHERE bar = ? (42)
Note that if your driver does not support holding of parameter values, you'll get a bindings unavailable message instead of the bound values.
bindings unavailable
Data::Printer
To install Data::Printer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Printer
CPAN shell
perl -MCPAN -e shell install Data::Printer
For more information on module installation, please visit the detailed CPAN module installation guide.