On Mon, 16 Jun 2003, Ben Bennett wrote:

> I really like the new is_X subs, although in the case of the
> is_alias() would it make sense to return the target of the alias?

No, any method that starts with is_ should return a boolean value (or only
be guaranteed to return such a thing).  If you need the value, maybe we
need an alias() method.

> (In fact an add("America/New_York" should also not die).  My theory
> being that people may have a sanity check in a few places to make sure
> the right TZ mappings are defined.  For instance at work we use Mason
> running in mod_perl under Apache, so the same environment persists
> across different pages.  If one page does the add() I wouldn't want a
> subsequent page to have to jump through hoops to check the definition
> of the alias is correct if doing an equivalent add()...  I don't think
> we lose anything by allowing a subsequent add() to silently be skipped
> if it is the same.

Wouldn't this be something you'd stick in a module anyway?

> One last thing, I just realized that the subs expect to be called as
> class methods.  This is fine unless you want to alias them into your
> package (or accidentally call them like DateTime::TimeZone::Alias::add()).
> The following fails:
> --
> use DateTime::TimeZone::Alias;
> *set_tz = \&DateTime::TimeZone::Alias::set;
> set_tz(EST => "US/Eastern");
> --

sub set_tz { DateTime::Time::Zone::Alias->set(@_) }


-dave

Reply via email to