Re: best practice?

[email protected] ("Flavio S. Glock")
Newsgroups perl.datetime
Message-ID <[email protected]>
2008/10/23 Herbert Liechti <[email protected]>:
> Hi all
>
> I'm currently involved in a project where a ressource
>
> planning system is developed. We are using the
>
> datetime.* libs for that purpose.
>
> Values of occupied ressources
>
> are stored in a database. For a intersection wether a
>
> ressource is free or occupied we are using
>
> DateTime::SpanSet. But now the problem:
>
> I have to be able to associate a database object
>
> with a given SpanSet which I create when retrieving
>
> the data from the database.
>
> spans:
>
>     [.n.][.n.][.n.]            -> new reservation
>
> [.a.][.a.][.a.][.b.][.b.][.c.]  -> existing data
>
> intersection gives conflicts with a & b which is correct
> but i loose the context which of the dt objects belongs
> to which data object.
>
> First approach was to inherit from DateTime and
> storing object references. But when I intersect_span
> the sets, I'm loosing my references, seems that the dt
> objects are newly created.
>

That's correct, DateTime sets always return cloned objects.

> How can I solve that problem. If it is helpful I can
> attach the inheritet DateTime code
>

Sure, that might help.

> Thank you very much for your help and sorry for the
> bad english.
>
> Regards Herbie
>

Flávio S. Glock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.