NAME
Acme::DateTime::Duration::Numeric - ActiveSupport equivalent to Perl numeric variables
SYNOPSIS
use Acme::DateTime::Duration::Numeric;
# equivalent to DateTime::Duration->new(months => 1, days => 5);
$duration = 1->month + 2->days;
# equivalent to DateTime->now->add(years => 2);
$datetime = 2->years->from_now;
# equivalent to DateTime->now->add(months => 4, years => 5);
$datetime = (4->months + 5->years)->from_now;
# equivalent to DateTime->now->subtract(days => 3);
$datetime = 3->days->ago;
DESCRIPTION
Acme::DateTime::Duration::Numeric is a module to add Time-related methods to core integer values by using constant overloading. Inspired by ActiveSupport (Rails) Core extensions to Numeric values.
BUGS
Using this module will turn off all Params::Validate validation since I couldn't figure out how to make the object bypass its checks against scalar data type in DateTime method calls.
Because it uses constant overloading, I'm not surprised there may be other modules breaking when this module is in use.
AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Numeric/Time.html