1MooseX::Types::DateTimeU:s:eMrorCeoCnoterricbiuotnesdM(o3Po)esrelX:D:oTcyupmeesn:t:aDtaitoenTime::MoreCoercions(3)
2
3
4

NAME

6       MooseX::Types::DateTime::MoreCoercions - Extensions to
7       MooseX::Types::DateTime
8

VERSION

10       version 0.15
11

SYNOPSIS

13           package MyApp::MyClass;
14
15           use MooseX::Types::DateTime::MoreCoercions qw( DateTime );
16
17           has created => (
18               isa => DateTime,
19               is => "rw",
20               coerce => 1,
21           );
22
23           my $instance = MyApp::MyClass->new(created=>'January 1, 1980');
24           print $instance->created->year; # is 1980
25
26           ## Coercions from the base type continue to work as normal.
27           my $instance = MyApp::MyClass->new(created=>{year=>2000,month=>1,day=>10});
28
29       Please see the test case for more example usage.
30

DESCRIPTION

32       This module builds on MooseX::Types::DateTime to add additional custom
33       types and coercions.  Since it builds on an existing type, all
34       coercions and constraints are inherited.
35

SUBTYPES

37       This module defines the following additional subtypes.
38
39   DateTime
40       Subtype of "DateTime" in MooseX::Types::DateTime.  Adds an additional
41       coercion from strings.
42
43       Uses DateTimeX::Easy to try and convert strings, like "yesterday" into
44       a valid DateTime object.  Please note that due to ambiguity with how
45       different systems might localize their timezone, string parsing may not
46       always return the most expected value.  IN general we try to localize
47       to UTC whenever possible.  Feedback welcomed!
48
49   Duration
50       Subtype of "Duration" in MooseX::Types::DateTime that coerces from a
51       string.  We use the module Time::Duration::Parse to attempt this.
52

CAVEATS

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

SEE ALSO

63       •   MooseX::Types::DateTime Replacement for this module -- coercions
64           with less voodoo
65
66       •   DateTimeX::Easy Backend of this module
67
68       •   Time::Duration::Parse Duration parsing backend for this module
69

AUTHOR

71       John Napiorkowski <jjn1056 at yahoo.com>
72
73       Broken into a separate package from MooseX::Types::DateTime by Evan
74       Carroll.
75
76       Forked from MooseX::Types::DateTimeX and ported back to use
77       MooseX::Types::DateTime by Dagfinn Ilmari Mannsåker
78       <ilmari@ilmari.org>.
79

AUTHORS

81       •   John Napiorkowski <jjn1056@yahoo.com>
82
83       •   Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
84

CONTRIBUTORS

86       •   Karen Etheridge <ether@cpan.org>
87
88       •   Evan Carroll <me+cpan@evancarroll.com>
89
90       •   gregor herrmann <gregoa@debian.org>
91
93       This software is copyright (c) 2008 by John Napiorkowski.
94
95       This is free software; you can redistribute it and/or modify it under
96       the same terms as the Perl 5 programming language system itself.
97
98
99
100perl v5.36.0                      2022M-o0o7s-e2X2::Types::DateTime::MoreCoercions(3)
Impressum