1Git::Repository::PluginU:s:eArUTCOoLnOtArDi(b3u)ted PerlGiDto:c:uRmeepnotsaittioorny::Plugin::AUTOLOAD(3)
2
3
4
6 Git::Repository::Plugin::AUTOLOAD - Git subcommands as Git::Repository
7 methods
8
10 use Git::Repository 'AUTOLOAD';
11
12 my $r = Git::Repository->new();
13
14 $r->add($file);
15 $r->commit( '-m' => 'message' );
16
17 # NOTE: might be overridden by the 'Log' plugin
18 my $log = $r->log('-1');
19
20 # use "_" for "-" in command names
21 my $sha1 = $r->rev_parse('master');
22
23 # can be used as a class method
24 Git::Repository->clone( $url );
25
27 This module adds an "AUTOLOAD" method to Git::Repository, enabling it
28 to automagically call git commands as methods on Git::Repository
29 objects.
30
32 AUTOLOAD
33 Any method call caught by "AUTOLOAD" will simply turn all "_"
34 (underscore) into "-" (dash), and call "run()" on the invocant, with
35 the transformed method name as the first parameter.
36
37 For example:
38
39 my $sha1 = $r->rev_parse('master');
40
41 does exactly the same thing as:
42
43 my $sha1 = $r->run( 'rev-parse', 'master' );
44
45 All parameters to the original method call are kept, so these
46 autoloaded methods can take option hashes.
47
48 Note that "AUTOLOAD" does not install methods in the invocant class
49 (but what's the cost of a Perl subroutine call compared to forking a
50 git subprocess?), so that plugins adding new methods always take
51 precedence.
52
54 Git::Repository, Git::Repository::Plugin.
55
57 Philippe Bruhat (BooK) <book@cpan.org>.
58
60 Copyright 2014-2016 Philippe Bruhat (BooK), all rights reserved.
61
63 This program is free software; you can redistribute it and/or modify it
64 under the same terms as Perl itself.
65
66
67
68perl v5.28.0 2016-04-0G6it::Repository::Plugin::AUTOLOAD(3)