Re: timezone data overlay -- an implementation

2003-11-19 Thread Matt Sisk
So did anyone actually bother to look at this?

If it's good, let us know. If it's an abomination, let us know.

Matt



timezone data overlay -- an implementation

2003-11-14 Thread Matt Sisk
Here's a football to kick around over the weekend:

http://www.mojotoad.com/sisk/dt/

Regarding the sharing of DT::TZ data across the timezone singletons, 
I've got an example implementation that demonstrates the principle.

At the above URL you will find some modified versions of TimeZone.pm and 
parse_olson. In order to test you'll have to run parse_olson in your 
test distro -- something like tools/parse_olson --dir ./olson --version 
2003d, presuming you've unpacked the Olson goods in ./olson. I've also 
included a 'tzt' script that shows some stats of the data sharing in action.

What this stuff does is share data references, sometimes arrays, 
sometimes of certain objects, in all of the spots where they are 
repeatedly used across the timezone singletons. My solution will 
probably set of encapsulation klaxons in many of your minds -- but so 
long as these singletons are relatively static objects this should not 
be relevant.

Some notes:

 1) The data refs are handled via a _juxtaposition() class method

 2) No preloading of zones or data is necessary.

 3) There is a JUXTA_THRESHOLD constant that controls when this sharing 
behavior is invoked. Currently this is set to 25, so the sharing only 
starts happening if you're taking more than a walk around the world. 
Performance should not be impacted otherwise.

 4) I'm currently taking the signatures of the data structures using 
Digest::MD5 and Data::Dumper. This is just the first way that came to 
mind, there could be better ways.

 5) If we want to make dependencies on such modules optional, the 
sharing behavior can be made to invoke only if the requisite modules are 
present on the system.

 6) Determining the signature of data structures could be made optional 
if we're willing to store the structures in a data file somewhere that 
could be queried at need. (not sure if I like that)

 7) Coding style was off the cuff. If the behavior is deemed desirable, 
we can rework it more elegantly.

 8) I was working off of the latest CVS versions. I'm unsure if it 
works with the latest CPAN release.

So if you have time and the inclination, feel free to give it a whirl.

Cheers,
Matt