houseabsolute / DateTime-TimeZone

Time zone object base class and factory
https://metacpan.org/release/DateTime-TimeZone/
Other
9 stars 25 forks source link

Undeclared dependencies on DateTime::Duration #37

Open Grinnz opened 4 years ago

Grinnz commented 4 years ago

As reported at https://github.com/Grinnz/Time-Moment-Role-TimeZone/issues/1. DateTime::TimeZone::OlsonDB::Rule loads DateTime::Duration but doesn't use it; DateTime::TimeZone::OlsonDB::Observance loads and uses it, and DateTime::TimeZone and DateTime::TimeZone::OlsonDB use it without loading it. DateTime::Duration is part of the DateTime distribution (thus a dependency on it would be circular and undesirable).

autarch commented 4 years ago

This is somewhat intentional to avoid a circular dependency, as DateTime depends on DateTime::TimeZone.

This hasn't been a problem until now because no one was using DT-TZ except with DateTime. It's really not designed to be used separately, but if you have a suggestion on how to fix it I'd be open to that.

autarch commented 4 years ago

One fix that occurs to me is to move everything in this distro to the DateTime distro except the data files. That would "solve" the problem, though then you'd have to require DateTime itself in your role.

Grinnz commented 4 years ago

As it stands, I'll need to have these tests require DateTime::Duration anyway to succeed, so I can't think of a better option.

Grinnz commented 4 years ago

Just beware that since DateTime is installed to archlib and DateTime::TimeZone is installed to the pure perl lib, if you move the DateTime/TimeZone.pm to the archlib dist you won't be able to (easily) move it back, as files in archlib will take precedence even over newer versions in pureperl libs. And you will still need some "main module" in order to declare dependencies on and install the data files.