NAME
Test::Recent - check a time is recent
SYNOPSIS
use Test::More;
use Test::Recent qw(recent);
# check things happened in the last ten seconds
recent DateTime->now, "now is recent!";
recent "2012-12-23 00:00:00", "end of mayan calendar happened recently?";
recent "5 seconds ago", "5 seconds ago is obviously recently";
# check things happened in the last hour
recent "2012-12-23 00:00:00", DateTime::Duration->new( hours => 1 ), "mayan";
recent "2012-12-23 00:00:00", "1 hour", "mayan"
DESCRIPTION
Simple module to check things happened recently. Uses DateTime::Format::ISO8601 and Time::Duration::Parse to parse the times and durations (older versions of this module used DateTimeX::Easy because that module didn't handle iso timezones very well.)
Functions
These are exported on demand or may be called fully qualified
- recent $time
- recent $time, $test_description
- recent $time, $duration, $test_description
-
Tests (using the Test::Builder framework) if the time occured within the duration ago from the current time. If no duration is passed, ten seconds is assumed.
- occured_within_ago $time, $duration
-
Returns true if and only if the time occured within the duration ago from the current time.
AUTHOR
Written by Mark Fowler <mark@twoshortplanks.com>
COPYRIGHT
Copyright OmniTI 2012. All Rights Rerserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
BUGS
Bugs should be reported via this distribution's CPAN RT queue. This can be found at https://rt.cpan.org/Dist/Display.html?Test-Recent
You can also address issues by forking this distribution on github and sending pull requests. It can be found at http://github.com/2shortplanks/Test-Recent