++ed by:

2 non-PAUSE users.

Jed Lund


DateTimeX::Mashup::Shiras::Types - Types for DateTimeX::Mashup::Shiras


    package MyPackage;

    use Moose;
    use DateTimeX::Mashup::Shiras::Types qw(
    has 'attribute_1' => (
            is  => 'ro',
            isa => WeekDay->plus_coercions( WeekDayFromStr ),


Shiras - A small subspecies of Moose found in the western United States (of America).

This is the custom type class that ships with the DateTimeX::Mashup::Shiras package. Wherever possible coersion failures are passed back to the type so type errors will be explained. The types are implemented using Type::Tiny.

Caveat utilitor

All type tests included with this package are considered to be the fixed definition of the types. Any definition not included in the testing is considered flexible.

This module uses Type::Tiny which can, in the background, use Type::Tiny::XS. While in general this is a good thing you will need to make sure that Type::Tiny::XS is version 0.010 or newer since the older ones didn't support the 'Optional' method.


There are no included coercions with these types. Any coercion usage should be with ->plus_coercions from the list below.


    Definition: integers ( 1 .. 7 )

    Coercions: from a string. The type will try to qr//i match the passed string to an english name of the week.



These are named coercions available for export by this module. For the coercions to work with the Type they must be added to the type via ->plus_coercions. To test the type and coercions together use the ->coerce or ->assert_coerce functions.


    Definition: Takes a string that matches the full or any portion of the initial letters in an english weekday name and converts it to an integer (1..7) where 1 = Monday. The match is case independant (qr/$_/i).


    Definition: This will take a HashRef and attempt to treat is as %$args for the function Datetime->new( %$args )


    Definition: this will take an ArrayRef and use up to the first three positions in the array as; [ $arg, $type, $time_zone ]. This is only used for passing numbers coded as excel or unix epochs to be converted to DateTime objects. The elements are used as follows.


    Definition: This will check the number for 0 or 60 (microsoft issues), negative integers, and positive integers with more than 7 digits and read them as epoch (Nixy) dates. It will turn any positive integer or decimial with less than 7 leading digits into an excel date using DateTime::Format::Excel. All positive decimals with 7 or more digits will also be treated as excel dates. Negative decimals will fail.This will take a number and guess what type it is. The data is then handled the same as an ArrayRef.


    Definition: This should be the final fall back check and it attempts to turn any String into a DateTime object with DateTime::Format::Flexible.



The module uses Smart::Comments if the '-ENV' option is set. The 'use' is encapsulated in an if block triggered by an environmental variable to comfort non-believers. Setting the variable $ENV{Smart_Comments} in a BEGIN block will load and turn on smart comment reporting. There are three levels of 'Smartness' available in this module '###', '####', and '#####'.


This variable holds a DateTime object set to; year => 1970, month => 1, day => 1. To be used by DateTime::Format::Epoch as the Epoch start. If you wish to change the epoch start change this variable. All changes are permanent until the next change.


This variable holds the default excel type for DateTimeX::Format::Excel. The default is 'win_excel'.


When date strings are parsed it checks D-M-Y prior to M-D-Y. This is default off.

range: 1|0


github DateTimeX-Mashup-Shiras/issues


    1. Add Log::Shiras debugging in exchange for Smart::Comments

      * Get Log::Shiras CPAN ready first! (Some horrible deep recursion happens so far)


    Jed Lund



This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

This software is copyrighted (c) 2013, 2014 by Jed Lund.