[CDBI] How do I add a method to a loaded class?
peterspeltz at gmail.com
Sun Aug 7 17:15:32 BST 2005
Opps sent on accident: I was trying to say try:
my @all = (MyTable->columns, MyCable->columns('TEMP'));
But check the docs for syntax or maybe changed behavior in .99.
On 8/7/05, Peter Speltz <peterspeltz at gmail.com> wrote:
> 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,
> On 8/7/05, Alex Aminoff <alex at basespace.net> wrote:
> > ----- Original Message -----
> > From: John Beppu
> > To: Alex Aminoff
> > Cc: classdbi at lists.digitalcraftsmen.net
> > Sent: Sunday, August 07, 2005 12:13 AM
> > Subject: Re: [CDBI] How do I add a method to a loaded class?
> > On 8/6/05, Alex Aminoff <alex at basespace.net> wrote:
> > >
> > >
> > > Very basic newbie question...
> > >
> > > 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 data,
> > but otherwise appear in most respects like any other column from the DB. I'm
> > pretty sure I want something using MyTable->columns( TEMP => calcfield ).
> > 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 into
> > the MyTable namespace and are able to call it?
> > I want to generate an html table screen of the data, using
> > Class::DBI::Plugin::HTML, which appears to rely on ->columns() to find out
> > 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, if I
> > change my database schema in mysql, I dont want to have to sync up changes
> > in my perl code.
> > 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 familiar
> > with already, but the principle is the same.
> > - Alex
> > _______________________________________________
> > ClassDBI mailing list
> > ClassDBI at lists.digitalcraftsmen.net
> > http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
More information about the ClassDBI