DateTim...::Quick(3)

πŸ’… DateTime::Format::Builder::Parser::Quick

okay so bestie, welcome to the DateTime::Format::Builder::Parser::Quick page (that's the whole manual name, yes it's a mouthful, iykyk) β€” it's part of the User Contributed Perl Documentation and honestly it's giving "tiny module, big shortcut energy" ✨

πŸŽ€ NAME πŸŽ€

DateTime::Format::Builder::Parser::Quick β€” Use another formatter, simply. literally that's it, that's the whole pitch πŸ’–

⭐ VERSION ⭐

version 0.83 β€” iconic, slay, numbers we stan πŸ‘‘

πŸ¦‹ SYNOPSIS πŸ¦‹

okay so picture this: instead of writing a million little subs, you write THIS:

    use DateTime::Format::Builder (
        parsers => {
            parse_datetime => [
                { Quick => 'DateTime::Format::HTTP' },
                { Quick => 'DateTime::Format::Mail' },
                { Quick => 'DateTime::Format::IBeat' },
            ]
        }
    );

and it is the same as this whole entire thing:

    use DateTime::Format::HTTP;
    use DateTime::Format::Mail;
    use DateTime::Format::IBeat;

    use DateTime::Format::Builder (
        parsers => {
            parse_datetime => [
                sub {
                    eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) }
                },
                sub {
                    eval { DateTime::Format::Mail->parse_datetime( $_[1] ) }
                },
                sub {
                    eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) }
                },
            ]
        }
    );

like, not me saving you so many lines 😭 both of these pieces of code live in the test suite β€” one as quick.t, the other as fall.t. cute, right? 🌸

πŸ’œ DESCRIPTION πŸ’œ

"Quick" adds a parser that lets you take shortcuts when you're writing fairly standard and mundane calls to other formatting modules. mundane but make it ✨effortless✨ β€” that's the vibe check.

🌈 SPECIFICATION 🌈

"Quick" has two keys. one of them is optional. bestie math πŸ’…

  • "Quick" β€” this keyword should have an argument of either an object or a class name. if it's a class name, then the class gets "use"d. automatic. no cap.
  • "method" β€” this keyword is optional, with a default of parse_datetime. it's either the name of the method to invoke on the object, or a reference to a piece of code. (a code ref, the main character of passing behaviour around 🫢)

in any case, the resultant code ends up looking like:

    my $rv = $Quick->$method($date);

that's it. that's the whole output. so clean, so demure 🌸


πŸ”₯ SEE ALSO πŸ”₯

  • the "datetime@perl.org" mailing list β€” go say hi πŸ‘‹
  • http://datetime.perl.org/
  • perl, DateTime, DateTime::Format::Builder

🫢 SUPPORT 🫢

bugs may be submitted at <https://github.com/houseabsolute/DateTime-Format-Builder/issues>. please do, they're not scary, they're just little guys πŸ™ˆ

also: I am usually active on IRC as 'autarch' on "irc://irc.perl.org" β€” come find me, I'm there fr fr.

🧚 SOURCE 🧚

the source code repository for DateTime-Format-Builder can be found at <https://github.com/houseabsolute/DateTime-Format-Builder>. go look, it's giving open source excellence πŸ‘‘

πŸ‘‘ AUTHORS πŸ‘‘

  • Dave Rolsky <autarch@urth.org>
  • Iain Truskett <spoon@cpan.org>

absolute legends, both of them πŸ’–

This software is Copyright (c) 2020 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

the full text of the license can be found in the LICENSE file included with this distribution. read it, it's good for you, but like, also it's legally required so πŸ’€


lowkey reminder bestie: everything above is facts, not vibes β€” the flags, defaults, names and links are all exactly as written. okay love u bye πŸ’•

perl v5.40.0 Β· 2023-01-15 Β· that's the footer, and that's the whole page β€” mwah, go write some parsers πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from