On 11 Jul 2009, at 19:45, Minty wrote:
But I want to inject my $debugger via the Model or schema, and
enable/disable it globablly via a configuration file flag.
I'm a bit lost as to where/how I can do that. Any pointers?
package MyApp::Model::DB;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Model::DBIC::Schema';
__PACKAGE__->config(debug => 1);
after 'BUILD' => sub {
my ($self, $args) = @_;
if ($args->{debug}) {
my $debugger = My::Model::Debugger->new();
$self->result_source->storage->debugobj($debugger);
$self->result_source->storage->debug(1);
}
}
# Try something like that, untested...
Cheers
t0m
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/