Git::R...:Plugin(3pm)

πŸ’… Git::Repository::Plugin β€” the base class era ✨

okay so real talk, this is a page from the User Contributed Perl Documentation for Git::Repository::Plugin β€” the nepo-baby base class that every Git::Repository plugin inherits from πŸŽ€


🌸 NAME 🌸

Git::Repository::Plugin β€” literally the base class for Git::Repository plugins, no cap πŸ‘‘


⭐ SYNOPSIS ⭐

bestie here's the whole vibe in one file, copy it, love it:

package Git::Repository::Plugin::Hello;

use Git::Repository::Plugin;
our @ISA = qw( Git::Repository::Plugin );

sub _keywords { return qw( hello hello_gitdir ) }

sub hello        { return "Hello, git world!\n"; }
sub hello_gitdir { return "Hello, " . $_[0]->git_dir . "!\n"; }

1;

that's it, that's the plugin πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so Git::Repository::Plugin lets you define brand-new methods for Git::Repository, and those methods get imported straight into the Git::Repository namespace. it's giving "main character energy" but shared, fr fr πŸ’«

the SYNOPSIS up there is a whole complete example β€” no crumbs left behind, it literally shows you everything πŸ‘‘

and if you wanna know how to actually load these plugins β€” all the methods they provide, or just a hand-picked selection of them β€” that's all documented over in the Git::Repository docs. go check your girl 🫢


✨ METHODS ✨

Git::Repository::Plugin gives you exactly one method. one. singular. iconic minimalism πŸ’…

🌈 install

$plugin->install( @keywords );

installs all the keywords you pass in, into the Git::Repository namespace ✨

and here's the cute part: if you call it with an empty list, it just installs all available keywords. surprise! you get everything 🎁


🧚 SUBCLASSING 🧚

πŸ’œ Adding methods to Git::Repository

when you're out here creating a plugin, those new keywords (aka the methods) that your plugin adds to Git::Repository must be returned by a _keywords() method. that's the rule, that's the assignment, periodt πŸ“

πŸ“ Adding attributes to Git::Repository

Git::Repository is a blessed hash reference, just so you know 🧠

if you need extra attributes, the recommended name for the hash key (this is so plugins don't clash with each other, we're being polite) is:

_plugin_name_attribute

where name is the plugin lowercase name, and attribute is the attribute name. iykyk πŸ’«


πŸ‘‘ AUTHOR πŸ‘‘

Philippe Bruhat (BooK) <book@cpan.org>


πŸŽ€ ACKNOWLEDGEMENTS πŸŽ€

huge shoutout to Todd Rinaldo, who wanted to add more methods to Git::Repository β€” and that's literally what made the author go looking for a solution that would preserve the minimalism of Git::Repository. like, respecting the vibe while adding to it? we love to see it 🫢

then there was a "not-so-good" era design using @ISA (so that Git::Repository would inherit the extra methods… yeah 😭). but further discussions with Aristotle Pagaltzis plus a quick peek at Dancer's plugin management helped come up with the current design. thank you Aristotle and the Dancer team πŸ’–

and further improvements to the plugin system were proposed by Aristotle Pagaltzis. again. legend behaviour ⭐


Copyright 2010-2016 Philippe Bruhat (BooK), all rights reserved.


πŸ’€ LICENSE πŸ’€

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


and that's the whole page, bestie β€” no notes 🌸 this was perl v5.40.1, dated 2026-01-31, from the Git::Repository::Plugin(3pm) page. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from