DBIx::Tracer - Easy tracer for DBI
use DBIx::Tracer; my $tracer = DBIx::Tracer->new( sub { my %args = @_; say $args{dbh}; say $args{time}; say $args{sql}; say "Bind: $_" for @{$args{bind_params}}; } );
DBIx::Tracer is easy tracer for DBI. You can trace a SQL queries without modifying configuration in your application.
You can insert snippets using DBIx::Tracer, and profile it.
DBIx::Tracer uses Scope::Guard-ish guard object strategy.
DBIx::Tracer->new installs method modifiers, and DBIx::Tracer->DESTROY uninstall method modifiers.
DBIx::Tracer->new
DBIx::Tracer->DESTROY
You must keep the instance of DBIx::Trace in the context.
my $tracer = DBIx::Tracer->new( sub { ... } );
Create instance of DBIx::Tracer. Constructor takes callback function, will call on after each queries executed.
You must keep this instance you want to logging. Destructor uninstall method modifiers.
DBIx::Tracer passes following parameters to callback function.
instance of $dbh.
SQL query in string.
binded parameters for the query in arrayref.
Elapsed times for query in floating seconds.
I don't want to modify DBI configuration in my application for tracing.
Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
xaicron is author of DBIx::QueryLog. Most part of DBIx::Tracer was taken from DBIx::QueryLog.
DBIx::QueryLog
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBIx::Tracer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Tracer
CPAN shell
perl -MCPAN -e shell install DBIx::Tracer
For more information on module installation, please visit the detailed CPAN module installation guide.