> -----Original Message----- > From: Herbert Liechti [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 23, 2006 5:25 AM > To: datetime@perl.org > Subject: Re: keeping an object reference within dt > > Dave Rolsky wrote: > > > On Tue, 21 Mar 2006, Herbert Liechti wrote: > > > >> I'm currently implementing a ressource reservation system and I'm > >> using the DateTime libs for this purpose. My main problem is that im > >> generating a set of Datetimes from ressource objects (ie a month > >> view) which are holding the information about the ressource and its
> >> corresponding reservations. > >> > >> The resulting set has no longer an assiociation to the original > >> ressource object. For reporting purposes it would be nice to have an > >> association back to the original object. ie. > >> > >> my $dt = DateTime->new ( year => xxx, month => and so on.... > >> refers_to => > >> $objectreference); > >> > >> and later > >> > >> while iterating my set { > >> my $resObj = dt->getReferer(); > >> } > >> > >> any idea how to do that? > > > > > > You could subclass DateTime.pm and just add your field. The > > DateTime::Set modules should work fine with this. > > Dave > > Thanks for your response. As far as I see there is no easy way to > subclass DateTime::Span and DateTime::SpanSet. When I subclass > DateTime::Span I can't use DateTime::SpanSet anymore. I try to explain > my problem with the following schema: > > ressource address > | | > +-----------reservation--------------+ > | > | calculating spans from various reservations > | > 1 SpanSet for a specified time (i.e. 1 month) > | > | iterating (lost the context to reservation xy) > report > > A reservation contains the necessary informations for creating > DateTime::Event::Recurrence objects > > Any idea? Thank you and best regards I think what Dave meant was that you could subclass DateTime and add your method to that subclass. DateTime::Span and DateTime::SpanSet should continue to work fine with your subclass, because it is-a DateTime. I don't think you need to subclass DateTime::Span and DateTime::SpanSet at all, unless I don't understand your problem. Philip