[Dbix-class] How to set debugobj in DBIC

RA Jones ra.jones at dpw.clara.co.uk
Sat Mar 17 15:48:12 GMT 2007


RA Jones wrote:

> Trying various places to set debugobj so far has failed with error 
> messages, usually relating to storage. In reality I've no idea where to 
> start with this. The intuitive place to set the debugobj is either 
> MyApp/lib/Schema.pm or MyApp::Model::Schema.pm, but neither seems to 
> work. Presumably I shouldn't be doing this in the MyApp/lib/Schema DBIC 
> classes? A simple code example is really all I need to get going.

I'm still getting nowhere with this, and also found a reference on the 
internet to a similar problem with the Profiling section of the 
DBIx::Class::Manual::Cookbook. The OP did not get a definitive answer. 
Is it actually possible to set the debugobj, or is it urban myth?

My attempts so far:

use My::MySQL::Profiler;
__PACKAGE__->storage()->debugobj(new My::MySQL::Profiler());
__PACKAGE__->storage()->debug(1);

1) In MyApp/lib/Schema:

Couldn't instantiate component "MyApp::Model::Schema", "Cannot load 
schema class 'Schema': Can't call method "debugobj" on an undefined 
value at /home/www/apps/MyAPP/script/../lib/Schema.pm line 14.
Compilation failed in require at 
/usr/local/share/perl/5.8.7/Catalyst/Model/DBIC/Schema.pm line 272.
  at script/myapp_server.pl line 53" at script/myapp_server.pl line 53
Compilation failed in require at script/myapp_server.pl line 53.

2) In MyApp::Model::Schema:

Can't use string ("MyApp::Model::Schema") as a HASH ref while "strict 
refs" in use at /usr/local/share/perl/5.8.7/Class/Accessor/Fast.pm line 38.
Compilation failed in require at (eval 98) line 3.
Compilation failed in require at script/myapp_server.pl line 53.

3) In root controller MyApp::Controller::Root:
Can't locate object method "storage" via package 
"MyApp::Controller::Root" at 
/home/www/apps/MyApp/script/../lib/MyApp/Controller/Root.pm line 16.
Compilation failed in require at (eval 171) line 3.
Compilation failed in require at script/myapp_server.pl line 53.

What am I doing wrong?
-- 
Richard Jones
Leeds, UK
mailto:ra.jones at dpw.clara.co.uk



More information about the Dbix-class mailing list