[Dbix-class] How to set debugobj in DBIC
RA Jones
ra.jones at dpw.clara.co.uk
Thu Mar 22 22:52:17 GMT 2007
Jason Kohles wrote:
> On Mar 17, 2007, at 11:48 AM, RA Jones wrote:
>> What am I doing wrong?
>
> I haven't tried this, but if you are trying to do it in Catalyst, your
> best bet is probably to inject it into the model...
>
> package MyApp::Model::MyDB;
> use strict;
> use warnings;
> use base 'Catalyst::Model::DBIC::Schema';
> use NEXT;
>
> __PACKAGE__->config( schema_class => 'MyDB::Schema' );
>
> sub new {
> my $self = shift->NEXT::new( @_ );
> $self->storage->debugobj( My::MySQL::Profiler->new() );
> $self->storage->debug( 1 );
> return $self;
> }
>
All working nicely now in MyApp/Model/Schema, using:
$self->storage->debugobj(new DBIx::Class::QueryLog);
Many thanks
--
Richard Jones
Leeds, UK
ra.jones(at)dpw.clara.co.uk
More information about the Dbix-class
mailing list