Re: autogenerating has_a and has_many from foreign keys

[prev] [thread] [next] [Date index for 2004/12/14]

From: Dave Howorth
Subject: Re: autogenerating has_a and has_many from foreign keys
Date: 11:25 on 14 Dec 2004
Randal L. Schwartz wrote:
> Lines 26 to 29 add our current class to the C<@ISA> list for each of
> the created classes.  I want to be able to define methods that all of
> my created classes understand, and this was the fastest way to do
> that.
 > 	=26=	  for my $class (@classes) {
 > 	=27=	    no strict 'refs';
 > 	=28=	    push @{$class . "::ISA"}, __PACKAGE__;
 > 	=29=	  }

There's been a recent discussion on the Maypole list covering some of 
this ground. Whilst pushing the class to the end of the @ISA enables you 
to define new methods for your classes, it stops you from overriding any 
existing methods, so unshift may be appropriate in some circumstances.

> Line 36 patches up a plural that didn't come out quite right for me.
> The class named C<GC::DB::PaidTo> was getting a linking method called
> C<paidtoes>, which was humorous but expectedly hard to remember.  So,
> I just whacked the pluralizer on the head with an additional fact, and
> it's all good.

Perhaps it's just LEI's way of suggesting you rename your table 'payee'? :)

Cheers, Dave

autogenerating has_a and has_many from foreign keys
merlyn (Randal L. Schwartz) 15:30 on 13 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
merlyn (Randal L. Schwartz) 15:46 on 13 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
merlyn (Randal L. Schwartz) 15:55 on 13 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
Sebastian Riedel 21:04 on 14 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
merlyn (Randal L. Schwartz) 21:09 on 14 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
Sebastian Riedel 21:22 on 14 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
merlyn (Randal L. Schwartz) 16:01 on 13 Dec 2004

Re: autogenerating has_a and has_many from foreign keys
Dave Howorth 11:25 on 14 Dec 2004

Generated at 11:30 on 23 Feb 2005 by mariachi v0.52