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 π₯
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
- ubuntu resolute: libgit-repository-perl 1.326-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgit-repository-perl 1.326-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms