diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-02-13 13:39:03 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-02-13 13:39:03 -0800 |
| commit | ed1b87ef910fe38dfb9cf044f5c946adfab0c5e3 (patch) | |
| tree | da7ff67fe9f1e6897d9ec701aaadc2eb99a57f61 /perl/Git/Error.pm | |
| parent | 5be1f00a9a701532232f57958efab4be8c959a29 (diff) | |
| parent | 7a7bfc7adceec0be66aec3a4999be2f9b33ccc24 (diff) | |
| download | git-ed1b87ef910fe38dfb9cf044f5c946adfab0c5e3.tar.gz | |
Merge branch 'ab/simplify-perl-makefile'
The build procedure for perl/ part has been greatly simplified by
weaning ourselves off of MakeMaker.
* ab/simplify-perl-makefile:
perl: treat PERLLIB_EXTRA as an extra path again
perl: avoid *.pmc and fix Error.pm further
Makefile: replace perl/Makefile.PL with simple make rules
Diffstat (limited to 'perl/Git/Error.pm')
| -rw-r--r-- | perl/Git/Error.pm | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/perl/Git/Error.pm b/perl/Git/Error.pm new file mode 100644 index 0000000000..09bbc97390 --- /dev/null +++ b/perl/Git/Error.pm @@ -0,0 +1,46 @@ +package Git::Error; +use 5.008; +use strict; +use warnings; + +=head1 NAME + +Git::Error - Wrapper for the L<Error> module, in case it's not installed + +=head1 DESCRIPTION + +Wraps the import function for the L<Error> module. + +This module is only intended to be used for code shipping in the +C<git.git> repository. Use it for anything else at your peril! + +=cut + +sub import { + shift; + my $caller = caller; + + eval { + require Error; + 1; + } or do { + my $error = $@ || "Zombie Error"; + + my $Git_Error_pm_path = $INC{"Git/Error.pm"} || die "BUG: Should have our own path from %INC!"; + + require File::Basename; + my $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die "BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!"; + + require File::Spec; + my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN'); + die "BUG: '$Git_pm_FromCPAN_root' should be a directory!" unless -d $Git_pm_FromCPAN_root; + + local @INC = ($Git_pm_FromCPAN_root, @INC); + require Error; + }; + + unshift @_, $caller; + goto &Error::import; +} + +1; |
