Re: [CDBI] How do I add a method to a loaded class?

[prev] [thread] [next] [Date index for 2005/08/07]

From: Peter Speltz
Subject: Re: [CDBI] How do I add a method to a loaded class?
Date: 16:13 on 07 Aug 2005
The columns method with no arguments returns 'ALL' columns.  This
strangely does not return TEMP columns  in .96  (probably for good
reason though).  Maybe this has changed in .99.  Read the docs but im
guessing if you want TEMP columns to be lumped with ALL columns you
will have to call them explicitly . Try something like

my @all Unless it has been changed in .99,=20

On 8/7/05, Alex Aminoff <alex@xxxxxxxxx.xxx> wrote:
> =20
>  =20
> =20
> ----- Original Message -----=20
> From: John Beppu=20
> To: Alex Aminoff=20
> Cc: classdbi@xxxxx.xxxxxxxxxxxxxxxx.xxx=20
> Sent: Sunday, August 07, 2005 12:13 AM=20
> Subject: Re: [CDBI] How do I add a method to a loaded class?=20
>=20
> On 8/6/05, Alex Aminoff <alex@xxxxxxxxx.xxx> wrote:=20
> =20
> >=20
> >  =20
> > Very basic newbie question...=20
> >  =20
> > I have loaded up my database into a Class::DBI structure using
> Class::DBI::Loader. Now I would like to add a method to one of the
> autogenerated classes that will calculate some stuff based on various dat=
a,
> but otherwise appear in most respects like any other column from the DB. =
I'm
> pretty sure I want something using MyTable->columns( TEMP =3D> calcfield =
).
> =20
>=20
>=20
> Let's step back a bit.  Why do you need to have the calcfield() method
> appear as a column?  Isn't it enough that you managed to put the method i=
nto
> the MyTable namespace and are able to call it? =20
> =20
>  =20
>  =20
> I want to generate an html table screen of the data, using
> Class::DBI::Plugin::HTML, which appears to rely on ->columns() to find ou=
t
> what columns should be displayed. Yes, one could just list the columns
> explicitly, but that defeats the elegance of not having to do so; plus, i=
f I
> change my database schema in mysql, I dont want to have to sync up change=
s
> in my perl code.=20
>  =20
> I'm not actually using Class:DBI::Plugin::HTML, but rather my own module
> which will work with HTML::Template, just because that is what I'm famili=
ar
> with already, but the principle is the same.=20
>  =20
>  - Alex=20
>  =20
> _______________________________________________
> ClassDBI mailing list
> ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>=20
>=20
>=20


--=20
pjs

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] How do I add a method to a loaded class?
Alex Aminoff 00:22 on 07 Aug 2005

Re: [CDBI] How do I add a method to a loaded class?
Peter Speltz 16:13 on 07 Aug 2005

Generated at 09:40 on 09 Aug 2005 by mariachi v0.52