Re: Class::DBI::Loader and accessors

[prev] [thread] [next] [Date index for 2005/03/15]

From: Kingsley Kerce
Subject: Re: Class::DBI::Loader and accessors
Date: 22:28 on 15 Mar 2005
Perrin Harkins writes:
 > On Tue, 2005-03-15 at 16:29 -0500, Kingsley Kerce wrote:
 > > Sean Davis <sdavis2@xxxx.xxx.xxx> wrote:
 > > > I'm sorry I'm using so much list bandwidth today. I use '_id' for
 > > > my primary key columns and would like to drop the '_id' from the
 > > > accessors. I see how to do that in Class::DBI when defining my
 > > > own classes, but how would I go about doing that for all my
 > > > classes when using Class::DBI::Loader?
 > > 
 > > I personally use the following, an admitted hack:
 > > 
 > >   foreach my $class ($cdbi_loader->classes) {
 > >     eval "package $class;
 > >           # do class-specific stuff such as manipulating accessors
 > >     ";
 > >     confess $@ if $@;
 > >   }
 > > 
 > > I'd love to witness a better approach.
 > 
 > Isn't this what the "additional_base_classes" parameter in Loader is
 > for?

Well, yeah, if you're running CDBIL >= 0.06, unlike me. :)
I'll upgrade.  Thanks for the reality check, Perrin.

So in the case of the OP, I guess the solution is as simple as
creating a package containing an accessor_name() method, and passing
that package's name into CDBIL via the "additional_base_classes"
param.

Kings

(message missing)

Class::DBI::Loader and accessors
Sean Davis 21:10 on 15 Mar 2005

Re: Class::DBI::Loader and accessors
Kingsley Kerce 21:29 on 15 Mar 2005

Re: Class::DBI::Loader and accessors
Perrin Harkins 21:51 on 15 Mar 2005

Re: Class::DBI::Loader and accessors
Kingsley Kerce 22:28 on 15 Mar 2005

Re: Class::DBI::Loader and accessors
Kingsley Kerce 17:51 on 16 Mar 2005

Re: Class::DBI::Loader and accessors
Perrin Harkins 19:22 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 18:48 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Kingsley Kerce 19:07 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 20:02 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Kingsley Kerce 21:02 on 17 Mar 2005

Re: Class::DBI::Loader and accessors
Tony Bowden 23:16 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 21:43 on 17 Mar 2005

Can't call id() as a class method
Tom Gazzini 22:44 on 17 Mar 2005

Re: Can't call id() as a class method
Perrin Harkins 22:52 on 17 Mar 2005

Re: Can't call id() as a class method
Tony Bowden 23:15 on 17 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 21:54 on 23 Mar 2005

Re: Class::DBI::Loader and accessors
Tim Bunce 22:26 on 23 Mar 2005

Re: Class::DBI::Loader and accessors
Tony Bowden 23:00 on 23 Mar 2005

Re: Class::DBI::Loader and accessors
Tony Bowden 23:34 on 23 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 23:07 on 23 Mar 2005

RE: Class::DBI::Loader and accessors
Zhuang Li 23:50 on 23 Mar 2005

RE: Class::DBI::Loader and accessors
Peter Speltz 00:04 on 24 Mar 2005

Generated at 15:09 on 27 Mar 2005 by mariachi v0.52