git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 09/13] perl: move CPAN loader wrappers to another namespace

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 25, 2018, 19:46 UTC
Message-ID
<20180225194637.18630-10-avarab@gmail.com>
In-Reply-To
<20180225194637.18630-1-avarab@gmail.com>

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>
---
 contrib/examples/git-difftool.perl      | 2 +-
 git-send-email.perl                     | 4 ++--
 perl/Git.pm                             | 2 +-
 perl/Git/{ => LoadCPAN}/Error.pm        | 8 ++++----
 perl/Git/{ => LoadCPAN}/Mail/Address.pm | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
 rename perl/Git/{ => LoadCPAN}/Error.pm (78%)
 rename perl/Git/{ => LoadCPAN}/Mail/Address.pm (69%)
diff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl
index fb0fd0b84b..b2ea80f9ed 100755
--- a/contrib/examples/git-difftool.perl
+++ b/contrib/examples/git-difftool.perl
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Git::Error qw(:try);
+use Git::LoadCPAN::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
diff --git a/git-send-email.perl b/git-send-email.perl
index d5a4826a1c..1ec22c5ef3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,13 +26,13 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Git::Error qw(:try);
+use Git::LoadCPAN::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
-use Git::Mail::Address;
 use Net::Domain ();
 use Net::SMTP ();
+use Git::LoadCPAN::Mail::Address;
 
 Getopt::Long::Configure qw/ pass_through /;
 
diff --git a/perl/Git.pm b/perl/Git.pm
index 151b0e7144..9f246c7988 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -104,7 +104,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Git::Error qw(:try);
+use Git::LoadCPAN::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
diff --git a/perl/Git/Error.pm b/perl/Git/LoadCPAN/Error.pm
similarity index 78%
rename from perl/Git/Error.pm
rename to perl/Git/LoadCPAN/Error.pm
index 09bbc97390..3513fe745b 100644
--- a/perl/Git/Error.pm
+++ b/perl/Git/LoadCPAN/Error.pm
@@ -1,11 +1,11 @@
-package Git::Error;
+package Git::LoadCPAN::Error;
 use 5.008;
 use strict;
 use warnings;
 
 =head1 NAME
 
-Git::Error - Wrapper for the L<Error> module, in case it's not installed
+Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed
 
 =head1 DESCRIPTION
 
