.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Data::Printer::Filter::DB 3pm" .TH Data::Printer::Filter::DB 3pm "2016-04-27" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Data::Printer::Filter::DB \- pretty printing database objects .SH "SYNOPSIS" .IX Header "SYNOPSIS" In your program: .PP .Vb 3 \& use Data::Printer filters => { \& \-external => [ \*(AqDB\*(Aq ], \& }; .Ve .PP or, in your \f(CW\*(C`.dataprinter\*(C'\fR file: .PP .Vb 5 \& { \& filters => { \& \-external => [ \*(AqDB\*(Aq ], \& }, \& }; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a filter plugin for Data::Printer. It filters through \s-1DBI\s0's handlers (dbh) and statement (sth) objects displaying relevant information for the user. It also filters any object which inherits from DBIx::Class::Schema, DBIx::Class::ResultSet or DBIx::Class::ResultSetColumn. .SS "\s-1DBI\s0 Sample Output" .IX Subsection "DBI Sample Output" \&\s-1DBI\s0 is an extremely powerful and complete database interface. But it does a lot of magic under the hood, making their objects somewhat harder to debug. This filter aims to fix that :) .PP For instance, say you want to debug something like this: .PP .Vb 2 \& use DBI; \& my $dbh = DBI\->connect(\*(Aqdbi:DBM(RaiseError=1):\*(Aq, undef, undef ); .Ve .PP A regular Data::Dumper output gives you absolutely nothing: .PP \&\f(CW$VAR1\fR = bless( {}, 'DBI::db' ); .PP Data::Printer makes it better, but only to debug the class itself, not helpful at all to see its contents and debug your own code: .PP .Vb 8 \& DBI::db { \& Parents DBI::common \& Linear @ISA DBI::db, DBI::common \& public methods (48) : begin_work, clone, column_info, commit, connected, data_sources, disconnect, do, foreign_key_info, get_info, last_insert_id, ping, prepare, prepare_cached, preparse, primary_key, primary_key_info, quote, quote_identifier, rollback, rows, selectall_arrayref, selectall_hashref, selectcol_arrayref, selectrow_array, selectrow_arrayref, selectrow_hashref, sqlite_backup_from_file, sqlite_backup_to_file, sqlite_busy_timeout, sqlite_collation_needed, sqlite_commit_hook, sqlite_create_aggregate, sqlite_create_collation, sqlite_create_function, sqlite_enable_load_extension, sqlite_last_insert_rowid, sqlite_progress_handler, sqlite_register_fts3_perl_tokenizer, sqlite_rollback_hook, sqlite_set_authorizer, sqlite_update_hook, statistics_info, table_info, tables, take_imp_data, type_info, type_info_all \& private methods (0) \& internals: { \& } \& } .Ve .PP Fear no more! If you use this filter, here's what you'll see: .PP .Vb 6 \& SQLite Database Handle (connected) { \& dbname: file.db \& Auto Commit: 1 \& Statement Handles: 0 \& Last Statement: \- \& } .Ve .PP Much better, huh? :) .PP Statement handlers are even better. Imagine you continued your code with something like: .PP .Vb 2 \& my $sth = $dbh\->prepare(\*(AqSELECT * FROM foo WHERE bar = ?\*(Aq); \& $sth\->execute(42); .Ve .PP With this filter, instead of an empty dump or full method information, you'll get exactly what you came for: .PP .Vb 1 \& SELECT * FROM foo WHERE bar = ? (42) .Ve .PP Note that if your driver does not support holding of parameter values, you'll get a \&\f(CW\*(C`bindings unavailable\*(C'\fR message instead of the bound values. .SH "SEE ALSO" .IX Header "SEE ALSO" Data::Printer, Data::Printer::Filter