NAME

autobox::DateTime::Duration - ActiveSupport equivalent to Perl numeric variables

SYNOPSIS

use autobox;
use autobox::DateTime::Duration;

# 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

autobox::DateTime::Duration is an autobox module to add Time-related methods to core integer values by using constant overloading. Inspired by ActiveSupport (Rails) Core extensions to Numeric values.

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

DateTime::Duration, bigint, overload