perl: move CPAN loader wrappers to another namespace

Move the Git::Error and Git::Mail::Address wrappers to the Git::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error. That module will then either load Error from CPAN (if installed on the OS), or use Git::FromCPAN::Error. When I added the Error wrapper in 20d2a30f8f ("Makefile: replace perl/Makefile.PL with simple make rules", 2017-12-10) I didn't think about how confusing it would be to have these modules sitting in the same tree as our normal modules. Let's put these all into Git::{Load,From}CPAN::* to clearly distinguish them from the rest. This also makes things a bit less confusing since there was already a Git::Error namespace ever since 8b9150e3e3 ("Git.pm: Handle failed commands' output", 2006-06-24). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Mar 3, 2018 at 15:38 UTC 28654678cff4c7b78f87a6768a896d76a1784d45
5 files changed +10 -10
contrib/examples/git-difftool.perl
+1 -1
@@ -13,7 +13,7 @@
13 use 5.008;
14 use strict;
15 use warnings;
16 -use Git::Error qw(:try);
16 +use Git::LoadCPAN::Error qw(:try);
17 use File::Basename qw(dirname);
18 use File::Copy;
19 use File::Find;
git-send-email.perl
+2 -2
@@ -26,13 +26,13 @@ use Text::ParseWords;
26 use Term::ANSIColor;
27 use File::Temp qw/ tempdir tempfile /;
28 use File::Spec::Functions qw(catdir catfile);
29 -use Git::Error qw(:try);
29 +use Git::LoadCPAN::Error qw(:try);
30 use Cwd qw(abs_path cwd);
31 use Git;
32 use Git::I18N;
33 -use Git::Mail::Address;
33 use Net::Domain ();
34 use Net::SMTP ();
35 +use Git::LoadCPAN::Mail::Address;
36
37 Getopt::Long::Configure qw/ pass_through /;
38
perl/Git.pm
+1 -1
@@ -104,7 +104,7 @@ increase notwithstanding).
104
105
106 use Carp qw(carp croak); # but croak is bad - throw instead
107 -use Git::Error qw(:try);
107 +use Git::LoadCPAN::Error qw(:try);
108 use Cwd qw(abs_path cwd);
109 use IPC::Open2 qw(open2);
110 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/LoadCPAN/Error.pm renamed
+4 -4
@@ -1,11 +1,11 @@
1 -package Git::Error;
1 +package Git::LoadCPAN::Error;
2 use 5.008;
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 -Git::Error - Wrapper for the L<Error> module, in case it's not installed
8 +Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed
9
10 =head1 DESCRIPTION
11
@@ -26,13 +26,13 @@ sub import {
26 } or do {
27 my $error = $@ || "Zombie Error";
28
29 - my $Git_Error_pm_path = $INC{"Git/Error.pm"} || die "BUG: Should have our own path from %INC!";
29 + my $Git_Error_pm_path = $INC{"Git/LoadCPAN/Error.pm"} || die "BUG: Should have our own path from %INC!";
30
31 require File::Basename;
32 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'!";
33
34 require File::Spec;
35 - my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');
35 + my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');
36 die "BUG: '$Git_pm_FromCPAN_root' should be a directory!" unless -d $Git_pm_FromCPAN_root;
37
38 local @INC = ($Git_pm_FromCPAN_root, @INC);
perl/Git/LoadCPAN/Mail/Address.pm renamed
+2 -2
@@ -1,11 +1,11 @@
1 -package Git::Mail::Address;
1 +package Git::LoadCPAN::Mail::Address;
2 use 5.008;
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 -Git::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed
8 +Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed
9
10 =head1 DESCRIPTION
11