summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2013-04-02 14:35:29 +0100
committerToby Inkster <mail@tobyinkster.co.uk>2013-04-02 14:35:29 +0100
commit557e37f2c112cb5b93bd3791b73657e82200e962 (patch)
treea31efa225448e02469a39b1e9c29bcaf4c3ee643 /examples
parent1d15b56769a4393b14084d14201759317e0ab827 (diff)
ws
Diffstat (limited to 'examples')
-rw-r--r--examples/datetimes-from-manual.pl64
1 files changed, 32 insertions, 32 deletions
diff --git a/examples/datetimes-from-manual.pl b/examples/datetimes-from-manual.pl
index a62a9b2f..7e320eaa 100644
--- a/examples/datetimes-from-manual.pl
+++ b/examples/datetimes-from-manual.pl
@@ -2,38 +2,38 @@ use strict;
use warnings;
BEGIN {
- package MyTypes::DateTime;
-
- use Type::Library
- -base,
- -declare => qw( Datetime DatetimeHash EpochHash );
- use Type::Utils;
- use Type::Standard -types;
-
- class_type Datetime, { class => "DateTime" };
-
- declare DatetimeHash,
- as Dict[
- year => Int,
- month => Optional[ Int ],
- day => Optional[ Int ],
- hour => Optional[ Int ],
- minute => Optional[ Int ],
- second => Optional[ Int ],
- nanosecond => Optional[ Int ],
- time_zone => Optional[ Str ],
- ];
-
- declare EpochHash,
- as Dict[ epoch => Int ];
-
- coerce Datetime,
- from Int, via { "DateTime"->from_epoch(epoch => $_) },
- from Undef, via { "DateTime"->now },
- from DatetimeHash, via { "DateTime"->new(%$_) },
- from EpochHash, via { "DateTime"->from_epoch(%$_) };
-
- 1;
+ package MyTypes::DateTime;
+
+ use Type::Library
+ -base,
+ -declare => qw( Datetime DatetimeHash EpochHash );
+ use Type::Utils;
+ use Type::Standard -types;
+
+ class_type Datetime, { class => "DateTime" };
+
+ declare DatetimeHash,
+ as Dict[
+ year => Int,
+ month => Optional[ Int ],
+ day => Optional[ Int ],
+ hour => Optional[ Int ],
+ minute => Optional[ Int ],
+ second => Optional[ Int ],
+ nanosecond => Optional[ Int ],
+ time_zone => Optional[ Str ],
+ ];
+
+ declare EpochHash,
+ as Dict[ epoch => Int ];
+
+ coerce Datetime,
+ from Int, via { "DateTime"->from_epoch(epoch => $_) },
+ from Undef, via { "DateTime"->now },
+ from DatetimeHash, via { "DateTime"->new(%$_) },
+ from EpochHash, via { "DateTime"->from_epoch(%$_) };
+
+ 1;
};
no thanks "MyTypes::DateTime";