Handler::Range(3)
π NAME π
Date::Handler::Range β it's a Time range object, bestie. That's the whole vibe. π°οΈβ¨
πΈ SYNOPSIS πΈ
use Date::Handler::Range;
my $range = new Date::Handler::Range( { date => $date, delta => $delta);
$range->new Constructor
$range->StartDate() Returns a Date::Handler object of the range's start date.
$range->EndDate() Returns a Date::Handler object of the range's end date.
$range->Overlaps($range2) Returns true if $range overlaps $range2
$range->Direction('FORWARDS' || 'BACKWARDS') Sets the direction of the range
$range->Delta() Returns the delta contained by this range.
$range->Date() Returns the date contained by this range.
Like, look at that little menu of methods. Gorgeous. Iconic. We love a tidy API. π
π¦ DESCRIPTION π¦
Okay so picture this: a Range object is literally just a way to name a specific stretch of time sitting between 2 dates. That's it, that's the whole girl.
And ngl, right now this feature is very primitive β the original author said so themselves β but it's gonna evolve in future versions, so stay tuned. π
Here's how you build one, step by step, no cap:
- You start with a base
Date::Handlerobject. That's your anchor point. β - Then you combine it with a
Date::Handler::Delta, which sets how long the range is. π - Then thirdly (yes, thirdly π), you give the range a direction β either
'FORWARDS'or'BACKWARDS'in time.
From those three values, a start date and an end date get calculated. Math ate, fr fr. β¨
Example:
#Creation of the range starting now, ending in 2 days.
my $range = Date::Handler::Range->new({
date => time(),
delta => [0,0,2,0,0],
});
#This is already set to 'FORWARDS' by default.
$range->Direction('FORWARDS');
print "This range start ".$range->StartDate()." and ends ". $range->EndDate()."\n";
#Another range, starting at the end date of range 1, going backwards in time 7 days.
my $range2 = Date::Handler::Range->new({
date => $range->StartDate(),
delta => [0,0,7,0,0],
});
$range2->Direction('BACKWARDS');
#This returns true if range overlaps range2.
$range->Overlaps($range2);
And like, as I was saying earlier β the range functionality is still very primitive, and heads up bestie, the interface might change. π So don't get too attached to it. Refer to Date::Handler::Range(1) for more information.
π BUGS (known) π
Not me having to deliver bad news but here we go:
- Deltas going after 2038 are not handled by this module yet. (POSIX) π
- Deltas before 1902 are not handled by this module. (POSIX) π
If you find bugs with this module, do not hesitate to contact the author. Your comments and rants are welcomed :) β yes, actual rants, they want them, that's the energy. π«Ά
β TODO β
The to-do list, aka the main character's goals:
- Implement overloading on ranges.
- Provide the value of the overlap in
Overlaps().
π COPYRIGHT π
Copyright(c) 2001 Benoit Beausejour <bbeausej@pobox.com>
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
Portions Copyright (c) Philippe M. Chiasson <gozer@cpan.org>
Portions Copyright (c) SzabΓ³, BalΓ‘zs <dlux@kapu.hu>
Portions Copyright (c) Larry Rosler
π AUTHOR π
Benoit Beausejour <bbeausej@pobox.com> β the icon, the legend, the moment. π«Ά
π SEE ALSO π
Go read these too, bestie, they're all connected:
Date::Handler(1)Date::Handler::Delta(1)Class::Date(1)Time::Object(1)Date::Calc(1)perl(1)
okay that's the whole page, and before you go β this little gem is from the User Contributed Perl Documentation collection, shipped as perl v5.42.0, dated 2025-07-25, and you'll find it filed under Handler::Range(3). slay, go build some ranges πβ¨π¦
π¦ where this page comes from
- fedora 43: perl-Date-Handler 1.2-34.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms