GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooseX::Types::DateTimeX(3) User Contributed Perl Documentation MooseX::Types::DateTimeX(3)
 

MooseX::Types::DateTimeX - Extensions to MooseX::Types::DateTime::ButMaintained

    package MyApp::MyClass;
    use MooseX::Types::DateTimeX qw( DateTime );
    has created => (
        isa => DateTime,
        is => "rw",
        coerce => 1,
    );
    my $instance = MyApp::MyClass->new(created=>'January 1, 1980');
    print $instance->created->year; # is 1980
    ## Coercions from the base type continue to work as normal.
    my $instance = MyApp::MyClass->new(created=>{year=>2000,month=>1,day=>10});
Please see the test case for more example usage.

This module builds on MooseX::Types::DateTime to add additional custom types and coercions. Since it builds on an existing type, all coercions and constraints are inherited.
The package name is left as is for legacy reasons: this module is really a Type with coercions for DateTimeX::Easy. DateTimeX is just a namespace for non-core or less-official DateTime modules.

This module defines the following additional subtypes.

Subtype of 'DateTime'. Adds an additional coercion from strings.
Uses DateTimeX::Easy to try and convert strings, like "yesterday" into a valid DateTime object. Please note that due to ambiguity with how different systems might localize their timezone, string parsing may not always return the most expected value. IN general we try to localize to UTC whenever possible. Feedback welcomed!

Subtype of 'DateTime::Duration' that coerces from a string. We use the module Time::Duration::Parse to attempt this.

Firstly, this module uses DateTimeX::Easy which is way to more DWIM than any sane person would desire. DateTimeX::Easy works by falling back until something makes sense, this is variable. Furthermore, all the modules that DateTimeX::Easy *can* use aren't required for "proper" function of DateTimeX::Easy. What does this mean? Simple, your mileage may vary in your coercions because DateTimeX::Easy is installation specific.

MooseX::Types::DateTime::ButMaintained Replacement for this module -- coercions with less voodoo
DateTimeX::Easy Backend of this module

John Napiorkowski <jjn1056 at yahoo.com>
Broken into a seperate package from MooseX::Types::DateTime by Evan Carroll.

    Copyright (c) 2008 John Napiorkowski.
    This program is free software; you can redistribute
    it and/or modify it under the same terms as Perl itself.
2010-09-21 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.