Markde...Methods(3pm)

πŸ“¦
version 0.40 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– Markdent::Role::EventsAsMethods β€” the Markde...Methods(3pm) era πŸ’–

okay bestie, so this is a Perl manual page, 3pm section, and it's about a role called Markdent::Role::EventsAsMethods. it turns events into method calls. that's the whole vibe. ✨


🌸 NAME 🌸

Markdent::Role::EventsAsMethods β€” Turns events into method calls πŸŽ€


🌈 VERSION 🌈

version 0.40 β€” yes she's got a version number, we love a numbered queen πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea πŸ“: this role takes an object that does the Markdent::Role::Event role and turns it into a method call. that's it. that's the job. it's giving "glow up via indirection" and honestly? iconic. πŸ‘‘


✨ METHODS ✨

this role provides the following methods, and there's literally one of them, so pay attention:

πŸ’œ $object->handle_event($event)

given an object which does the Markdent::Role::Event role, this method makes a method call on $object based on the event's name. simple. elegant. slay. πŸ’…

the method name is the same as the value of $event->event_name. and the hash reference returned by $event->attributes gets turned into a set of named parameters for that method. cute, right? 🫢

BUT β€” and this is the part where you gotta lock in πŸ”₯ β€” any keys starting with ! in the attributes will not be passed to the method. they get left at the door. no invite. blocked. πŸ™ˆ

so for example, a Markdent::Event::StartLink event turns into a method call like this:

$handler->start_link(
    uri            => $event->uri,
    title          => $title,                     # optional
    id             => $id,                        # optional
    is_implicit_id => $event->is_implicit_id,
);

see how uri and is_implicit_id are just chillin' there, and title and id are marked # optional? yeah. that's the move. 🌟


🧚 ROLES 🧚

this role does the Markdent::Role::Handler role. yes, roles doing roles. it's a whole ecosystem, iykyk. πŸ’«


πŸ’€ BUGS πŸ’€

see Markdent for bug reporting details. (the main character holds the receipts.)

bugs may be submitted at <https://github.com/houseabsolute/Markdent/issues>.

also, and this is lowkey adorable β€” "I am also usually active on IRC as 'autarch' on irc://irc.perl.org." so if you need them, they're around. no cap. 🫢


⭐ SOURCE ⭐

the source code repository for Markdent can be found at <https://github.com/houseabsolute/Markdent>. go forth and peruse, bestie. πŸ”βœ¨


πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky <autarch@urth.org> β€” the legend themselves. ate. πŸ’–


this software is copyright (c) 2021 by Dave Rolsky.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. periodt. πŸ’…

the full text of the license can be found in the LICENSE file included with this distribution. it's right there, in the repo, waiting for you. 🌸


and that's the whole page, bestie!! πŸ¦‹ this was perl v5.32.1, dated 2021-08-31, and it's the Markde...Methods(3pm) page β€” short, sweet, and absolutely serving. mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from