CGI-Application-Plugin-DBIProfile

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        BUGFIX: rt 29670 : Duplicate titles in reports.
        BUGFIX: rt 29669 : Add summary to DevPopup report.
        BUGFIX: rt 29668 : Unable to set ENV vars via PerlSetVar.
        BUGFIX: rt 29667 : DBI profile environment var should be UPPER CASE.
        BUGFIX: rt 29666 : Typo in callback for CAP::DevPopup report.

0.04    2007-09-27
        Added Graph::SVGTT plugin.
        Added Graph::GDGraphInline plugin.
        Added catch for non-html docs, so we don't run then.
        BUGFIX: for devpopup support (typo in sub reference name).

0.03    2007-09-26
        Made graphing a plugin, and wrote custom (simple) HTML graph plugin.
        First CPAN release.

0.02    2007-09-26
        Alpha of rewrite by Joshua Miller.
        Uses new DBI::Profile driver that uses IO::Scalar for storage.
        Graphs are inline html (using HTML::BarGraph, which is broken).

lib/CGI/Application/Plugin/DBIProfile.pm  view on Meta::CPAN

use vars qw($VERSION);

our $VERSION = '0.07';

sub import
{
    my $c = scalar caller;
    if ($ENV{CAP_DBIPROFILE_EXEC})
    {
        $c->add_callback( 'prerun', \&_start );
        # use devpopup if installed, or do our own thing.
        if ($c->can('devpopup') && $ENV{'CAP_DEVPOPUP_EXEC'})
        {
            $c->add_callback( 'devpopup_report', \&_devpopup_stop);
        } else {
            $c->add_callback( 'postrun', \&_stop);
        }
    }
}

# _start : clear anything that is currently stored (incase stuff ran without us)
sub _start
{
    my $self = shift;

lib/CGI/Application/Plugin/DBIProfile.pm  view on Meta::CPAN

    my $template = HTML::Template->new(scalarref        => \$TEMPLATE2 );
    $template->param(page_body => _build_content($self) );

    my $content = $template->output();

    _open_window($self, $content, $output);

    _empty_profile();
}

# _devpopup_stop : similar to _stop, but compatable with CAP:DevPopup
sub _devpopup_stop
{
    my $self = shift;
    my $output = shift;

    my $content = _build_content($self);

    $self->devpopup->add_report(
        title => 'DBI Profile',
        summary => 'DBI statement profiling',
        report => qq(
        <style type="text/css">
        tr.even{background-color:#eee}
        </style>
        <table><tbody> $content </tbody></table>
        )
    );

lib/CGI/Application/Plugin/DBIProfile.pm  view on Meta::CPAN


To install this module, run the following commands:

    perl Makefile.PL
    make 
    make test
    make install

=head1 DESCRIPTION

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

=head1 CONFIGURATION

To enable, set the DBI_PROFILE environment variables. For example

=over

=item in apache config for cgi

    SetVar DBI_PROFILE 2/CGI::Application::Plugin::DBIProfile::Driver



( run in 1.985 second using v1.01-cache-2.11-cpan-364913b4093 )