MooseX-Types-ISO8601-0.14/000755 000767 000024 00000000000 12111737222 015173 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/Changes000644 000767 000024 00000004646 12111737222 016500 0ustar00etherstaff000000 000000 Revision history for MooseX-Types-ISO8601 0.14 2013-02-22 10:53:00 PST-0800 (Karen Etheridge) - New strict types, which verify that the data actually can be inflated into a valid DateTime object 0.13 2012-12-21 17:00:17 PST-0800 (Karen Etheridge) - support more than two digits of hours in durations. (Partial support of page 27, paragraph two of ISO 8601:2004(E) ). - documentation added for coercions from datetime string types to DateTime. - spelling patch applied from debian (RT#81262, thanks Jonas Genannt!) 0.12 2012-08-07 14:08:37 PDT-0700 (Karen Etheridge) - converted uses of Test::Exception to Test::Fatal - trailing 'Z' to indicate timezone is now optional, matching the official ISO8601 specification (RT#78753) - converted dist to Dist::Zilla 0.11 2012-05-11T16:15:04Z - Generate date time strings with a full timezone, not just "Z". - Additional coercions added. [Aaron Moses]. 0.10 2012-01-06T12:14:50Z - Fix and test casting of epoch times. 0.09 2012-01-04T19:16:21Z - Coerce to DateTime objects. - DateTimes must be in UTC now enforced. 0.08 2011-12-16 16:23:31Z - Durations can omit components, as per standard. - Date durations do not contain a "T" character. - Output fractional seconds. 0.07 2010-09-07 16:28:00 BST+0100 - Really fix so that it works in all cases. 0.06 2010-09-06 15:44:00 BST+0100 - Fix so that it works wihtout MooseX::Types::DateTime::MySQL installed. 0.05 2010-09-06 15:16:00 BST+0100 - Add support for coercing to and from MooseX::Types::DateTime::MySQL 0.04 2010-08-15 18:23:00 BST+0100 - Fix tests on perls compiled with uselongdoubles (RT#60356) 0.03 2010-08-13 11:15:00 BST+0100 - See also to the ISO8601 wiki page. - Added fractional times and tests to Durations. - Added coercion from Durations to DateTime objects - Deal better with duration cases found in the spec and real world by dealing with optionally empty hours. 0.02 2009-10-09 11:00:55 BST+0100 - Fixed time types. - Added coercions for the time types. - Documentation improvements 0.01 2009-06-12 12:42:29 BST+0100 - Initial version. MooseX-Types-ISO8601-0.14/debian/000755 000767 000024 00000000000 12111737222 016415 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/dist.ini000644 000767 000024 00000003234 12111737222 016641 0ustar00etherstaff000000 000000 name = MooseX-Types-ISO8601 author = Tomas Doran (t0m) abstract = ISO8601 date and duration string type constraints and coercions for Moose copyright_holder = Tomas Doran license = Perl_5 [Git::GatherDir] [@Filter] -bundle = @Basic -remove = GatherDir -remove = ExtraTests ; use V= to override; otherwise version is incremented from last tag [Git::NextVersion] version_regexp = ^v([\d._]+)(-TRIAL)?$ [GithubMeta] homepage = http://metacpan.org/module/MooseX::Types::ISO8601 [AutoPrereqs] skip = ^DT$ [Prereqs / RuntimeRequires] DateTime::Format::ISO8601 = 0 [Prereqs / RuntimeRecommends] MooseX::Types::DateTime::MySQL = 0 [InstallGuide] [MetaConfig] [MetaProvides::Package] [MetaJSON] [Git::Describe] [PkgVersion] [MinimumPerl] [ReadmeAnyFromPod] type = markdown filename = README.md location = root [NoTabsTests] [EOLTests] [PodSyntaxTests] [PodCoverageTests] [Test::Pod::LinkCheck] [Test::Pod::No404s] [Test::Compile] bail_out_on_fail = 1 [Test::MinimumVersion] [MetaTests] [Test::CPAN::Changes] [Test::Version] ;[Test::UnusedVars] ; broken in 5.16.0! [Test::ChangesHasContent] [Test::CheckDeps] :version = 0.005 fatal = 1 [RunExtraTests] [CheckPrereqsIndexed] [Git::Remote::Check] remote_branch = master [Git::CheckFor::CorrectBranch] :version = 0.004 release_branch = master release_branch = stable [Git::Check] allow_dirty = README.md [NextRelease] :version = 4.300018 format = %-8V %{yyyy-MM-dd HH:mm:ss ZZZZ}d (%U) [Git::Commit] allow_dirty = Changes allow_dirty = README.md commit_msg = %N-%v%t%n%n%c [Git::Tag] tag_format = v%v%t tag_message = v%v%t [Git::Push] [InstallRelease] install_command = cpanm . [Clean] MooseX-Types-ISO8601-0.14/INSTALL000644 000767 000024 00000001766 12111737222 016236 0ustar00etherstaff000000 000000 This is the Perl distribution MooseX-Types-ISO8601. Installing MooseX-Types-ISO8601 is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm MooseX::Types::ISO8601 If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S MooseX::Types::ISO8601 ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan MooseX::Types::ISO8601 ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install ## Documentation MooseX-Types-ISO8601 documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc MooseX::Types::ISO8601 MooseX-Types-ISO8601-0.14/lib/000755 000767 000024 00000000000 12111737222 015741 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/LICENSE000644 000767 000024 00000043650 12111737222 016210 0ustar00etherstaff000000 000000 This software is copyright (c) 2013 by Tomas Doran. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2013 by Tomas Doran. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2013 by Tomas Doran. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MooseX-Types-ISO8601-0.14/Makefile.PL000644 000767 000024 00000003500 12111737222 017143 0ustar00etherstaff000000 000000 use strict; use warnings; use 5.006; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "ISO8601 date and duration string type constraints and coercions for Moose", "AUTHOR" => "Tomas Doran (t0m) ", "BUILD_REQUIRES" => { "DateTime::Format::ISO8601" => 0, "File::Find" => 0, "File::Temp" => 0, "FindBin" => 0, "Moose" => 0, "Test::CheckDeps" => "0.002", "Test::Deep" => 0, "Test::Fatal" => 0, "Test::More" => "0.88", "Test::NoWarnings" => "1.04", "Test::Requires" => 0 }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "MooseX-Types-ISO8601", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "MooseX::Types::ISO8601", "PREREQ_PM" => { "Class::Load" => 0, "DateTime" => "0.41", "DateTime::Duration" => 0, "DateTime::Format::Duration" => "1.03", "DateTime::Format::ISO8601" => 0, "DateTime::TimeZone" => 0, "List::MoreUtils" => 0, "Module::Runtime" => 0, "MooseX::Types" => "0.10", "MooseX::Types::DateTime" => "0.03", "MooseX::Types::Moose" => 0, "Safe::Isa" => 0, "Scalar::Util" => 0, "Try::Tiny" => 0, "aliased" => 0, "namespace::autoclean" => "0.05", "strict" => 0, "warnings" => 0 }, "VERSION" => "0.14", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MooseX-Types-ISO8601-0.14/MANIFEST000644 000767 000024 00000001100 12111737222 016314 0ustar00etherstaff000000 000000 Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README debian/changelog debian/compat debian/control debian/copyright debian/rules dist.ini lib/MooseX/Types/ISO8601.pm t/00-check-deps.t t/00-compile.t t/00use.t t/01pod.t t/10_duration.t t/11_datetime.t t/12_mysql.t t/13_datetime_tz.t xt/release/changes_has_content.t xt/release/cpan-changes.t xt/release/distmeta.t xt/release/eol.t xt/release/minimum-version.t xt/release/no-tabs.t xt/release/pod-coverage.t xt/release/pod-linkcheck.t xt/release/pod-no404s.t xt/release/pod-syntax.t xt/release/test-version.t MooseX-Types-ISO8601-0.14/META.json000644 000767 000024 00000027302 12111737222 016620 0ustar00etherstaff000000 000000 { "abstract" : "ISO8601 date and duration string type constraints and coercions for Moose", "author" : [ "Tomas Doran (t0m) " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "MooseX-Types-ISO8601", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Meta" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "recommends" : { "MooseX::Types::DateTime::MySQL" : "0" }, "requires" : { "Class::Load" : "0", "DateTime" : "0.41", "DateTime::Duration" : "0", "DateTime::Format::Duration" : "1.03", "DateTime::Format::ISO8601" : "0", "DateTime::TimeZone" : "0", "List::MoreUtils" : "0", "Module::Runtime" : "0", "MooseX::Types" : "0.10", "MooseX::Types::DateTime" : "0.03", "MooseX::Types::Moose" : "0", "Safe::Isa" : "0", "Scalar::Util" : "0", "Try::Tiny" : "0", "aliased" : "0", "namespace::autoclean" : "0.05", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "DateTime::Format::ISO8601" : "0", "File::Find" : "0", "File::Temp" : "0", "FindBin" : "0", "Moose" : "0", "Test::CheckDeps" : "0.002", "Test::Deep" : "0", "Test::Fatal" : "0", "Test::More" : "0.88", "Test::NoWarnings" : "1.04", "Test::Requires" : "0" } } }, "provides" : { "MooseX::Types::ISO8601" : { "file" : "lib/MooseX/Types/ISO8601.pm", "version" : "0.14" } }, "release_status" : "stable", "resources" : { "homepage" : "http://metacpan.org/module/MooseX::Types::ISO8601", "repository" : { "type" : "git", "url" : "https://github.com/bobtfish/moosex-types-iso8601.git", "web" : "https://github.com/bobtfish/moosex-types-iso8601" } }, "version" : "0.14", "x_Dist_Zilla" : { "perl" : { "version" : "5.016002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "name" : "Git::GatherDir", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/PruneCruft", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/ManifestSkip", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/MetaYAML", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Filter/License", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Filter/Readme", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/ExecDir", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/ShareDir", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@Filter/MakeMaker", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/Manifest", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/TestRelease", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/ConfirmRelease", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/UploadToCPAN", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "name" : "Git::NextVersion", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "GithubMeta", "version" : "0.28" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "AutoPrereqs", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "RuntimeRequires", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "recommends" } }, "name" : "RuntimeRecommends", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "name" : "InstallGuide", "version" : "1.200000" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "MetaConfig", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "name" : "MetaProvides::Package", "version" : "1.14000001" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "MetaJSON", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Git::Describe", "name" : "Git::Describe", "version" : "0.002" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "PkgVersion", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::MinimumPerl", "name" : "MinimumPerl", "version" : "1.003" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "name" : "ReadmeAnyFromPod", "version" : "0.120120" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "name" : "NoTabsTests", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::EOLTests", "name" : "EOLTests", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "PodSyntaxTests", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "PodCoverageTests", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::LinkCheck", "name" : "Test::Pod::LinkCheck", "version" : "1.001" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::No404s", "name" : "Test::Pod::No404s", "version" : "1.001" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "name" : "Test::Compile", "version" : "2.000" }, { "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", "name" : "Test::MinimumVersion", "version" : "2.000002" }, { "class" : "Dist::Zilla::Plugin::MetaTests", "name" : "MetaTests", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "name" : "Test::CPAN::Changes", "version" : "0.005" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "Test::Version", "version" : "0.002004" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "Test::ChangesHasContent", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::Test::CheckDeps", "name" : "Test::CheckDeps", "version" : "0.005" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "name" : "RunExtraTests", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "CheckPrereqsIndexed", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "Git::Remote::Check", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", "name" : "Git::CheckFor::CorrectBranch", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "name" : "Git::Check", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "NextRelease", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "name" : "Git::Commit", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "name" : "Git::Tag", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "name" : "Git::Push", "version" : "2.009" }, { "class" : "Dist::Zilla::Plugin::InstallRelease", "name" : "InstallRelease", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::Clean", "name" : "Clean", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "4.300030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "4.300030" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "4.300030" } } } MooseX-Types-ISO8601-0.14/META.yml000644 000767 000024 00000016557 12111737222 016462 0ustar00etherstaff000000 000000 --- abstract: 'ISO8601 date and duration string type constraints and coercions for Moose' author: - 'Tomas Doran (t0m) ' build_requires: DateTime::Format::ISO8601: 0 File::Find: 0 File::Temp: 0 FindBin: 0 Moose: 0 Test::CheckDeps: 0.002 Test::Deep: 0 Test::Fatal: 0 Test::More: 0.88 Test::NoWarnings: 1.04 Test::Requires: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: MooseX-Types-ISO8601 provides: MooseX::Types::ISO8601: file: lib/MooseX/Types/ISO8601.pm version: 0.14 recommends: MooseX::Types::DateTime::MySQL: 0 requires: Class::Load: 0 DateTime: 0.41 DateTime::Duration: 0 DateTime::Format::Duration: 1.03 DateTime::Format::ISO8601: 0 DateTime::TimeZone: 0 List::MoreUtils: 0 Module::Runtime: 0 MooseX::Types: 0.10 MooseX::Types::DateTime: 0.03 MooseX::Types::Moose: 0 Safe::Isa: 0 Scalar::Util: 0 Try::Tiny: 0 aliased: 0 namespace::autoclean: 0.05 perl: 5.006 strict: 0 warnings: 0 resources: homepage: http://metacpan.org/module/MooseX::Types::ISO8601 repository: https://github.com/bobtfish/moosex-types-iso8601.git version: 0.14 x_Dist_Zilla: perl: version: 5.016002 plugins: - class: Dist::Zilla::Plugin::Git::GatherDir name: Git::GatherDir version: 2.009 - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/PruneCruft' version: 4.300030 - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/ManifestSkip' version: 4.300030 - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/MetaYAML' version: 4.300030 - class: Dist::Zilla::Plugin::License name: '@Filter/License' version: 4.300030 - class: Dist::Zilla::Plugin::Readme name: '@Filter/Readme' version: 4.300030 - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/ExecDir' version: 4.300030 - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/ShareDir' version: 4.300030 - class: Dist::Zilla::Plugin::MakeMaker name: '@Filter/MakeMaker' version: 4.300030 - class: Dist::Zilla::Plugin::Manifest name: '@Filter/Manifest' version: 4.300030 - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/TestRelease' version: 4.300030 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/ConfirmRelease' version: 4.300030 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/UploadToCPAN' version: 4.300030 - class: Dist::Zilla::Plugin::Git::NextVersion name: Git::NextVersion version: 2.009 - class: Dist::Zilla::Plugin::GithubMeta name: GithubMeta version: 0.28 - class: Dist::Zilla::Plugin::AutoPrereqs name: AutoPrereqs version: 4.300030 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: RuntimeRequires version: 4.300030 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: recommends name: RuntimeRecommends version: 4.300030 - class: Dist::Zilla::Plugin::InstallGuide name: InstallGuide version: 1.200000 - class: Dist::Zilla::Plugin::MetaConfig name: MetaConfig version: 4.300030 - class: Dist::Zilla::Plugin::MetaProvides::Package name: MetaProvides::Package version: 1.14000001 - class: Dist::Zilla::Plugin::MetaJSON name: MetaJSON version: 4.300030 - class: Dist::Zilla::Plugin::Git::Describe name: Git::Describe version: 0.002 - class: Dist::Zilla::Plugin::PkgVersion name: PkgVersion version: 4.300030 - class: Dist::Zilla::Plugin::MinimumPerl name: MinimumPerl version: 1.003 - class: Dist::Zilla::Plugin::ReadmeAnyFromPod name: ReadmeAnyFromPod version: 0.120120 - class: Dist::Zilla::Plugin::NoTabsTests name: NoTabsTests version: 0.01 - class: Dist::Zilla::Plugin::EOLTests name: EOLTests version: 0.02 - class: Dist::Zilla::Plugin::PodSyntaxTests name: PodSyntaxTests version: 4.300030 - class: Dist::Zilla::Plugin::PodCoverageTests name: PodCoverageTests version: 4.300030 - class: Dist::Zilla::Plugin::Test::Pod::LinkCheck name: Test::Pod::LinkCheck version: 1.001 - class: Dist::Zilla::Plugin::Test::Pod::No404s name: Test::Pod::No404s version: 1.001 - class: Dist::Zilla::Plugin::Test::Compile name: Test::Compile version: 2.000 - class: Dist::Zilla::Plugin::Test::MinimumVersion name: Test::MinimumVersion version: 2.000002 - class: Dist::Zilla::Plugin::MetaTests name: MetaTests version: 4.300030 - class: Dist::Zilla::Plugin::Test::CPAN::Changes name: Test::CPAN::Changes version: 0.005 - class: Dist::Zilla::Plugin::Test::Version name: Test::Version version: 0.002004 - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: Test::ChangesHasContent version: 0.006 - class: Dist::Zilla::Plugin::Test::CheckDeps name: Test::CheckDeps version: 0.005 - class: Dist::Zilla::Plugin::RunExtraTests name: RunExtraTests version: 0.011 - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: CheckPrereqsIndexed version: 0.008 - class: Dist::Zilla::Plugin::Git::Remote::Check name: Git::Remote::Check version: 0.1.2 - class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch name: Git::CheckFor::CorrectBranch version: 0.006 - class: Dist::Zilla::Plugin::Git::Check name: Git::Check version: 2.009 - class: Dist::Zilla::Plugin::NextRelease name: NextRelease version: 4.300030 - class: Dist::Zilla::Plugin::Git::Commit name: Git::Commit version: 2.009 - class: Dist::Zilla::Plugin::Git::Tag name: Git::Tag version: 2.009 - class: Dist::Zilla::Plugin::Git::Push name: Git::Push version: 2.009 - class: Dist::Zilla::Plugin::InstallRelease name: InstallRelease version: 0.008 - class: Dist::Zilla::Plugin::Clean name: Clean version: 0.07 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 4.300030 - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: 4.300030 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 4.300030 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 4.300030 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 4.300030 - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: 4.300030 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 4.300030 MooseX-Types-ISO8601-0.14/README000644 000767 000024 00000000531 12111737222 016052 0ustar00etherstaff000000 000000 This archive contains the distribution MooseX-Types-ISO8601, version 0.14: ISO8601 date and duration string type constraints and coercions for Moose This software is copyright (c) 2013 by Tomas Doran. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. MooseX-Types-ISO8601-0.14/t/000755 000767 000024 00000000000 12111737222 015436 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/xt/000755 000767 000024 00000000000 12111737222 015626 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/xt/release/000755 000767 000024 00000000000 12111737222 017246 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/xt/release/changes_has_content.t000644 000767 000024 00000002010 12111737222 023421 0ustar00etherstaff000000 000000 #!perl use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.14'; my $trial_token = '-TRIAL'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; # _get_changes copied and adapted from Dist::Zilla::Plugin::Git::Commit # by Jerome Quelin sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } MooseX-Types-ISO8601-0.14/xt/release/cpan-changes.t000644 000767 000024 00000000233 12111737222 021760 0ustar00etherstaff000000 000000 #!perl use Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); done_testing(); MooseX-Types-ISO8601-0.14/xt/release/distmeta.t000644 000767 000024 00000000217 12111737222 021245 0ustar00etherstaff000000 000000 #!perl use Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); MooseX-Types-ISO8601-0.14/xt/release/eol.t000644 000767 000024 00000000240 12111737222 020206 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; eval 'use Test::EOL'; plan skip_all => 'Test::EOL required' if $@; all_perl_files_ok({ trailing_whitespace => 1 }); MooseX-Types-ISO8601-0.14/xt/release/minimum-version.t000644 000767 000024 00000000270 12111737222 022570 0ustar00etherstaff000000 000000 #!perl use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_from_metayml_ok(); MooseX-Types-ISO8601-0.14/xt/release/no-tabs.t000644 000767 000024 00000000212 12111737222 020771 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; eval 'use Test::NoTabs'; plan skip_all => 'Test::NoTabs required' if $@; all_perl_files_ok(); MooseX-Types-ISO8601-0.14/xt/release/pod-coverage.t000644 000767 000024 00000000527 12111737222 022012 0ustar00etherstaff000000 000000 #!perl use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); MooseX-Types-ISO8601-0.14/xt/release/pod-linkcheck.t000644 000767 000024 00000000537 12111737222 022153 0ustar00etherstaff000000 000000 #!perl use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } MooseX-Types-ISO8601-0.14/xt/release/pod-no404s.t000644 000767 000024 00000000527 12111737222 021246 0ustar00etherstaff000000 000000 #!perl use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_NO404S AUTOMATED_TESTING ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::No404s"; if ( $@ ) { plan skip_all => 'Test::Pod::No404s required for testing POD'; } else { all_pod_files_ok(); } MooseX-Types-ISO8601-0.14/xt/release/pod-syntax.t000644 000767 000024 00000000212 12111737222 021534 0ustar00etherstaff000000 000000 #!perl use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); MooseX-Types-ISO8601-0.14/xt/release/test-version.t000644 000767 000024 00000000643 12111737222 022100 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } my @imports = ( 'version_all_ok' ); my $params = { is_strict => 0, has_version => 1, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; MooseX-Types-ISO8601-0.14/t/00-check-deps.t000644 000767 000024 00000000247 12111737222 020051 0ustar00etherstaff000000 000000 use Test::More 0.88; use Test::CheckDeps; check_dependencies(); if (1) { BAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing; } done_testing; MooseX-Types-ISO8601-0.14/t/00-compile.t000644 000767 000024 00000003237 12111737222 017475 0ustar00etherstaff000000 000000 #!perl use strict; use warnings; use Test::More; use File::Find; use File::Temp qw{ tempdir }; my @modules; find( sub { return if $File::Find::name !~ /\.pm\z/; my $found = $File::Find::name; $found =~ s{^lib/}{}; $found =~ s{[/\\]}{::}g; $found =~ s/\.pm$//; # nothing to skip push @modules, $found; }, 'lib', ); sub _find_scripts { my $dir = shift @_; my @found_scripts = (); find( sub { return unless -f; my $found = $File::Find::name; # nothing to skip open my $FH, '<', $_ or do { note( "Unable to open $found in ( $! ), skipping" ); return; }; my $shebang = <$FH>; return unless $shebang =~ /^#!.*?\bperl\b\s*$/; push @found_scripts, $found; }, $dir, ); return @found_scripts; } my @scripts; do { push @scripts, _find_scripts($_) if -d $_ } for qw{ bin script scripts }; my $plan = scalar(@modules) + scalar(@scripts); $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run"); { # fake home for cpan-testers # no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 ); like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" ) for sort @modules; SKIP: { eval "use Test::Script 1.05; 1;"; skip "Test::Script needed to test script compilation", scalar(@scripts) if $@; foreach my $file ( @scripts ) { my $script = $file; $script =~ s!.*/!!; script_compiles( $file, "$script script compiles" ); } } BAIL_OUT("Compilation failures") if !Test::More->builder->is_passing; } MooseX-Types-ISO8601-0.14/t/00use.t000644 000767 000024 00000000147 12111737222 016561 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More tests => 1; use_ok('MooseX::Types::ISO8601') or BAIL_OUT; MooseX-Types-ISO8601-0.14/t/01pod.t000644 000767 000024 00000000442 12111737222 016546 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; use FindBin qw/$Bin/; use Test::Requires { 'Test::Pod' => 1.14 }; push(@Pod::Simple::Known_directives => 'meta'); # Need more meta! $Pod::Simple::Known_directives{meta} = 'Plain'; my @pods = all_pod_files("$Bin/../"); all_pod_files_ok(@pods); MooseX-Types-ISO8601-0.14/t/10_duration.t000644 000767 000024 00000010511 12111737222 017746 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; use Test::Fatal; # TODO: instead of relying on Moose attributes, just call ->check, # ->assert_coerce etc on the type object directly (see # Moose::Meta::TypeConstraint for the available API). { package MyClass; use Moose; use MooseX::Types::ISO8601 qw/ ISO8601TimeDurationStr ISO8601DateDurationStr ISO8601DateTimeDurationStr /; use namespace::autoclean; foreach my $attr ( [time_duration => ISO8601TimeDurationStr], [date_duration => ISO8601DateDurationStr], [datetime_duration => ISO8601DateTimeDurationStr], ) { has $attr->[0] => ( isa => $attr->[1], coerce => 1, required => 1, is => 'ro' ); } } is(exception { my ($time_duration, $date_duration, $datetime_duration) = ('PT00H00M00S', 'P01Y01M01D', 'P01Y01M01DT00H00M00S'); my $i = MyClass->new( time_duration => $time_duration, date_duration => $date_duration, datetime_duration => $datetime_duration, ); is($i->time_duration, $time_duration, 'Time duration string unmangled'); is($i->date_duration, $date_duration, 'Date duration string unmangled'); is($i->datetime_duration, $datetime_duration, 'DateTime duration string unmangled'); }, undef, 'Create with string duration'); is(exception { my $i = MyClass->new( time_duration => 60, date_duration => 259200, datetime_duration => 262800, ); is($i->time_duration, 'PT00H01M00S', 'Time duration number coerced'); is($i->date_duration, 'P00Y00M03D', 'Date duration number coerced'); is($i->datetime_duration, 'P00Y00M03DT01H00M00S', 'DateTime duration number coerced'); }, undef, 'Create with Numeric duration'); use MooseX::Types::ISO8601 qw/ ISO8601TimeDurationStr ISO8601DateDurationStr ISO8601DateTimeDurationStr /; use MooseX::Types::DateTime qw/ Duration /; # Time durations ok !is_ISO8601TimeDurationStr("PT"); foreach my $tp ( ['PT0H15M.507S', 'PT00H15M00.507000S'], # Note pairs, as we normalise whilst # roundtripping.. ['PT4M10S','PT00H04M10S'], ['PT51S', 'PT00H00M51S'], ['PT001H15M01S', 'PT01H15M01S'], ['PT0006M03S', 'PT00H06M03S'], ) { my $t = $tp->[0]; my $ret = $tp->[1] || $t; ok is_ISO8601TimeDurationStr($t), $t . ' is an ISO8601TimeDurationStr'; ok is_ISO8601DateTimeDurationStr($t), $t . ' is not a ISO8601DateTimeDurationStr, with no date elements'; ok !is_ISO8601DateDurationStr($t), $t . ' is not an ISO8601DateDurationStr'; my $dt = to_Duration($t); ok $dt, 'Appears to coerce to DateTime::Duration'; isa_ok $dt, 'DateTime::Duration'; is to_ISO8601TimeDurationStr($dt), $ret, $t . ' round trips'; } # DateTime durations ok !is_ISO8601DateTimeDurationStr("P"); ok !is_ISO8601DateTimeDurationStr("PT"); foreach my $tp ( ['P00Y08M02DT0H15M.507S', 'P00Y08M02DT00H15M00.507000S'], ['P00Y08M02DT0H15M,507S', 'P00Y08M02DT00H15M00.507000S'], ['P00Y08M03DT0H15M,507S', 'P00Y08M03DT00H15M00.507000S'], ['PT01S', 'P00Y00M00DT00H00M01S'], ) { my $t = $tp->[0]; my $ret = $tp->[1] || $t; ok is_ISO8601DateTimeDurationStr($t), $t . ' is an ISO8601DateTimeDurationStr'; ok !is_ISO8601DateDurationStr($t), $t . ' is not an ISO8601DateDurationStr'; my $dt = to_Duration($t); ok $dt, 'Appears to coerce to DateTime::Duration'; isa_ok $dt, 'DateTime::Duration'; is to_ISO8601DateTimeDurationStr($dt), $ret, $t . ' round trips'; } ok !is_ISO8601TimeDurationStr('P00Y08M02DT0H15M.507S'), 'has date elements, and so not a time'; # Date durations ok !is_ISO8601DateDurationStr("P"); foreach my $tp ( ['P02Y08M02D'], ['P02D', 'P00Y00M02D'], ) { my $t = $tp->[0]; my $ret = $tp->[1] || $t; ok !is_ISO8601TimeDurationStr($t), $t . ' is no an ISO8601TimeDurationStr'; ok is_ISO8601DateTimeDurationStr($t), $t . ' not is an ISO8601DateTimeDurationStr'; ok is_ISO8601DateDurationStr($t), $t . ' is an ISO8601DateDurationStr'; my $dt = to_Duration($t); ok $dt, 'Appears to coerce to DateTime::Duration'; isa_ok $dt, 'DateTime::Duration'; is to_ISO8601DateDurationStr($dt), $ret, $t . ' round trips'; } done_testing; MooseX-Types-ISO8601-0.14/t/11_datetime.t000644 000767 000024 00000013560 12111737222 017725 0ustar00etherstaff000000 000000 use strict; use warnings; use MooseX::Types::DateTime; use DateTime::Format::ISO8601; use MooseX::Types::ISO8601 qw/ ISO8601DateStr ISO8601TimeStr ISO8601DateTimeStr ISO8601StrictDateStr ISO8601StrictTimeStr ISO8601StrictDateTimeStr /; # TODO: instead of relying on Moose attributes, just call ->check, # ->assert_coerce etc on the type object directly (see # Moose::Meta::TypeConstraint for the available API). { package My::DateClass; use Moose; use MooseX::Types::ISO8601 qw/ ISO8601DateStr ISO8601TimeStr ISO8601DateTimeStr /; use namespace::autoclean; foreach my $type ( [date => ISO8601DateStr], [time => ISO8601TimeStr], [datetime => ISO8601DateTimeStr], ) { has $type->[0] => ( isa => $type->[1], is => 'ro', required => 1, coerce => 1, ); } } use Test::More; use Test::Fatal; use DateTime; foreach my $tz ('', 'Z') { is(exception { my $i = My::DateClass->new( date => '2009-01-01', time => '12:34:29' . $tz, datetime => '2009-01-01T12:34:29' . $tz, ); is( $i->date, '2009-01-01', 'Date unmangled' ); is( $i->time, '12:34:29' . $tz, 'Time unmangled' ); is( $i->datetime, '2009-01-01T12:34:29' . $tz, 'Datetime unmangled' ); }, undef, 'Date class instance'); } is(exception { my $date = DateTime->now; my $i = My::DateClass->new( map { $_ => $date } qw/date time datetime/ ); ok !ref($_) for map { $i->$_ } qw/date time datetime/; like( $i->date, qr/\d{4}-\d{2}-\d{2}/, 'Date mangled' ); like( $i->time, qr/\d{2}:\d{2}Z/, 'Time mangled' ); like( $i->datetime, qr/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, 'Datetime mangled' ); }, undef, 'Date class instance with coercion'); foreach my $tz ('', 'Z') { my $datetime = MooseX::Types::DateTime::to_DateTime('2011-01-04T18:14:15.1234Z'); isa_ok($datetime, 'DateTime'); is($datetime->year, 2011); is($datetime->month, 1); is($datetime->day, 4); is($datetime->hour, 18); is($datetime->minute, 14); is($datetime->second, 15); is($datetime->nanosecond, 123400000); is($datetime->time_zone->name, 'UTC', 'Z -> UTC'); my $date = MooseX::Types::DateTime::to_DateTime('2011-01-04'); isa_ok($date, 'DateTime'); is($date->year, 2011); is($date->month, 1); is($date->day, 4); is($date->time_zone->name, 'floating', 'no time zome -> floating'); # Cannot work as DateTime requires a year # my $time = MooseX::Types::DateTime::to_DateTime('18:14:15.1234Z'); # isa_ok($time, 'DateTime'); # is($time->hour, 18); # is($time->minute, 14); # is($time->second, 12); # is($time->nanosecond, 123400000); } { foreach my $date (qw( 2012-01-12 20120112 )) { foreach my $time ( '17:05:00', '17:05:00.0001', '17:05:00,0001', '170500', '170500,0001', '170500.0001' ) { foreach my $zone (qw( +0000 +00:00 +00 Z )) { ok is_ISO8601DateTimeStr( to_ISO8601DateTimeStr($date.'T'.$time.$zone) ), 'coercing '.$date.'T'.$time.$zone; } } } foreach my $date (qw( 2012-01-12 20120112 )) { ok is_ISO8601DateStr( to_ISO8601DateStr($date) ), $date.'does not coerce'; } foreach my $time ( '17:05:00', '17:05:00.0001', '17:05:00,0001', '170500', '170500,0001', '170500.0001' ) { foreach my $zone (qw( +0000 +00:00 +00 Z )) { ok is_ISO8601TimeStr( to_ISO8601TimeStr($time.$zone) ), 'coercing '.$time.$zone; } } } { my $datetime = DateTime->new( year => 2011, month => 1, day => 1, hour => 0, minute => 0, second => 0, time_zone => 'Asia/Taipei' ); like(exception { to_ISO8601DateTimeStr($datetime) }, qr/cannot coerce non-UTC time/); $datetime->set_time_zone('UTC'); is(exception { to_ISO8601DateTimeStr($datetime) }, undef); } { local $TODO = "UTC offsets are not yet supported"; ok is_ISO8601DateTimeStr('2011-12-19T15:03:56+01:00'); ok is_ISO8601DateTimeStr('2011-12-19T15:03:56-01:00'); ok is_ISO8601DateTimeStr('2011-12-19T15:03:56+01:30'); ok is_ISO8601DateTimeStr('2011-12-19T15:03:56-01:30'); ok is_ISO8601DateTimeStr('2011-12-19T15:03:56+01'); ok is_ISO8601DateTimeStr('2011-12-19T15:03:56-01'); ok is_ISO8601DateTimeStr('15:03:56+01:00'); ok is_ISO8601DateTimeStr('15:03:56-01:00'); ok is_ISO8601DateTimeStr('15:03:56+01:30'); ok is_ISO8601DateTimeStr('15:03:56-01:30'); ok is_ISO8601DateTimeStr('15:03:56+01'); ok is_ISO8601DateTimeStr('15:03:56-01'); } { is(to_ISO8601DateTimeStr(5), '1970-01-01T00:00:05Z'); is_ISO8601DateTimeStr(to_ISO8601DateTimeStr(time)); } # strict types { ok(is_ISO8601DateStr('2013-02-31'), 'bad date validates against our regexp'); ok(!is_ISO8601StrictDateStr('2013-02-31'), 'bad date is caught by strict type'); ok(is_ISO8601StrictDateStr('2013-02-01'), 'good date passes strict type'); is(to_ISO8601StrictDateStr(DateTime::Format::ISO8601->parse_datetime('2013-02-01')), '2013-02-01'); ok(is_ISO8601TimeStr('25:00:00'), 'bad time validates against our regexp'); ok(!is_ISO8601StrictTimeStr('25:00:00'), 'bad time is caught by strict type'); ok(is_ISO8601StrictTimeStr('23:00:00'), 'good time passes strict type'); # this isn't what we started with, but good enough... is(to_ISO8601StrictTimeStr(DateTime::Format::ISO8601->parse_datetime('23:00:00')), '23:00:00Z'); ok(is_ISO8601DateTimeStr('2013-02-31T00:00:00'), 'bad datetime validates against our regexp'); ok(!is_ISO8601StrictDateTimeStr('2013-02-31T00:00:00'), 'bad datetime is caught by strict type'); ok(is_ISO8601StrictDateTimeStr('2013-02-01T00:00:00'), 'good datetime passes strict type'); is(to_ISO8601StrictDateTimeStr(DateTime::Format::ISO8601->parse_datetime('2013-02-01T00:00:00')), '2013-02-01T00:00:00Z'); } done_testing; MooseX-Types-ISO8601-0.14/t/12_mysql.t000644 000767 000024 00000000544 12111737222 017275 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; use Test::Requires 'MooseX::Types::DateTime::MySQL'; use MooseX::Types::ISO8601 qw/ ISO8601DateStr ISO8601TimeStr ISO8601DateTimeStr /; my $mysql_dt = '2010-08-16 09:26:25'; is to_ISO8601DateStr($mysql_dt), '2010-08-16'; is to_ISO8601DateTimeStr($mysql_dt), '2010-08-16T09:26:25Z'; done_testing; MooseX-Types-ISO8601-0.14/t/13_datetime_tz.t000644 000767 000024 00000003473 12111737222 020446 0ustar00etherstaff000000 000000 use strict; use warnings; use MooseX::Types::DateTime; use MooseX::Types::ISO8601 qw/ ISO8601DateTimeTZStr ISO8601StrictDateTimeTZStr /; use Test::More tests => 9; use Test::Deep; use Test::NoWarnings 1.04 ':early'; { note "String with offset into datetime"; my $datetime = MooseX::Types::DateTime::to_DateTime('2011-02-03T04:05:06+01:30'); cmp_deeply( $datetime, all( isa('DateTime'), methods( offset => 3600+1800, datetime => "2011-02-03T04:05:06", nanosecond => 0, ), ), ); note "DateTime into string"; is(to_ISO8601DateTimeTZStr($datetime), "2011-02-03T04:05:06+01:30"); } { note "String with offset into datetime, with precision"; my $datetime = MooseX::Types::DateTime::to_DateTime('2011-02-03T04:05:06.000000001+01:30'); cmp_deeply( $datetime, all( isa('DateTime'), methods( offset => 3600+1800, datetime => "2011-02-03T04:05:06", nanosecond => '000000001', ), ), ); # XXX - currently we don't generate nanosecond offsets for compatibility. note "DateTime into string"; is(to_ISO8601DateTimeTZStr($datetime), "2011-02-03T04:05:06+01:30"); } { # it doesn't look like we can validate bad timezones, as it's just an arbitrary hour offset? ok(is_ISO8601DateTimeTZStr('2013-02-31T00:00:00+01:00'), 'bad datetime validates against our regexp'); ok(!is_ISO8601StrictDateTimeTZStr('2013-02-31T00:00:00+01:00'), 'bad datetime is caught by strict type'); ok(is_ISO8601StrictDateTimeTZStr('2013-02-01T00:00:00+01:00'), 'good datetime passes strict type'); is(to_ISO8601StrictDateTimeTZStr('2013-02-01T00:00:00+01:00'), '2013-02-01T00:00:00+01:00'); } MooseX-Types-ISO8601-0.14/lib/MooseX/000755 000767 000024 00000000000 12111737222 017153 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/lib/MooseX/Types/000755 000767 000024 00000000000 12111737222 020257 5ustar00etherstaff000000 000000 MooseX-Types-ISO8601-0.14/lib/MooseX/Types/ISO8601.pm000644 000767 000024 00000034343 12111737222 021575 0ustar00etherstaff000000 000000 package MooseX::Types::ISO8601; { $MooseX::Types::ISO8601::VERSION = '0.14'; } # git description: v0.13-15-g1c78bdb # ABSTRACT: ISO8601 date and duration string type constraints and coercions for Moose use strict; use warnings; use DateTime 0.41; # this alias lets us distinguish the class from the class_type in versions of # MooseX::Types that can't figure that out for us (i.e. before 0.32) use aliased DateTime => 'DT'; use DateTime::TimeZone; use DateTime::Duration; use DateTime::Format::Duration 1.03; use MooseX::Types::DateTime 0.03 qw(Duration DateTime); use MooseX::Types::Moose qw/Str Num/; use List::MoreUtils qw/ zip /; use Scalar::Util qw/ looks_like_number /; use Class::Load 'try_load_class'; use Module::Runtime 'use_module'; use Try::Tiny; use Safe::Isa; our $MYSQL; BEGIN { $MYSQL = 0; if (try_load_class 'MooseX::Types::DateTime::MySQL') { MooseX::Types::DateTime::MySQL->import(qw/ MySQLDateTime /); $MYSQL = 1; } } use namespace::autoclean 0.05; use MooseX::Types 0.10 -declare => [qw( ISO8601DateStr ISO8601TimeStr ISO8601DateTimeStr ISO8601DateTimeTZStr ISO8601StrictDateStr ISO8601StrictTimeStr ISO8601StrictDateTimeStr ISO8601StrictDateTimeTZStr ISO8601TimeDurationStr ISO8601DateDurationStr ISO8601DateTimeDurationStr ISO8601DateTimeDurationStr )]; my $date_re = qr/^(\d{4})-(\d{2})-(\d{2})$/; my $time_re = qr/^(\d{2}):(\d{2}):(\d{2})(?:(?:\.|,)(\d+))?Z?$/; my $datetime_re = qr/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:(?:\.|,)(\d+))?Z?$/; my $datetimetz_re = qr/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:(?:\.|,)(\d+))?((?:\+|-)\d\d:\d\d)$/; subtype ISO8601DateStr, as Str, where { /$date_re/ }; # XXX TODO: this doesn't match all the ISO Time formats in the spec: # hhmmss # hhmm # hh # hh:mm subtype ISO8601TimeStr, as Str, where { /$time_re/ }; subtype ISO8601DateTimeStr, as Str, where { /$datetime_re/ }; # XXX TODO: this doesn't match these offset indicators: # ±hhmm # ±hh subtype ISO8601DateTimeTZStr, as Str, where { /$datetimetz_re/ }; subtype ISO8601StrictDateStr, as ISO8601DateStr, where { (try { use_module('DateTime::Format::ISO8601')->parse_datetime($_) })->$_isa('DateTime') }; subtype ISO8601StrictTimeStr, as ISO8601TimeStr, where { ( try { use_module('DateTime::Format::ISO8601')->parse_datetime($_) } || try { DateTime::Format::ISO8601->parse_time($_) } )->$_isa('DateTime') }; subtype ISO8601StrictDateTimeStr, as ISO8601DateTimeStr, where { (try { use_module('DateTime::Format::ISO8601')->parse_datetime($_) })->$_isa('DateTime') }; subtype ISO8601StrictDateTimeTZStr, as ISO8601DateTimeTZStr, where { (try { use_module('DateTime::Format::ISO8601')->parse_datetime($_) })->$_isa('DateTime') }; # TODO: According to ISO 8601:2004(E), the lowest order components may be # omitted, if less accuracy is required. The lowest component may also have # a decimal fraction. We don't support these both together, you may only have # a fraction on the seconds component. my $timeduration_re = qr/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d{0,2})(?:(?:\.|,)(\d+))?S)?$/; subtype ISO8601TimeDurationStr, as Str, where { grep { looks_like_number($_) } /$timeduration_re/; }; my $dateduration_re = qr/^P(?:(\d+)Y)?(?:(\d{1,2})M)?(?:(\d{1,2})D)?$/; subtype ISO8601DateDurationStr, as Str, where { grep { looks_like_number($_) } /$dateduration_re/ }; my $datetimeduration_re = qr/^P(?:(\d+)Y)?(?:(\d{1,2})M)?(?:(\d{1,2})D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d{0,2})(?:(?:\.|,)(\d+))?)S)?$/; subtype ISO8601DateTimeDurationStr, as Str, where { grep { looks_like_number($_) } /$datetimeduration_re/ }; { my %coerce = ( ISO8601TimeDurationStr, 'PT%02HH%02MM%02S.%06NS', ISO8601DateDurationStr, 'P%02YY%02mM%02dD', ISO8601DateTimeDurationStr, 'P%02YY%02mM%02dDT%02HH%02MM%02S.%06NS', ); foreach my $type_name (keys %coerce) { my $code = sub { my $str = DateTime::Format::Duration->new( normalize => 1, pattern => $coerce{$type_name}, ) ->format_duration( shift ); # Remove fractional seconds if there aren't any. $str =~ s/\.0+S$/S/; return $str; }; coerce $type_name, from Duration, via { $code->($_) }, from Num, via { $code->(to_Duration($_)) }; # FIXME - should be able to say => via_type 'DateTime::Duration'; # nothingmuch promised to make that syntax happen if I got # Stevan to approve and/or wrote a test case. } } { my %coerce = ( ISO8601TimeStr, sub { die "cannot coerce non-UTC time" if ($_[0]->offset!=0); $_[0]->hms(':') . 'Z' }, ISO8601DateStr, sub { $_[0]->ymd('-') }, ISO8601DateTimeStr, sub { die "cannot coerce non-UTC time" if ($_[0]->offset!=0); $_[0]->ymd('-') . 'T' . $_[0]->hms(':') . 'Z' }, ISO8601DateTimeTZStr, sub { DateTime::TimeZone->offset_as_string($_[0]->offset) =~ /(.\d\d)(\d\d)/; $_[0]->ymd('-') . 'T' . $_[0]->hms(':') . "$1:$2" }, ); @coerce{(ISO8601StrictTimeStr, ISO8601StrictDateStr, ISO8601StrictDateTimeStr, ISO8601StrictDateTimeTZStr)} = @coerce{(ISO8601TimeStr, ISO8601DateStr, ISO8601DateTimeStr, ISO8601DateTimeTZStr)}; foreach my $type_name (keys %coerce) { coerce $type_name, from DateTime, via { $coerce{$type_name}->($_) }, from Num, via { $coerce{$type_name}->(DT->from_epoch( epoch => $_ )) }; if ($MYSQL) { coerce $type_name, from MySQLDateTime(), via { $coerce{$type_name}->(to_DateTime($_)) }; } } } { my %coerce = ( ISO8601TimeStr, sub { $_ =~ s/^(\d\d) \:? (\d\d) \:? (\d\d([\.\,]\d+)?) (([+-]00\:?(00)?)|Z) $ /${1}:${2}:${3}Z/x; return $_; }, ISO8601DateStr, sub { $_ =~ s/^(\d{4}) \-? (\d\d) \-? (\d\d)$ /${1}-${2}-${3}/x; return $_; }, ISO8601DateTimeStr, sub { $_ =~ s/^(\d{4}) \-? (\d\d) \-? (\d\d) T(\d\d) \:? (\d\d) \:? (\d\d([\.\,]\d+)?) (([+-]00\:?(00)?)|Z)$ /${1}-${2}-${3}T${4}:${5}:${6}Z/x; return $_; }, ); @coerce{(ISO8601StrictTimeStr, ISO8601StrictDateStr, ISO8601StrictDateTimeStr, ISO8601StrictDateTimeTZStr)} = @coerce{(ISO8601TimeStr, ISO8601DateStr, ISO8601DateTimeStr, ISO8601DateTimeTZStr)}; foreach my $type_name (keys %coerce) { coerce $type_name, from Str, via { $coerce{$type_name}->($_) }, } } { my @datefields = qw/ years months days /; my @timefields = qw/ hours minutes seconds nanoseconds /; my @datetimefields = (@datefields, @timefields); coerce Duration, from ISO8601DateTimeDurationStr, via { my @fields = map { $_ || 0 } $_ =~ /$datetimeduration_re/; if ($fields[6]) { my $missing = 9 - length($fields[6]); $fields[6] .= "0" x $missing; } DateTime::Duration->new( zip @datetimefields, @fields ); }, from ISO8601DateDurationStr, via { my @fields = map { $_ || 0 } $_ =~ /$dateduration_re/; DateTime::Duration->new( zip @datefields, @fields ); }, from ISO8601TimeDurationStr, via { my @fields = map { $_ || 0 } $_ =~ /$timeduration_re/; if ($fields[3]) { my $missing = 9 - length($fields[3]); $fields[3] .= "0" x $missing; } DateTime::Duration->new( zip @timefields, @fields ); }; } { my @datefields = qw/ year month day /; my @timefields = qw/ hour minute second nanosecond /; my @datetimefields = (@datefields, @timefields); my @datetimetzfields = (@datefields, @timefields, "time_zone"); coerce DateTime, from ISO8601DateTimeStr, via { # TODO: surely we should be using # DateTime::Format::ISO8601->parse_datetime for this my @fields = map { $_ || 0 } $_ =~ /$datetime_re/; if ($fields[6]) { my $missing = 9 - length($fields[6]); $fields[6] .= "0" x $missing; } DT->new( zip(@datetimefields, @fields), time_zone => 'UTC' ); }, from ISO8601DateTimeTZStr, via { my @fields = map { $_ || 0 } $_ =~ /$datetimetz_re/; if ($fields[6]) { my $missing = 9 - length($fields[6]); $fields[6] .= "0" x $missing; } DT->new( zip(@datetimetzfields, @fields ) ); }, from ISO8601DateStr, via { my @fields = map { $_ || 0 } $_ =~ /$date_re/; DT->new( zip @datefields, @fields ); }, # XXX This coercion does not work as DateTime requires a year. from ISO8601TimeStr, via { my @fields = map { $_ || 0 } $_ =~ /$time_re/; if ($fields[3]) { my $missing = 9 - length($fields[3]); $fields[3] .= "0" x $missing; } DT->new( zip(@timefields, @fields), 'time_zone' => 'UTC' ); }; } 1; __END__ =head1 NAME MooseX::Types::ISO8601 - ISO8601 date and duration string type constraints and coercions for Moose =head1 SYNOPSIS use MooseX::Types::ISO8601 qw/ ISO8601DateTimeStr ISO8601TimeDurationStr /; has datetime => ( is => 'ro', isa => ISO8601DateTimeStr, ); has duration => ( is => 'ro', isa => ISO8601TimeDurationStr, coerce => 1, ); Class->new( datetime => '2012-01-01T00:00:00' ); Class->new( duration => 60 ); # 60s => PT00H01M00S Class->new( duration => DateTime::Duration->new(%args) ) =head1 DESCRIPTION This module packages several L with coercions for working with ISO8601 date strings and the DateTime suite of objects. =head1 DATE CONSTRAINTS =head2 ISO8601DateStr An ISO8601 date string. E.g. C<< 2009-06-11 >> =head2 ISO8601TimeStr An ISO8601 time string. E.g. C<< 12:06:34Z >> =head2 ISO8601DateTimeStr An ISO8601 combined datetime string. E.g. C<< 2009-06-11T12:06:34Z >> =head2 ISO8601DateTimeTZStr An ISO8601 combined datetime string with a fully specified timezone. E.g. C<< 2009-06-11T12:06:34+00:00 >> =head2 ISO8601StrictDateStr =head2 ISO8601StrictTimeStr =head2 ISO8601StrictDateTimeStr =head2 ISO8601StrictDateTimeTZStr As above, only in addition to validating the strings against regular expressions, an attempt is made to actually parse the data into a L object. This will catch cases like '2013-02-31' which look correct but do not correspond to real-world values. Note that this is bears a computation penalty. =head2 COERCIONS The date types will coerce from: =over =item C< Num > The number is treated as a time in seconds since the unix epoch =item C< DateTime > The duration represented as a L object. =item C< Str > Non-expanded date and time string representations. e.g.:- 20120113 => 2012-01-13 170500Z => 17:05:00Z 20120113T170500Z => 2012-01-13T17:05:00Z Representations of UTC time zone (only an offset of zero is supported) e.g.:- 17:05:00+00:00 => 17:05:00Z 17:05:00+00 => 17:05:00Z 170500+0000 => 17:05:00Z 2012-01-13T17:05:00+00:00 => 2012-01-13T17:05:00Z 2012-01-13T17:05:00+00 => 2012-01-13T17:05:00Z 20120113T170500+0000 => 2012-01-13T17:05:00Z Also supports non-standards mixing of expanded and non-expanded representations e.g.:- 2012-01-13T170500Z => 2012-01-13T17:05:00Z 20120113T17:05:00Z => 2012-01-13T17:05:00Z In addition, there are coercions from these string types to L. =back =head1 DURATION CONSTRAINTS =head2 ISO8601DateDurationStr An ISO8601 date duration string. E.g. C<< P01Y01M01D >> =head2 ISO8601TimeDurationStr An ISO8601 time duration string. E.g. C<< PT01H01M01S >> =head2 ISO8601DateTimeDurationStr An ISO8601 combined date and time duration string. E.g. C<< P01Y01M01DT01H01M01S >> =head2 COERCIONS The duration types will coerce from: =over =item C< Num > The number is treated as a time in seconds =item C< DateTime::Duration > The duration represented as a L object. =back The duration types will coerce to: =over =item C< Duration > A L, i.e. the C< Duration > constraint from L. =back =head1 FEATURES =head2 Fractional seconds If provided, the number of seconds in time types is represented to microsecond accuracy. A full stop character is used as the decimal separator, which is allowed, but deprecated in preference to the comma character in I. =head1 BUGS Probably full of them, patches are very welcome. Specifically missing features: =over =item * No timezone support - all times are assumed UTC =item * No week number type =item * "Basic format", which lacks separator characters, is not supported for reading or writing. =item * Tests are rubbish. =back =head1 SEE ALSO =over =item * L =item * L =item * L =item * L =item * L =item * L =item * L =back =head1 VERSION CONTROL http://github.com/bobtfish/moosex-types-iso8601/tree/master Patches are welcome. =head1 AUTHOR =over =item Tomas Doran (t0m) C<< >> =item Dave Lambley C<< >> =back The development of this code was sponsored by my employer L. =head2 Contributors =over =item Aaron Moses =back =head1 COPYRIGHT Copyright (c) 2009 Tomas Doran. Some rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut MooseX-Types-ISO8601-0.14/debian/changelog000644 000767 000024 00000002111 12111737222 020262 0ustar00etherstaff000000 000000 libmoosex-types-iso8601-perl (0.10-1) lucid; urgency=low * New upstream version. -- Dave Lambley Fri, 06 Jan 2012 12:15:08 +0000 libmoosex-types-iso8601-perl (0.07-1-state51-1) hardy; urgency=low * Better handle missing components. -- Dave Lambley Wed, 04 May 2011 13:14:00 +0100 libmoosex-types-iso8601-perl (0.07-1) unstable; urgency=low * Fixed version -- Tomas Doran Mon, 6 Sept 2010 15:41:26 +0100 libmoosex-types-iso8601-perl (0.06-1) unstable; urgency=low * More features. -- Tomas Doran Mon, 6 Sept 2010 15:41:26 +0100 libmoosex-types-iso8601-perl (0.03-1) unstable; urgency=low * More features. -- Tomas Doran Fri, 13 Aug 2010 11:18:26 +0100 libmoosex-types-iso8601-perl (0.02-1) unstable; urgency=low * Initial Release. -- Tomas Doran Mon, 29 Mar 2010 11:27:26 +0100 libmoosex-types-iso8601-perl (0.01-1) unstable; urgency=low * Initial Release. -- Tomas Doran Mon, 15 Jun 2009 11:16:26 +0100 MooseX-Types-ISO8601-0.14/debian/compat000644 000767 000024 00000000002 12111737222 017613 0ustar00etherstaff000000 000000 5 MooseX-Types-ISO8601-0.14/debian/control000644 000767 000024 00000002313 12111737222 020017 0ustar00etherstaff000000 000000 Source: libmoosex-types-iso8601-perl Section: perl Priority: optional Build-Depends: debhelper (>= 5.0.0) Build-Depends-Indep: perl (>= 5.8.8-1), libdatetime-perl (>= 0.41), libnamespace-autoclean-perl (>= 0.05), libmoosex-types-datetime-perl (>= 0.03), libmoosex-types-perl (>= 0.10), libdatetime-format-duration-perl (>= 1.03), libmoose-perl (>= 0.79), libtest-simple-perl (>= 0.88-1), libclass-c3-perl, libaliased-perl Maintainer: Tomas Doran Standards-Version: 3.7.2 Homepage: http://search.cpan.org/dist/MooseX-Types-ISO8601/ Package: libmoosex-types-iso8601-perl Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, libdatetime-perl (>= 0.41), libnamespace-autoclean-perl (>= 0.05), libmoosex-types-datetime-perl (>= 0.03), libmoosex-types-perl (>= 0.10), libdatetime-format-duration-perl (>= 1.03), libmoose-perl (>= 0.79), libclass-c3-perl, libaliased-perl Description: ISO8601 date and duration string type constraints and coercions for Moose This module packages several TypeConstraints|Moose::Util::TypeConstraints with coercions for working with ISO8601 date strings and the DateTime suite of objects. . This description was automagically extracted from the module by dh-make-perl. MooseX-Types-ISO8601-0.14/debian/copyright000644 000767 000024 00000002055 12111737222 020352 0ustar00etherstaff000000 000000 This is the debian package for the MooseX-Types-ISO8601 module. It was created by Tomas Doran using dh-make-perl. It was downloaded from http://search.cpan.org/dist/MooseX-Types-ISO8601/ This copyright info was automatically extracted from the perl module. It may not be accurate, so you better check the module sources if don't want to get into legal troubles. The upstream author is: Tomas Doran (t0m) C<< >>. Copyright (c) 2009 Tomas Doran. Some rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Perl is distributed under your choice of the GNU General Public License or the Artistic License. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL' and the Artistic Licence in `/usr/share/common-licenses/Artistic'. The Debian packaging is (C) 2009, Tomas Doran and is licensed under the same terms as the software itself (see above). MooseX-Types-ISO8601-0.14/debian/rules000755 000767 000024 00000003565 12111737222 017506 0ustar00etherstaff000000 000000 #!/usr/bin/make -f # This debian/rules file is provided as a template for normal perl # packages. It was created by Marc Brockschmidt for # the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may # be used freely wherever it is useful. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # If set to a true value then MakeMaker's prompt function will # always return the default without waiting for user input. export PERL_MM_USE_DEFAULT=1 PACKAGE=$(shell dh_listpackages) ifndef PERL PERL = /usr/bin/perl endif TMP =$(CURDIR)/debian/$(PACKAGE) build: build-stamp build-stamp: dh_testdir # As this is a architecture independent package, we are not # supposed to install stuff to /usr/lib. MakeMaker creates # the dirs, we prevent this by setting the INSTALLVENDORARCH # and VENDORARCHEXP environment variables. # Add commands to compile the package here $(PERL) Makefile.PL INSTALLDIRS=vendor \ INSTALLVENDORARCH=/usr/share/perl5/ \ VENDORARCHEXP=/usr/share/perl5/ $(MAKE) $(MAKE) test touch $@ clean: dh_testdir dh_testroot dh_clean build-stamp install-stamp # Add commands to clean up after the build process here [ ! -f Makefile ] || $(MAKE) realclean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k # Add commands to install the package into debian/$PACKAGE_NAME here $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr touch $@ binary-arch: # We have nothing to do here for an architecture-independent package binary-indep: build install dh_testdir dh_testroot dh_installexamples dh_installdocs dh_installchangelogs Changes dh_perl dh_compress dh_fixperms dh_installdeb dh_gencontrol dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary