Changes for version 0.032 - 2019-01-21

  • Maintain a static list of default coercion modules instead of finding
    • loading all Data::Sah::Coerce::* modules on the system. The motivation for this change is performance, simplicity, as well as reduction of test warnings from CPAN Testers. Typically, a CPAN Tester would have tested an old version of a coercion rule distribution, say Data-Sah-Coerce-perl-date-str_alami and then later tests another module. Data::Sah::Coerce would then warn when it cannot load the old coercion rule module because the metadata version has been bumped. With this change, the list of default coercion rules is maintained in %Default_Rules in Data::Sah::Coerce instead of loading all coercion rule modules and trying to read its 'enable_by_default' meta property.
  • [Removed] Remove the ability to specify regexes in coerce_rules because it is never used in practice, so far. The use of regexes also requires us to find list of modules anyway.
  • [Incompatible change] Bump metadata version to 4, just to remove 'enable_by_default' property. Data::Sah::Coerce still accepts old metadata version (3) but ignores the property.

Modules

Coercion rules for Data::Sah
Coerce 0 to false and 1 to true
Coerce "true","yes",etc to true and "false","no",etc to false
Coerce date from number (assumed to be epoch)
Coerce date from Date object
Coerce date from string
Coerce datenotime from number (assumed to be epoch)
Coerce datenotime from Date object
Coerce datenotime from string
Coerce datetime from number (assumed to be epoch)
Coerce datetime from Date object
Coerce datetime from string
Coerce duration from number (assumed to be number of seconds)
Coerce duration from (subset of) ISO8601 string (e.g. "P1Y2M", "P14M")
Coerce timeofday from string of the form hh:mm:ss
Convert "yes","true",etc to "1", and "no","false",etc to ""
Coerce date from number (assumed to be epoch)
Coerce date from number (assumed to be epoch)
Coerce date from DateTime object
Coerce date from Time::Moment object
Coerce date from (a subset of) ISO8601 string
Coerce datenotime from number (assumed to be epoch)
Coerce datenotime from number (assumed to be epoch)
Coerce datenotime from DateTime object
Coerce datenotime from Time::Moment object
Coerce datenotime from (a subset of) ISO8601 string
Coerce datetime from number (assumed to be epoch)
Coerce datetime from number (assumed to be epoch)
Coerce datetime from DateTime object
Coerce datetime from Time::Moment object
Coerce datetime from (a subset of) ISO8601 string
Coerce duration from float (assumed to be number of seconds)
Coerce duration from human notation string (e.g. "2 days 10 hours", "3h")
Coerce duration from (subset of) ISO8601 string (e.g. "P1Y2M", "P14M")
Coerce float from percent string (e.g. "100.5%")
Coerce int from percent string (e.g. "100%")
Coerce timeofday from Date::TimeOfDay object
Coerce timeofday from string in the form of hh:mm:ss
Common stuffs for Data::Sah::Coerce and Data::Sah::CoerceJS
Generate coercer code