Git::Re...AUTOLOAD(3)

πŸ“¦
version 1.003 Β· 2 versions
, in fedora 43

✨ Git::Repository::Plugin::AUTOLOAD ✨

okay bestie so this is a page from the User Contributed Perl Documentation, and it's all about Git::Repository::Plugin::AUTOLOAD πŸ’– β€” literally the module that lets you call git subcommands like they're just... methods. no cap.


🌸 NAME 🌸

Git::Repository::Plugin::AUTOLOAD β€” Git subcommands as Git::Repository methods πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

use Git::Repository 'AUTOLOAD';

my $r = Git::Repository->new();

$r->add($file);
$r->commit( '-m' => 'message' );

# NOTE: might be overridden by the 'Log' plugin
my $log = $r->log('-1');

# use "_" for "-" in command names
my $sha1 = $r->rev_parse('master');

# can be used as a class method
Git::Repository->clone( $url );

πŸ’… DESCRIPTION πŸ’…

so basically this module adds an AUTOLOAD method to Git::Repository, and that one little method makes it possible to automagically call git commands as methods on Git::Repository objects. it's giving wizardry, honestly πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

⭐ AUTOLOAD ⭐

any method call that gets caught by AUTOLOAD will simply turn all _ (underscore) into - (dash), and then call run() on the invocant, with that transformed method name as the first parameter. slay πŸ’…

for example, this:

my $sha1 = $r->rev_parse('master');

does exactly the same thing as this:

my $sha1 = $r->run( 'rev-parse', 'master' );

all parameters from the original method call are kept, so these autoloaded methods can take option hashes. periodt.

heads up bestie: AUTOLOAD does not install methods in the invocant class (but like... what's the cost of a Perl subroutine call compared to forking a git subprocess?), so plugins that add new methods always take precedence. πŸ‘‘

🌈 SEE ALSO 🌈

  • Git::Repository
  • Git::Repository::Plugin

🫢 AUTHOR 🫢

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


Copyright 2014-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.


okay that's the whole page, you ate that πŸŽ€ and for the lil sign-off moment: this one came from perl v5.42.0, dated 2025-07-25, and yes the page title is Git::Re...AUTOLOAD(3) πŸ’– byeee πŸ¦‹

πŸ“¦ where this page comes from