Tatsuhiko Miyagawa > autobox-DateTime-Duration > autobox::DateTime::Duration

Download:
autobox-DateTime-Duration-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source  

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

syntax highlighting: