Re: CDBI::Loader and plugins

[prev] [thread] [next] [Date index for 2004/08/02]

From: Tony Bowden
Subject: Re: CDBI::Loader and plugins
Date: 14:41 on 02 Aug 2004
On Mon, Aug 02, 2004 at 02:48:51PM +0100, Stephen Quinney wrote:
>         eval "package $class;
>               use Class::DBI::Plugin::RetrieveAll;
>         ";
> but this seems like a bit of an ugly hack, there has to be a nicer way

It really is a nasty hack...

> (it might not have been written yet, of course). Anyone have thoughts
> on how to resolve/improve this issue?

The best approach would be for CDBI::Loader to allow you to have
your own base class for the dynamic classes, rather inheriting from
Class::DBI::mysql (or whatever) directly.

In the mean time you could cheat by switching package:


package My::App;

use Class::DBI::Loader;
# do loader stuff.


package Class::DBI::mysql;

use Class::DBI::Plugin::RetrieveAll;
use Other::Mixins;


It's quite nasty as well, but perhaps not quite as nasty as eval(package
switching). YMMV.

Tony

CDBI::Loader and plugins
Stephen Quinney 13:48 on 02 Aug 2004

Re: CDBI::Loader and plugins
Tony Bowden 14:41 on 02 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52