Make it possible to write subclasses of Git.pm
Signed-off-by: Christian Jaeger <christian@jaeger.mine.nu>
---
I don't really know what the reason for the _maybe_self behaviour
was; I'm hoping this fix doesn't break anything, I haven't run any
tests with it except with my own code; the fix works on the
assumptions that if an object does indeed have Git.pm in it's
ancestry, _maybe_self should work just as if the object is a 'Git'
object without inheritance.
I'm currently using the following hack to make my scripts be able to
inherit from a non-patched Git.pm: I inherit instead from a wrapper
around Git.pm which inherits from and patches the latter at runtime
using this code:
if (do {
my @res= Git::_maybe_self ( (bless {}, __PACKAGE__) );
not $res[0]
}) {
#warn "patching Git.pm";#
no warnings;
*Git::_maybe_self= sub {
UNIVERSAL::isa($_[0], 'Git') ? @_ : (undef, @_);
}
} While this currently works, a proper fix would of course be
preferable (like: when in the future will the above hack break?..).
perl/Git.pm | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)