1package Git::Error; 2use5.008; 3use strict; 4use warnings; 5 6=head1 NAME 7 8Git::Error - Wrapper for the L<Error> module, in case it's not installed 9 10=head1 DESCRIPTION 11 12Wraps the import function for the L<Error> module. 13 14This module is only intended to be used for code shipping in the 15C<git.git> repository. Use it for anything else at your peril! 16 17=cut 18 19sub import { 20shift; 21my$caller=caller; 22 23eval{ 24require Error; 251; 26}ordo{ 27my$error=$@||"Zombie Error"; 28 29my$Git_Error_pm_path=$INC{"Git/Error.pm"} ||die"BUG: Should have our own path from%INC!"; 30 31require File::Basename; 32my$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'!"; 33 34require File::Spec; 35my$Git_pm_FromCPAN_root= File::Spec->catdir($Git_Error_pm_root,'FromCPAN'); 36die"BUG: '$Git_pm_FromCPAN_root' should be a directory!"unless-d $Git_pm_FromCPAN_root; 37 38local@INC= ($Git_pm_FromCPAN_root,@INC); 39require Error; 40}; 41 42unshift@_,$caller; 43goto&Error::import; 44} 45 461;