Catalyst::Plugin::DBIC::Schema::Profiler - Profile time query took with DBIC::Schema in your Catalyst application.


Catalyst-Plugin-DBIC-Schema-Profiler documentation Contained in the Catalyst-Plugin-DBIC-Schema-Profiler distribution.

Index


Code Index:

NAME

Top

Catalyst::Plugin::DBIC::Schema::Profiler - Profile time query took with DBIC::Schema in your Catalyst application.

SYNOPSIS

Top

  # MyApp.pm
  use Catalyst qw/
      ...
      DBIC::Schema::Profiler    # Load this plugin.
      ...
    /;

  


  # myapp.yml
  DBIC::Schema::Profiler:
      MODEL_NAME: DBIC




DESCRIPTION

Top

  This plugin is only active in -Debug mode.

AUTHOR

Top

Ryuzo Yamamoto, <ryuzo.yamamoto@gmail.com>

SEE ALSO

Top

Catalyst::Plugin::DBIC::Profiler, Catalyst

COPYRIGHT & LICENSE

Top


Catalyst-Plugin-DBIC-Schema-Profiler documentation Contained in the Catalyst-Plugin-DBIC-Schema-Profiler distribution.
package Catalyst::Plugin::DBIC::Schema::Profiler;

# $Id$

use strict;
use warnings;

use NEXT;
use Catalyst::Plugin::DBIC::Schema::Profiler::DebugObj;

our $VERSION = '0.06';

sub prepare {
    my $c = shift;
    $c = $c->NEXT::prepare(@_);

    my $model_name = $c->config->{'DBIC::Schema::Profiler'}->{MODEL_NAME}
      || return $c;

    if ( $c->debug ) {
        $c->model($model_name)->schema->storage->debug(1);
        $c->model($model_name)->schema->storage->debugobj(
            Catalyst::Plugin::DBIC::Schema::Profiler::DebugObj->new(
                log => $c->log
            )
        );
    }

    return $c;
}

1;