MongoDBx::Class::ParsedAttribute::DateTime - An automatic DateTime parser for MongoDBx::Class document classes
version 1.030002
# in one of your document classes has 'datetime' => (is => 'ro', isa => 'DateTime', traits => ['Parsed'], required => 1);
This class implements the MongoDBx::Class::ParsedAttribute role. It provides document classes with the ability to automatically expand and collapse DateTime values.
While the Perl MongoDB driver already supports DateTime objects natively, due to a bug with MongoDB, you can't save dates earlier than the UNIX epoch. This module overcomes this limitation by simply saving dates as strings and automatically turning them into DateTime objects (and vica-versa). The DateTime strings are formatted by the DateTime::Format::W3CDTF module, which parses dates in the format recommended by the W3C. This is good for web apps, and also makes it easier to edit dates from the MongoDB shell. But most importantly, it also allows sorting by date.
Note that if you already have date attributes in your database, you can't just start using this parser, you will first have to convert them to the W3C format.
A DateTime::Format::W3CDTF object used for expanding/collapsing. Automatically created.
Creates a new instance of this module.
Converts a W3C datetime string to DateTime object.
Converts a DateTime object to a W3C datetime string.
Ido Perlmuter, <ido at ido50.net>
<ido at ido50.net>
Please report any bugs or feature requests to bug-mongodbx-class at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MongoDBx-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-mongodbx-class at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc MongoDBx::Class::ParsedAttribute::DateTime
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MongoDBx::Class
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/MongoDBx::Class
CPAN Ratings
http://cpanratings.perl.org/d/MongoDBx::Class
Search CPAN
http://search.cpan.org/dist/MongoDBx::Class/
MongoDBx::Class::EmbeddedDocument.
Copyright 2010-2014 Ido Perlmuter.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MongoDBx::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MongoDBx::Class
CPAN shell
perl -MCPAN -e shell install MongoDBx::Class
For more information on module installation, please visit the detailed CPAN module installation guide.