CGI::Application::Plugin::DBIProfile - DBI profiling plugin


NAME

CGI::Application::Plugin::DBIProfile - DBI profiling plugin


SYNOPSIS

    # Set env in apache or in perl.
    $ENV{DBI_PROFILE} = '2/CGI::Application::Plugin::DBIProfile::Driver';
    use CGI::Application::Plugin::DevPopup;
    use CGI::Application::Plugin::DBIProfile;
    The rest of your application follows
    ...


INSTALLATION

To install this module, run the following commands:

    perl Makefile.PL
    make 
    make test
    make install


DESCRIPTION

CGI::Application::Plugin::DBIProfile provides popup (using CAP::DevPopup if available) holding DBI Profile information (see the DBI::Profile manpage, the DBI::ProfileDumper manpage). It will output both graphed output and a DBI::ProfileDumper report.


CONFIGURATION

To enable, set the DBI_PROFILE environment variables. For example

in apache config for cgi
    SetVar DBI_PROFILE 2/CGI::Application::Plugin::DBIProfile::Driver
    SetVar CAP_DBIPROFILE_EXEC 1
in apache config for mod_perl
    PerlSetVar DBI_PROFILE 2/CGI::Application::Plugin::DBIProfile::Driver
    PerlSetVar CAP_DBIPROFILE_EXEC 1
in your CAP module
    BEGIN {
        $ENV{DBI_PROFILE} = '2/CGI::Application::Plugin::DBIProfile::Driver';
        $ENV{CAP_DBIPROFILE_EXEC} = 1;
    }

If you disable it, be sure to unset the DBI_PROFILE env var, as it will continue to accumulate stats regardless of the setting of CAP_DBIPROFILE_EXEC, you just won't see them.

MODES OF OPERATION

It has two modes of opperation; per-request or per-process. In a CGI environment, there is no difference.

per-request - this is the default.
per-process - set the following env var to a true value.
    CAP_DBIPROFILE_PERPROCESS 1

Under mod_perl, the per-request setup will show the DBI Profile specific to each page hit. The per-process setup will show the DBI Profile that has accumulated for the life of the apache process you are hitting.

Please note, running under the per-process setting can cause your memory usage to grow significantly, as the profile data is never cleared.

GRAPHING PLUGINS

The default graphing module is the CGI::Application::Plugin::DBIProfile::Graph::HTML manpage, which generates a minimal inline HTML graph. To change which graphing plugin is used, it's just another environment variable (no need to set this if you like the default).

    CAP_DBIPROFILE_GRAPHMODULE Your::Graph::Module::Name

Please see the CGI::Application::Plugin::DBIProfile::Graph::HTML manpage for information on writing new graph modules.


TODO

Tests. None exist at this time.

Other graphing plugins (Plotr, Open Flash Chart, GraphML using Graph::Easy).

Add checks to be sure $dbh->{Profile} isn't disabled (probably better in ::Driver).


REQUIREMENTS

the Data::JavaScript manpage
the IO::Scalar manpage
the HTML::Template manpage

Optional:


SEE ALSO

the CGI::Application manpage
the CGI::Application::Plugin::DevPopup manpage
the CGI::Application::Plugin::DBIProfile::Data manpage
the CGI::Application::Plugin::DBIProfile::Driver manpage
the CGI::Application::Plugin::DBIProfile::Graph::HTML manpage
the CGI::Application::Plugin::DBIProfile::Graph::HTML::Horizontal manpage
the CGI::Application::Plugin::DBIProfile::Graph::HTMLBarGraph manpage
the CGI::Application::Plugin::DBIProfile::Graph::GDGraphInline manpage
the CGI::Application::Plugin::DBIProfile::Graph::SVGTT manpage


SPECIAL THANKS

To Sam Tregar, for the original codebase on which this was based, and DBI::ProfileDumper itself.


AUTHOR

    Sam Tregar, C<< <sam@tregar.com> >>
    Joshua I Miller, C<< <unrtst@cpan.org> >>


BUGS

Please report any bugs or feature requests to bug-cgi-application-plugin-dbiprofile@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


COPYRIGHT & LICENSE

Copyright 2007 Joshua Miller, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.