Following on from another thread about how to handle the debugobj, I've run into another conundrum. In trying out various SQL profiling configurations, I selectively load or comment out the base modules in MyApp.pm:

use Catalyst qw(lots of modules);

In doing so I can test for their existence in the controllers:

if ( $c->registered_plugins('DBIx::Class::QueryLog') ) {
 do_something_with_DBIC-QueryLog
}

But how can I do the equivalent in the Model/Schema class, which does not know anything about $c. I want to do something like:

use base 'Catalyst::Model::DBIC::Schema';

sub new {
  my $self = shift->NEXT::new( @_ );

     if ( module_x is loaded ) { setup storage on x }
  elsif ( module_y is loaded ) { setup storage on y }

  return $self;
}

Hope that makes sense.
--
Richard Jones
Leeds, UK
ra.jones(at)dpw.clara.co.uk

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to