[Dbix-class] DBIC::Loader + M::Pluggable
Daisuke Murase
typester at cpan.org
Tue Jan 24 16:28:04 CET 2006
Hi.
I want to Module::Pluggable feature into DBIC::Loader, and here is an
suggestion and sample code.
package DBIx::Class::Loader::Pluggable;
use strict;
use base qw/DBIx::Class::Loader/;
require Module::Pluggable::Fast;
sub new {
my $class = shift;
my %attr = @_;
my $self = $class->SUPER::new(@_);
Module::Pluggable::Fast->import(
name => '_components',
require => 1,
search => [ $attr{namespace} ],
);
__PACKAGE__->_components;
$self;
}
1;
I think this module are usable, especially using Catalyst Model from
outside script. example:
DBIx::Class::Loader::Pluggable->new(
dsn => 'dbi:...',
namespace => 'MyApp::Model::DBIC',
);
That's it. MyApp::Model::DBIC::* was already loaded, and ready to use.
I hope this feature were merged into Loader.
If not, I think uploading to CPAN as a separated module.
(then I should probably rename it)
How about this ?
--
Daisuke Murase <typester at cpan.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060125/d3bc3dcb/attachment.pgp
More information about the Dbix-class
mailing list