18 Oct 2013 16:07:03 UTC
- Distribution: Time-Duration-Object
- Module version: 0.301
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (436 / 0 / 0)
- KwaliteeBus factor: 1
- 87.22% Coverage
- License: perl_5
- Activity24 month
- Download (14.18KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionRJBS Ricardo SIGNES 😄
- SEE ALSO
- COPYRIGHT AND LICENSE
Time::Duration::Object - Time::Duration, but an object
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.
This returns a new Time::Duration::Object for the given number of seconds.
This returns the number of seconds in the duration (i.e., the argument you passed to your call to
These methods all perform the function of the same name from Time::Duration.
Time::Duration::Object methods don't return strings, they return an object that stringifies. If you can't deal with that and don't want to stringify by concatenating an empty string, you can call
my $duration = Time::Duration::Object->new(8000); print $duration->ago->as_string; # 2 hours and 13 minutes ago
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 <firstname.lastname@example.org>
This software is copyright (c) 2004 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Time::Duration::Object, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Time::Duration::Object
For more information on module installation, please visit the detailed CPAN module installation guide.