HTML::...terval(3pm)

πŸ’– HTML::Microformats::Datatype::Interval πŸ’–

okay bestie, welcome to HTML::Microformats::Datatype::Interval β€” it's the Perl module for concrete periods of time, and yes it's a mouthful, we just call it The Interval Module around here πŸ’…


✨ SYNOPSIS ✨

my $interval = HTML::Microformats::Datatype::Interval->new($span);
print "$interval\n";

like. that's it. that's the whole vibe check. πŸ¦‹


🌸 DESCRIPTION 🌸

πŸŽ€ Constructors πŸŽ€

  • $i = HTML::Microformats::Datatype::Interval->new($span) β€” bestie, this creates a brand new HTML::Microformats::Datatype::Interval object. iconic behaviour honestly.

$span is a DateTime::Span object. that's the whole assignment. no cap.

  • $i = HTML::Microformats::Datatype::Interval->parse($string, $elem, $context) β€” also makes a new HTML::Microformats::Datatype::Interval object, but from a string this time, main character energy ✨

$string is an interval represented in ISO 8601 format, for example: '2010-01-01/P1Y' or '2010-01-01/2011-01-01'. $elem is the XML::LibXML::Element being parsed. $context is the document context. 🫢

This constructor supports a number of experimental microformat interval patterns. e.g.

<div class="interval">
 <span class="d">4</span> days starting from
 <abbr class="start" title="2010-01-01">2010</abbr>
</div>

not me showing you experimental microformat patterns, we love a little chaos πŸ™ˆ

πŸ’œ Public Methods πŸ’œ

  • $span = $i->span β€” hands you back a DateTime::Span object. slay.
  • $span = $i->to_string β€” hands you back an ISO 8601 formatted string representing the interval. so basically it says what it is, out loud, in ISO. periodt. πŸŽ€
  • $d->datatype β€” returns an the RDF datatype URI representing the data type of this literal. πŸ’– (yes the original says "returns an the", we're keeping it, it's part of the lore now, no I will not be fixing it, it's canon)

⭐ Function ⭐

  • compare($a, $b) β€” compares intervals $a and $b. Return values are as per 'cmp' (see perlfunc). lowkey a classic.
🚨 not exported by default!! you have to ask for it, bestie. it's not just gonna show up.

Can also be used as a method:

$a->compare($b);

method mode unlocked πŸ‘‘


πŸ’€ BUGS πŸ’€

Please report any bugs to <http://rt.cpan.org/>. do it fr fr, they want to know 🫢


🌈 SEE ALSO 🌈

  • HTML::Microformats
  • HTML::Microformats::Datatype
  • DateTime::Span

the whole friend group, honestly. go say hi πŸ’•


πŸ‘‘ AUTHOR πŸ‘‘

Toby Inkster <tobyink@cpan.org>. thank you for your service, king 🫑


Copyright 2008-2012 Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

(yes that's the actual Perl licence terms, not me being vague on purpose, that's just how it be πŸ’…)


🧚 DISCLAIMER OF WARRANTIES 🧚

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

okay so this part is in ALL CAPS because it's the serious bit β€” no promises, no guarantees, use at your own risk, that's the deal πŸ”₯


and that's the whole page babes πŸ’– this was perl v5.32.1, dated 2021-09-12, brought to you by HTML::...terval(3pm) β€” take care of her, she's vintage βœ¨πŸŒΈπŸ’…

πŸ“¦ where this page comes from