[ moved ot the list ] On Thu, 26 Jun 2003, Joshua Hoblitt wrote:
> In the case of DT::C::Egyptian inheritance makes a lot of since. The > Gregorian calendar only needs minor tweaks to function as the Egyptian > one. Why should everyone have to reinvent the entire wheel instead of > sub-classing? I'm not objecting to subclassing, per se. > It happens that the Egyptian year has 13 months - which blows up on the > validation stuff. I suppose I could try to redefine the one hash key > instead of the entire data structure. An interface for this would be > nice. > > month => { type => SCALAR, default => 1, > callbacks => > { 'is between 1 and 12' => > sub { $_[0] >= 1 && $_[0] <= 12 } > }, > }, Hmm, this is a problem. I'm really not sure subclassing makes that much sense here. At the very least, you probably need to provide your own new() method. I'm really not sure how far (if at all) we should go in trying to make DateTime.pm suitable as a superclass for other calendars. Look at the mess that is the Java datetime stuff, and note that they tried to do this ;) -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/