@@ -26,13 +26,13 @@ sub import {
     } or do {
 	my $error = $@ || "Zombie Error";
 
-	my $Git_Error_pm_path = $INC{"Git/Error.pm"} || die "BUG: Should have our own path from %INC!";
+	my $Git_Error_pm_path = $INC{"Git/LoadCPAN/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');
+	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);
diff --git a/perl/Git/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm
similarity index 69%
rename from perl/Git/Mail/Address.pm
rename to perl/Git/LoadCPAN/Mail/Address.pm
index 2ce3e84670..879c2f5cd1 100644
--- a/perl/Git/Mail/Address.pm
+++ b/perl/Git/LoadCPAN/Mail/Address.pm
@@ -1,11 +1,11 @@
-package Git::Mail::Address;
+package Git::LoadCPAN::Mail::Address;
 use 5.008;
 use strict;
 use warnings;
 
 =head1 NAME
 
-Git::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed
+Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed
 
 =head1 DESCRIPTION
 
-- 
2.15.1.424.g9478a66081
Previous: Eric SunshineNext: Ævar Arnfjörð Bjarmason
Message 46 of 66 in “various perl fixes”
  1. 0/8 various perl fixesÆvar Arnfjörð Bjarmason, Feb 14, 2018
  2. 1/8 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Feb 14, 2018
  3. Jonathan NiederFeb 14, 2018
  4. Ævar Arnfjörð BjarmasonFeb 25, 2018
  5. 2/8 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Feb 14, 2018
  6. Jonathan NiederFeb 14, 2018
  7. 4/8 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Feb 14, 2018
  8. Jonathan NiederFeb 14, 2018
  9. Ævar Arnfjörð BjarmasonFeb 15, 2018
  10. 3/8 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Feb 14, 2018
  11. Jonathan NiederFeb 14, 2018
  12. Todd ZullingerFeb 15, 2018
  13. Ævar Arnfjörð BjarmasonFeb 25, 2018
  14. Randall S. BeckerFeb 25, 2018
  15. Todd ZullingerFeb 15, 2018
  16. Ævar Arnfjörð BjarmasonFeb 15, 2018
  17. Todd ZullingerFeb 15, 2018
  18. Ævar Arnfjörð BjarmasonFeb 16, 2018
  19. Todd ZullingerFeb 16, 2018
  20. Jonathan NiederFeb 16, 2018
  21. Todd ZullingerFeb 17, 2018
  22. Todd ZullingerFeb 17, 2018
  23. 6/8 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Feb 14, 2018
  24. Jonathan NiederFeb 14, 2018
  25. Ævar Arnfjörð BjarmasonFeb 15, 2018
  26. 7/8 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Feb 14, 2018
  27. Jonathan NiederFeb 14, 2018
  28. 5/8 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Feb 14, 2018
  29. Jonathan NiederFeb 14, 2018
  30. Matthieu MoyFeb 15, 2018
  31. Ævar Arnfjörð BjarmasonFeb 15, 2018
  32. 8/8 perl: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Feb 14, 2018
  33. Jonathan NiederFeb 14, 2018
  34. Ævar Arnfjörð BjarmasonFeb 15, 2018
  35. Junio C HamanoFeb 15, 2018
  36. 00/13 various perl fixesÆvar Arnfjörð Bjarmason, Feb 25, 2018
  37. 01/13 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Feb 25, 2018
  38. 02/13 Git.pm: remove redundant "use strict" from sub-packageÆvar Arnfjörð Bjarmason, Feb 25, 2018
  39. 03/13 Git.pm: add the "use warnings" pragmaÆvar Arnfjörð Bjarmason, Feb 25, 2018
  40. 04/13 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Feb 25, 2018
  41. Eric SunshineFeb 25, 2018
  42. 05/13 Git.pm: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Feb 25, 2018
  43. 07/13 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Feb 25, 2018
  44. 06/13 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Feb 25, 2018
  45. Eric SunshineFeb 25, 2018
  46. 09/13 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Feb 25, 2018
  47. 08/13 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Feb 25, 2018
  48. 10/13 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Feb 25, 2018
  49. 11/13 perl: move the perl/Git/FromCPAN tree to perl/FromCPANÆvar Arnfjörð Bjarmason, Feb 25, 2018
  50. 13/13 perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKSÆvar Arnfjörð Bjarmason, Feb 25, 2018
  51. 12/13 Makefile: add NO_PERL_CPAN_FALLBACKS knobÆvar Arnfjörð Bjarmason, Feb 25, 2018
  52. 00/13 various perl fixesÆvar Arnfjörð Bjarmason, Mar 3, 2018
  53. 01/13 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Mar 3, 2018
  54. 02/13 Git.pm: remove redundant "use strict" from sub-packageÆvar Arnfjörð Bjarmason, Mar 3, 2018
  55. 04/13 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Mar 3, 2018
  56. 05/13 Git.pm: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Mar 3, 2018
  57. 03/13 Git.pm: add the "use warnings" pragmaÆvar Arnfjörð Bjarmason, Mar 3, 2018
  58. 06/13 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Mar 3, 2018
  59. 10/13 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Mar 3, 2018
  60. 11/13 perl: move the perl/Git/FromCPAN tree to perl/FromCPANÆvar Arnfjörð Bjarmason, Mar 3, 2018
  61. 12/13 Makefile: add NO_PERL_CPAN_FALLBACKS knobÆvar Arnfjörð Bjarmason, Mar 3, 2018
  62. 13/13 perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKSÆvar Arnfjörð Bjarmason, Mar 3, 2018
  63. 08/13 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Mar 3, 2018
  64. 09/13 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Mar 3, 2018
  65. 07/13 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Mar 3, 2018
  66. Junio C HamanoMar 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.