GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DBIx::Tracer(3) User Contributed Perl Documentation DBIx::Tracer(3)

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.

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.

2015-09-08 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.