On 10/25/05, Jim Mintha <[EMAIL PROTECTED]> wrote:
>
> On Tue, Oct 25, 2005 at 04:27:30PM +0100, Aaron Trevena wrote:
> > I think we need to document using customised vs standard classes, a
> > lot of Maypole stuff JustWorks(TM) with the standard classes, and this
> > technique builds on this without much mucking about.
>
> As someone that has been using Maypole a bit, but doesn't have a
> complete understanding of the whole class structure, having more
> examples is what I find the most useful. That was the biggest
> attraction for me in the beginning - the beerdb example was something
> that I could take and immediately start modifying and playing with.
>
> A good example (and my question for this mail). I want to override
> the column_type procedure (some of the varchar fields from oracle I
> would like as textareas) If I create something like:
>
> sub FigDB::Hardware::column_type {
> my ($self, $column) = @_;
>
> return "TEXT" if $column eq "dscpt";
> return "varchar";
> }
>
> I get a message in the logs:
>
> Subroutine FigDB::Hardware::column_type redefined at
> /usr/share/perl5/Class/DBI/Plugin/Type.pm line 43.
>
> and my version never gets called. My solution was to add the line:
>
> return if $caller->can("column_type");
>
> in the middle of /usr/share/perl5/Class/DBI/Plugin/Type.pm before it
> defines the column_type subroutine in the import sub. I would rather
> not hack the Plugin, but how can I override it?
CDBI::Plugin::Type is loaded into a Maypole model by CDBI::AsForm,
which does some dirty tricks. The result is that CDBI::P::Type's
import() routine is called at run time, not at compile time. So you
are loading CDBI::AsForm (via Maypole::Model::CDBI), then defining
your own column_type() at compile time, and later CDBI::AsForm invokes
CDBI::P::Types's import() which stamps on your custom method.
Try explicitly loading CDBI::Plugin::Type in your own model. That
should short-circuit AsForm's hackery.
d.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users