From: Chris W. <ch...@cw...> - 2002-09-07 14:39:40
|
On Sat, 2002-09-07 at 10:17, Tony Bowden wrote: > I had an interesting realization about hasa() yesterday ... it's really > just a special case of the 'associate this column to this class' > function that we currently have as associated_class(). > > So, I'd like to bring the two together. But there are several issues: > > 1) They take their arguments in opposite directions! > > Foo->hasa(Class => column); > Foo->associated_class(column => Class); > ... > To make all of this simpler, I may just deprecate hasa() and > associated_class() and replace both with a unified has_a() which > looks something like this: > > CD->has_a(artist => 'CD::Artist'); > CD->has_a(release_date => 'Date::Simple'); > > CD->has_a(last_update => 'Time::Piece::MySQL', > in => 'from_mysql_datetime', > out => 'mysql_datetime', > ); > > CD->has_a(last_changed => 'Time::Piece', > in => sub { Time::Piece->strptime(shift => "%d.%m.%Y") }, > out => sub { shift->dmy('.') }, > } Ooo, great idea. This may be a nice area of convergence for SPOPS... Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |