Time::Duration::Object - Time::Duration, but an object
version 0.200
$Id: /my/cs/projects/Time-Duration-Object/trunk/lib/Time/Duration/Object.pm 31509 2007-05-04T23:11:57.907942Z rjbs $
use Time::Duration::Object; my $duration = Time::Duration::Object->new($end_time - $start_time);
This module provides an object-oriented interface to Time::Duration. Sure, it's overkill, and Time::Duration is plenty useful without OO, but this interface makes it easy to use Time::Duration with Class::DBI, and that's a good thing.
new($seconds)
This returns a new Time::Duration::Object for the given number of seconds.
seconds
This returns the number of seconds in the duration (i.e., the argument you passed to your call to new.)
new
duration
duration_exact
ago
ago_exact
from_now
from_now_exact
later
later_exact
earlier
earlier_exact
These methods all perform the function of the same name from Time::Duration.
concise
This method can be called on the result of the above methods, trimming down the ouput. For example:
my $duration = Time::Duration::Object->new(8000); print $duration->ago; # 2 hours and 13 minutes ago print $duration->ago->concise # 2hr13m ago
Obviously, this module would be useless without Sean Burke's super-useful Time::Duration. There are those, I'm sure, who will think that even with that module...
Ricardo Signes, <rjbs@cpan.org>
<rjbs@cpan.org>
Please report any bugs or feature requests to bug-time-duration-object@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-time-duration-object@rt.cpan.org
Copyright 2004-2006 Ricardo Signes, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Time::Duration::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Duration::Object
CPAN shell
perl -MCPAN -e shell install Time::Duration::Object
For more information on module installation, please visit the detailed CPAN module installation guide.