Changes for version v0.6.2 - 2026-04-19
- Critical Bug Fixes in DateTime::Lite::TimeZone
- Moved 'use strict' and 'use warnings' out of the BEGIN block and into package-level scope. This hid some latent bugs fixed below.
- Fixed nine class-callable methods that referenced an undeclared $self variable throughout their bodies, where only $class_or_self was actually assigned from the first shifted argument. Without strict in effect, these references silently evaluated to undef or crashed at runtime when called. The affected methods are:
- aliases()
- all_names()
- categories()
- countries()
- is_valid_name()
- names_in_category()
- names_in_country()
- offset_as_seconds()
- and offset_as_string(). All nine now work correctly when invoked as class methods, as intended and documented.
- Fixed _get_zone_info() which ignored its $name parameter and used object-based properties even when called as a class function, which would have triggered a perl error.
- Modified fatal() to use the global variable $FATAL_EXCEPTIONS when called as a class function, or the 'fatal' instance property.
- Fixed names_in_country(): the prepared statement cache key was incorrectly shared with names_in_category() (both using 'names_in_category'), so whichever method was called second would retrieve the other method's prepared statement and produce silently wrong results. The cache key is now 'names_in_country'. The method now also correctly passes the $code argument to execute() (it was previously called with no arguments).
- Fixed names_in_category() which called execute() without passing the $cat argument, so the SQL placeholder bound to NULL and the method returned zero matches for every input. Now passes $cat to execute().
- Fixed categories() query which returned an empty-string entry from the Factory zone (which has a NULL category in IANA data). Query now filters with 'WHERE category IS NOT NULL'.
- Fixed bad variable name $row used in aliases(), all_names(), categories(), countries(), names_in_category(), and names_in_country().
- Defensive Guards
- Added instance guards to eight class-callable methods that require a blessed instance: category(), country_codes(), has_dst_changes(), is_dst_for_datetime(), offset_for_datetime(), offset_for_local_datetime(), short_name_for_datetime(), and tzif_version(). These return a clean error via $self->error() rather than dereferencing a class name string under strict refs.
- Added die() guards in _set_get_prop() and _lookup_span() to catch internal design errors where a class name is passed instead of an instance. These are private methods, so a die() (rather than a clean return) is appropriate: reaching them in class context indicates a caller bug that should surface immediately.
- API Additions
- Introduced new package variable $FATAL_EXCEPTIONS for DateTime::Lite::TimeZone, similar to the one used in DateTime::Lite. When set to a true value, newly constructed DateTime::Lite::TimeZone objects default to fatal set to true. Per-object fatal flags remain individually settable via the fatal() accessor/mutator.
Documentation
Compare DateTime and DateTime::Lite performance
Build the DateTime::Lite::TimeZone SQLite database
Generate leap_seconds.h for DateTime::Lite XS
Modules
Lightweight, low-dependency drop-in replacement for DateTime
Duration objects for use with DateTime::Lite
Exception object for DateTime::Lite
Infinite past and future DateTime::Lite objects
Pure-Perl fallback for the DateTime::Lite XS layer
Lightweight timezone support for DateTime::Lite
Provides
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite.pm