{"thread":{"id":"47849","subject":"[PATCH 0/8] various perl fixes","startedAt":"2018-02-14T22:22:12Z","lastAt":"2018-03-05T19:01:44Z","messageCount":66,"participants":["Ævar Arnfjörð Bjarmason","Jonathan Nieder","Todd Zullinger","Matthieu Moy","Junio C Hamano","Randall S. Becker","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"339398","messageId":"20180214222146.10655-1-avarab@gmail.com","threadId":"47849","inReplyTo":null,"subject":"[PATCH 0/8] various perl fixes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:38Z","receivedAt":"2018-02-14T22:22:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"I'd been meaning to submit 3/* once my Makefile.PL removal landed in\nmaster, but noticed a few more things along the way, including the\nissue fixed in 1/* which I just noted in\n<CACBZZX7xC37W5+MLtYSrBaPawh+QfOSqci_rFOp_ukVi4fp6Gg@mail.gmail.com>,\nand while I was at it resolved some of my long-standing TODOs noted in\n<87d13jd4fd.fsf@evledraar.gmail.com>, and more.\n\nIf you're CC'd on this series it's because one of the commit messages\nmentions a commit you authored.\n\n[45]/* do not cleanly pass the default --check, so they have\n.gitattributes files to make them pass, as noted in 4/* it's much\neasier if we can just use this upstream code as-is, and not accumulate\nour own typo/whitespace etc. fixes along the way, which just makes\nsubsequent updates harder.\n\nÆvar Arnfjörð Bjarmason (8):\n  perl: *.pm files should not have the executable bit\n  perl: move CPAN loader wrappers to another namespace\n  perl: generalize the Git::LoadCPAN facility\n  perl: update our ancient copy of Error.pm\n  perl: update our copy of Mail::Address\n  git-send-email: unconditionally use Net::{SMTP,Domain}\n  gitweb: hard-depend on the Digest::MD5 5.8 module\n  perl: hard-depend on the File::{Temp,Spec} modules\n\n contrib/examples/git-difftool.perl    |   2 +-\n git-send-email.perl                   |  28 +--\n gitweb/INSTALL                        |   3 +-\n gitweb/gitweb.perl                    |  17 +-\n perl/Git.pm                           |   7 +-\n perl/Git/Error.pm                     |  46 ----\n perl/Git/FromCPAN/.gitattributes      |   1 +\n perl/Git/FromCPAN/Error.pm            | 296 +++++++++++++++++++----\n perl/Git/FromCPAN/Mail/.gitattributes |   1 +\n perl/Git/FromCPAN/Mail/Address.pm     | 436 +++++++++++++---------------------\n perl/Git/LoadCPAN.pm                  |  74 ++++++\n perl/Git/LoadCPAN/Error.pm            |  10 +\n perl/Git/LoadCPAN/Mail/Address.pm     |  10 +\n perl/Git/Mail/Address.pm              |  24 --\n 14 files changed, 537 insertions(+), 418 deletions(-)\n delete mode 100644 perl/Git/Error.pm\n create mode 100644 perl/Git/FromCPAN/.gitattributes\n create mode 100644 perl/Git/FromCPAN/Mail/.gitattributes\n create mode 100644 perl/Git/LoadCPAN.pm\n create mode 100644 perl/Git/LoadCPAN/Error.pm\n create mode 100644 perl/Git/LoadCPAN/Mail/Address.pm\n delete mode 100755 perl/Git/Mail/Address.pm\n\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339399","messageId":"20180214222146.10655-2-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 1/8] perl: *.pm files should not have the executable bit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:39Z","receivedAt":"2018-02-14T22:22:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\nuse a local copy of Mail::Address\", 2018-01-05) had the executable bit\nset, this should not be the case with *.pm files, it breaks nothing,\nbut is redundant and confusing as none of the other files have it, and\nit's never executed as a stand-alone program.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/Mail/Address.pm | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n mode change 100755 => 100644 perl/Git/Mail/Address.pm\n\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/Mail/Address.pm\nold mode 100755\nnew mode 100644\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339400","messageId":"20180214222146.10655-3-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 2/8] perl: move CPAN loader wrappers to another namespace","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:40Z","receivedAt":"2018-02-14T22:22:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the Git::Error and Git::Mail::Address wrappers to the\nGit::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error, that\nmodule will then either load Error from CPAN (if installed on the OS),\nor use Git::FromCPAN::Error.\n\nWhen I added the Error wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10) I didn't think\nabout how confusing it would be to have these modules sitting in the\nsame tree as our normal modules. Let's put these all into\nGit::{Load,From}CPAN::* to clearly distinguish them from the rest.\n\nThis also makes things a bit less confusing since there was already a\nGit::Error namespace ever since 8b9150e3e3 (\"Git.pm: Handle failed\ncommands' output\", 2006-06-24).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/examples/git-difftool.perl      | 2 +-\n git-send-email.perl                     | 4 ++--\n perl/Git.pm                             | 2 +-\n perl/Git/{ => LoadCPAN}/Error.pm        | 8 ++++----\n perl/Git/{ => LoadCPAN}/Mail/Address.pm | 4 ++--\n 5 files changed, 10 insertions(+), 10 deletions(-)\n rename perl/Git/{ => LoadCPAN}/Error.pm (78%)\n rename perl/Git/{ => LoadCPAN}/Mail/Address.pm (69%)\n\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex fb0fd0b84b..b2ea80f9ed 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex bbf4deaa0d..85bb6482f2 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,11 +26,11 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\n-use Git::Mail::Address;\n+use Git::LoadCPAN::Mail::Address;\n \n Getopt::Long::Configure qw/ pass_through /;\n \ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 9d60d7948b..8e02ee2cca 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,7 +101,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/LoadCPAN/Error.pm\nsimilarity index 78%\nrename from perl/Git/Error.pm\nrename to perl/Git/LoadCPAN/Error.pm\nindex 09bbc97390..3513fe745b 100644\n--- a/perl/Git/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -1,11 +1,11 @@\n-package Git::Error;\n+package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n@@ -26,13 +26,13 @@ sub import {\n     } or do {\n \tmy $error = $@ || \"Zombie Error\";\n \n-\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n \n \trequire File::Basename;\n \tmy $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'!\";\n \n \trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n \tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n \n \tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nsimilarity index 69%\nrename from perl/Git/Mail/Address.pm\nrename to perl/Git/LoadCPAN/Mail/Address.pm\nindex 2ce3e84670..879c2f5cd1 100644\n--- a/perl/Git/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -1,11 +1,11 @@\n-package Git::Mail::Address;\n+package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n+Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339401","messageId":"20180214222146.10655-5-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 4/8] perl: update our ancient copy of Error.pm","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:42Z","receivedAt":"2018-02-14T22:22:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Error.pm shipped with Git as a fallback if there was no Error.pm\non the system was released in April 2006, there's been dozens of\nreleases since then, the latest at August 7, 2017, let's update to\nthat.\n\nThis undoes a local hack we'd accumulated in 96bc4de85c (\"Eliminate\nScalar::Util usage from private-Error.pm\", 2006-07-26), it's been\nredundant since my d48b284183 (\"perl: bump the required Perl version\nto 5.8 from 5.6.[21]\", 2010-09-24).\n\nThis also undoes 3a51467b94 (\"Typo fix: replacing it's -> its\",\n2013-04-13). This is the Nth time I find that some upstream code of\nours (in contrib/, in sha1dc/ and now in perl/ ...) has diverged from\nupstream because of some tree-wide typo fixing. Let's not do those\nfixes against upstream projects, it's more valuable that we have a 1=1\nmapping to upstream than to fix typos in docs we never even generate\nfrom this code. If someone wants to fix typos in them fine, but they\nshould do it with a patch to upstream which git.git can then\nincorporate.\n\nThe upstream code doesn't cleanly pass a --check, so I'm adding a\n.gitattributes file for similar reasons as done for sha1dc in\n5d184f468e (\"sha1dc: ignore indent-with-non-tab whitespace\nviolations\", 2017-06-06).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/.gitattributes |   1 +\n perl/Git/FromCPAN/Error.pm       | 296 +++++++++++++++++++++++++++++++++------\n 2 files changed, 256 insertions(+), 41 deletions(-)\n create mode 100644 perl/Git/FromCPAN/.gitattributes\n\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/Git/FromCPAN/.gitattributes\nnew file mode 100644\nindex 0000000000..8b64fc5e22\n--- /dev/null\n+++ b/perl/Git/FromCPAN/.gitattributes\n@@ -0,0 +1 @@\n+/Error.pm whitespace=-blank-at-eof\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/Git/FromCPAN/Error.pm\nindex 6098135ae2..f9c36e9e98 100644\n--- a/perl/Git/FromCPAN/Error.pm\n+++ b/perl/Git/FromCPAN/Error.pm\n@@ -12,10 +12,12 @@\n package Error;\n \n use strict;\n+use warnings;\n+\n use vars qw($VERSION);\n use 5.004;\n \n-$VERSION = \"0.15009\";\n+$VERSION = \"0.17025\";\n \n use overload (\n \t'\"\"'\t   =>\t'stringify',\n@@ -32,21 +34,35 @@ $Error::THROWN = undef;\t# last error thrown, a workaround until die $ref works\n my $LAST;\t\t# Last error created\n my %ERROR;\t\t# Last error associated with package\n \n-sub throw_Error_Simple\n+sub _throw_Error_Simple\n {\n     my $args = shift;\n     return Error::Simple->new($args->{'text'});\n }\n \n-$Error::ObjectifyCallback = \\&throw_Error_Simple;\n+$Error::ObjectifyCallback = \\&_throw_Error_Simple;\n \n \n # Exported subs are defined in Error::subs\n \n+use Scalar::Util ();\n+\n sub import {\n     shift;\n+    my @tags = @_;\n     local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;\n-    Error::subs->import(@_);\n+\n+    @tags = grep {\n+       if( $_ eq ':warndie' ) {\n+          Error::WarnDie->import();\n+          0;\n+       }\n+       else {\n+          1;\n+       }\n+    } @tags;\n+\n+    Error::subs->import(@tags);\n }\n \n # I really want to use last for the name of this method, but it is a keyword\n@@ -107,10 +123,6 @@ sub stacktrace {\n     $text;\n }\n \n-# Allow error propagation, ie\n-#\n-# $ber->encode(...) or\n-#    return Error->prior($ber)->associate($ldap);\n \n sub associate {\n     my $err = shift;\n@@ -130,6 +142,7 @@ sub associate {\n     return;\n }\n \n+\n sub new {\n     my $self = shift;\n     my($pkg,$file,$line) = caller($Error::Depth);\n@@ -246,6 +259,10 @@ sub value {\n \n package Error::Simple;\n \n+use vars qw($VERSION);\n+\n+$VERSION = \"0.17025\";\n+\n @Error::Simple::ISA = qw(Error);\n \n sub new {\n@@ -288,14 +305,6 @@ use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS);\n \n @ISA = qw(Exporter);\n \n-\n-sub blessed {\n-\tmy $item = shift;\n-\tlocal $@; # don't kill an outer $@\n-\tref $item and eval { $item->can('can') };\n-}\n-\n-\n sub run_clauses ($$$\\@) {\n     my($clauses,$err,$wantarray,$result) = @_;\n     my $code = undef;\n@@ -314,16 +323,17 @@ sub run_clauses ($$$\\@) {\n \t\tmy $pkg = $catch->[$i];\n \t\tunless(defined $pkg) {\n \t\t    #except\n-\t\t    splice(@$catch,$i,2,$catch->[$i+1]->());\n+\t\t    splice(@$catch,$i,2,$catch->[$i+1]->($err));\n \t\t    $i -= 2;\n \t\t    next CATCHLOOP;\n \t\t}\n-\t\telsif(blessed($err) && $err->isa($pkg)) {\n+\t\telsif(Scalar::Util::blessed($err) && $err->isa($pkg)) {\n \t\t    $code = $catch->[$i+1];\n \t\t    while(1) {\n \t\t\tmy $more = 0;\n-\t\t\tlocal($Error::THROWN);\n+\t\t\tlocal($Error::THROWN, $@);\n \t\t\tmy $ok = eval {\n+\t\t\t    $@ = $err;\n \t\t\t    if($wantarray) {\n \t\t\t\t@{$result} = $code->($err,\\$more);\n \t\t\t    }\n@@ -341,10 +351,9 @@ sub run_clauses ($$$\\@) {\n \t\t\t    undef $err;\n \t\t\t}\n \t\t\telse {\n-\t\t\t    $err = defined($Error::THROWN)\n-\t\t\t\t    ? $Error::THROWN : $@;\n-                $err = $Error::ObjectifyCallback->({'text' =>$err})\n-                    unless ref($err);\n+\t\t\t    $err = $@ || $Error::THROWN;\n+\t\t\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\t\t\tunless ref($err);\n \t\t\t}\n \t\t\tlast CATCH;\n \t\t    };\n@@ -357,7 +366,9 @@ sub run_clauses ($$$\\@) {\n \tif(defined($owise = $clauses->{'otherwise'})) {\n \t    my $code = $clauses->{'otherwise'};\n \t    my $more = 0;\n+        local($Error::THROWN, $@);\n \t    my $ok = eval {\n+\t\t$@ = $err;\n \t\tif($wantarray) {\n \t\t    @{$result} = $code->($err,\\$more);\n \t\t}\n@@ -374,11 +385,10 @@ sub run_clauses ($$$\\@) {\n \t\tundef $err;\n \t    }\n \t    else {\n-\t\t$err = defined($Error::THROWN)\n-\t\t\t? $Error::THROWN : $@;\n+\t\t$err = $@ || $Error::THROWN;\n \n-        $err = $Error::ObjectifyCallback->({'text' =>$err})\n-            unless ref($err);\n+\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\tunless ref($err);\n \t    }\n \t}\n     }\n@@ -398,7 +408,7 @@ sub try (&;$) {\n \n     do {\n \tlocal $Error::THROWN = undef;\n-    local $@ = undef;\n+\tlocal $@ = undef;\n \n \t$ok = eval {\n \t    if($wantarray) {\n@@ -413,21 +423,21 @@ sub try (&;$) {\n \t    1;\n \t};\n \n-\t$err = defined($Error::THROWN) ? $Error::THROWN : $@\n+\t$err = $@ || $Error::THROWN\n \t    unless $ok;\n     };\n \n     shift @Error::STACK;\n \n     $err = run_clauses($clauses,$err,wantarray,@result)\n-\tunless($ok);\n+    unless($ok);\n \n     $clauses->{'finally'}->()\n \tif(defined($clauses->{'finally'}));\n \n     if (defined($err))\n     {\n-        if (blessed($err) && $err->can('throw'))\n+        if (Scalar::Util::blessed($err) && $err->can('throw'))\n         {\n             throw $err;\n         }\n@@ -506,12 +516,116 @@ sub otherwise (&;$) {\n }\n \n 1;\n+\n+package Error::WarnDie;\n+\n+sub gen_callstack($)\n+{\n+    my ( $start ) = @_;\n+\n+    require Carp;\n+    local $Carp::CarpLevel = $start;\n+    my $trace = Carp::longmess(\"\");\n+    # Remove try calls from the trace\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::run_clauses[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    my @callstack = split( m/\\n/, $trace );\n+    return @callstack;\n+}\n+\n+my $old_DIE;\n+my $old_WARN;\n+\n+sub DEATH\n+{\n+    my ( $e ) = @_;\n+\n+    local $SIG{__DIE__} = $old_DIE if( defined $old_DIE );\n+\n+    die @_ if $^S;\n+\n+    my ( $etype, $message, $location, @callstack );\n+    if ( ref($e) && $e->isa( \"Error\" ) ) {\n+        $etype = \"exception of type \" . ref( $e );\n+        $message = $e->text;\n+        $location = $e->file . \":\" . $e->line;\n+        @callstack = split( m/\\n/, $e->stacktrace );\n+    }\n+    else {\n+        # Don't apply subsequent layer of message formatting\n+        die $e if( $e =~ m/^\\nUnhandled perl error caught at toplevel:\\n\\n/ );\n+        $etype = \"perl error\";\n+        my $stackdepth = 0;\n+        while( caller( $stackdepth ) =~ m/^Error(?:$|::)/ ) {\n+            $stackdepth++\n+        }\n+\n+        @callstack = gen_callstack( $stackdepth + 1 );\n+\n+        $message = \"$e\";\n+        chomp $message;\n+\n+        if ( $message =~ s/ at (.*?) line (\\d+)\\.$// ) {\n+            $location = $1 . \":\" . $2;\n+        }\n+        else {\n+            my @caller = caller( $stackdepth );\n+            $location = $caller[1] . \":\" . $caller[2];\n+        }\n+    }\n+\n+    shift @callstack;\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    die \"\\nUnhandled $etype caught at toplevel:\\n\\n  $message\\n\\nThrown from: $location\\n\\nFull stack trace:\\n\\n$callstack\\n\";\n+}\n+\n+sub TAXES\n+{\n+    my ( $message ) = @_;\n+\n+    local $SIG{__WARN__} = $old_WARN if( defined $old_WARN );\n+\n+    $message =~ s/ at .*? line \\d+\\.$//;\n+    chomp $message;\n+\n+    my @callstack = gen_callstack( 1 );\n+    my $location = shift @callstack;\n+\n+    # $location already starts in a leading space\n+    $message .= $location;\n+\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    warn \"$message:\\n$callstack\";\n+}\n+\n+sub import\n+{\n+    $old_DIE  = $SIG{__DIE__};\n+    $old_WARN = $SIG{__WARN__};\n+\n+    $SIG{__DIE__}  = \\&DEATH;\n+    $SIG{__WARN__} = \\&TAXES;\n+}\n+\n+1;\n+\n __END__\n \n =head1 NAME\n \n Error - Error/exception handling in an OO-ish way\n \n+=head1 WARNING\n+\n+Using the \"Error\" module is B<no longer recommended> due to the black-magical\n+nature of its syntactic sugar, which often tends to break. Its maintainers\n+have stopped actively writing code that uses it, and discourage people\n+from doing so. See the \"SEE ALSO\" section below for better recommendations.\n+\n =head1 SYNOPSIS\n \n     use Error qw(:try);\n@@ -529,7 +643,7 @@ Error - Error/exception handling in an OO-ish way\n     try {\n \tdo_some_stuff();\n \tdie \"error!\" if $condition;\n-\tthrow Error::Simple -text => \"Oops!\" if $other_condition;\n+\tthrow Error::Simple \"Oops!\" if $other_condition;\n     }\n     catch Error::IO with {\n \tmy $E = shift;\n@@ -587,7 +701,7 @@ C<BLOCK> will be passed two arguments. The first will be the error\n being thrown. The second is a reference to a scalar variable. If this\n variable is set by the catch block then, on return from the catch\n block, try will continue processing as if the catch block was never\n-found.\n+found. The error will also be available in C<$@>.\n \n To propagate the error the catch block may call C<$err-E<gt>throw>\n \n@@ -608,7 +722,7 @@ type.\n Catch any error by executing the code in C<BLOCK>\n \n When evaluated C<BLOCK> will be passed one argument, which will be the\n-error being processed.\n+error being processed. The error will also be available in C<$@>.\n \n Only one otherwise block may be specified per try block\n \n@@ -625,12 +739,25 @@ Only one finally block may be specified per try block\n \n =back\n \n+=head1 COMPATIBILITY\n+\n+L<Moose> exports a keyword called C<with> which clashes with Error's. This\n+example returns a prototype mismatch error:\n+\n+    package MyTest;\n+\n+    use warnings;\n+    use Moose;\n+    use Error qw(:try);\n+\n+(Thanks to C<maik.hentsche@amd.com> for the report.).\n+\n =head1 CLASS INTERFACE\n \n =head2 CONSTRUCTORS\n \n The C<Error> object is implemented as a HASH. This HASH is initialized\n-with the arguments that are passed to its constructor. The elements\n+with the arguments that are passed to it's constructor. The elements\n that are used by, or are retrievable by the C<Error> class are listed\n below, other classes may add to these.\n \n@@ -655,6 +782,10 @@ an object blessed into that package as the C<-object> argument.\n \n =over 4\n \n+=item Error->new()\n+\n+See the Error::Simple documentation.\n+\n =item throw ( [ ARGS ] )\n \n Create a new C<Error> object and throw an error, which will be caught\n@@ -730,6 +861,13 @@ The line where the constructor of this error was called from\n \n The text of the error\n \n+=item $err->associate($obj)\n+\n+Associates an error with an object to allow error propagation. I.e:\n+\n+    $ber->encode(...) or\n+        return Error->prior($ber)->associate($ldap);\n+\n =back\n \n =head2 OVERLOAD METHODS\n@@ -759,11 +897,9 @@ to the constructor.\n \n =head1 PRE-DEFINED ERROR CLASSES\n \n-=over 4\n-\n-=item Error::Simple\n+=head2 Error::Simple\n \n-This class can be used to hold simple error strings and values. Its\n+This class can be used to hold simple error strings and values. It's\n constructor takes two arguments. The first is a text value, the second\n is a numeric value. These values are what will be returned by the\n overload methods.\n@@ -775,7 +911,6 @@ of the error object.\n This class is used internally if an eval'd block die's with an error\n that is a plain string. (Unless C<$Error::ObjectifyCallback> is modified)\n \n-=back\n \n =head1 $Error::ObjectifyCallback\n \n@@ -804,6 +939,76 @@ class MyError::Bar by default:\n         # Error handling here.\n     }\n \n+=cut\n+\n+=head1 MESSAGE HANDLERS\n+\n+C<Error> also provides handlers to extend the output of the C<warn()> perl\n+function, and to handle the printing of a thrown C<Error> that is not caught\n+or otherwise handled. These are not installed by default, but are requested\n+using the C<:warndie> tag in the C<use> line.\n+\n+ use Error qw( :warndie );\n+\n+These new error handlers are installed in C<$SIG{__WARN__}> and\n+C<$SIG{__DIE__}>. If these handlers are already defined when the tag is\n+imported, the old values are stored, and used during the new code. Thus, to\n+arrange for custom handling of warnings and errors, you will need to perform\n+something like the following:\n+\n+ BEGIN {\n+   $SIG{__WARN__} = sub {\n+     print STDERR \"My special warning handler: $_[0]\"\n+   };\n+ }\n+\n+ use Error qw( :warndie );\n+\n+Note that setting C<$SIG{__WARN__}> after the C<:warndie> tag has been\n+imported will overwrite the handler that C<Error> provides. If this cannot be\n+avoided, then the tag can be explicitly C<import>ed later\n+\n+ use Error;\n+\n+ $SIG{__WARN__} = ...;\n+\n+ import Error qw( :warndie );\n+\n+=head2 EXAMPLE\n+\n+The C<__DIE__> handler turns messages such as\n+\n+ Can't call method \"foo\" on an undefined value at examples/warndie.pl line 16.\n+\n+into\n+\n+ Unhandled perl error caught at toplevel:\n+\n+   Can't call method \"foo\" on an undefined value\n+\n+ Thrown from: examples/warndie.pl:16\n+\n+ Full stack trace:\n+\n+         main::inner('undef') called at examples/warndie.pl line 20\n+         main::outer('undef') called at examples/warndie.pl line 23\n+\n+=cut\n+\n+=head1 SEE ALSO\n+\n+See L<Exception::Class> for a different module providing Object-Oriented\n+exception handling, along with a convenient syntax for declaring hierarchies\n+for them. It doesn't provide Error's syntactic sugar of C<try { ... }>,\n+C<catch { ... }>, etc. which may be a good thing or a bad thing based\n+on what you want. (Because Error's syntactic sugar tends to break.)\n+\n+L<Error::Exception> aims to combine L<Error> and L<Exception::Class>\n+\"with correct stringification\".\n+\n+L<TryCatch> and L<Try::Tiny> are similar in concept to Error.pm only providing\n+a syntax that hopefully breaks less.\n+\n =head1 KNOWN BUGS\n \n None, but that does not mean there are not any.\n@@ -816,12 +1021,21 @@ The code that inspired me to write this was originally written by\n Peter Seibel <peter@weblogic.com> and adapted by Jesse Glick\n <jglick@sig.bsh.com>.\n \n+C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>\n+\n =head1 MAINTAINER\n \n-Shlomi Fish <shlomif@iglu.org.il>\n+Shlomi Fish, L<http://www.shlomifish.org/> .\n \n =head1 PAST MAINTAINERS\n \n Arun Kumar U <u_arunkumar@yahoo.com>\n \n+=head1 COPYRIGHT\n+\n+Copyright (c) 1997-8  Graham Barr. All rights reserved.\n+This program is free software; you can redistribute it and/or modify it\n+under the same terms as Perl itself.\n+\n =cut\n+\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339402","messageId":"20180214222146.10655-4-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:41Z","receivedAt":"2018-02-14T22:22:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the two wrappers to load from CPAN (local OS) or our own copy\nto do so via the same codepath.\n\nI added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\nafterwards Matthieu Moy added a wrapper for Mail::Address in\nbd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n2018-01-05).\n\nHis was simpler since Mail::Address doesn't have an \"import\" method,\nbut didn't do the same sanity checking, e.g. a missing FromCPAN\ndirectory (which OS packages are likely not to have) wouldn't be\nexplicitly warned about.\n\nNow both use a modification of the previously Error.pm-specific\ncodepath, which has been amended to take the module to load as\nparameter, as well as whether or not that module has an import method.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/LoadCPAN.pm              | 74 +++++++++++++++++++++++++++++++++++++++\n perl/Git/LoadCPAN/Error.pm        | 44 +++--------------------\n perl/Git/LoadCPAN/Mail/Address.pm | 22 +++---------\n 3 files changed, 82 insertions(+), 58 deletions(-)\n create mode 100644 perl/Git/LoadCPAN.pm\n\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nnew file mode 100644\nindex 0000000000..2262812654\n--- /dev/null\n+++ b/perl/Git/LoadCPAN.pm\n@@ -0,0 +1,74 @@\n+package Git::LoadCPAN;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy\n+\n+=head1 DESCRIPTION\n+\n+The Perl code in Git depends on some modules from the CPAN, but we\n+don't want to make those a hard requirement for anyone building from\n+source.\n+\n+Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n+wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n+attempt to load C<Module::Name> from the OS, and if that doesn't work\n+will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n+itself.\n+\n+Usually OS's will not ship with Git's Git::FromCPAN tree at all,\n+preferring to use their own packaging of CPAN modules instead.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+    shift;\n+    my $caller = caller;\n+    my %args = @_;\n+    my $module = exists $args{module} ? delete $args{module} : die \"BUG: Expected 'module' parameter!\";\n+    my $import = exists $args{import} ? delete $args{import} : die \"BUG: Expected 'import' parameter!\";\n+    die \"BUG: Too many arguments!\" if keys %args;\n+\n+    # Foo::Bar to Foo/Bar.pm\n+    my $package_pm = $module;\n+    $package_pm =~ s[::][/]g;\n+    $package_pm .= '.pm';\n+\n+    eval {\n+\trequire $package_pm;\n+\t1;\n+    } or do {\n+\tmy $error = $@ || \"Zombie Error\";\n+\n+\tmy $Git_LoadCPAN_pm_path = $INC{\"Git/LoadCPAN.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\trequire File::Basename;\n+\tmy $Git_LoadCPAN_pm_root = File::Basename::dirname($Git_LoadCPAN_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_LoadCPAN_pm_path'!\";\n+\n+\trequire File::Spec;\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, 'FromCPAN');\n+\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\trequire $package_pm;\n+    };\n+\n+    if ($import) {\n+\tno strict 'refs';\n+\t*{\"${caller}::import\"}= sub {\n+\t    shift;\n+\t    use strict 'refs';\n+\t    unshift @_, $module;\n+\t    goto &{\"${module}::import\"};\n+\t};\n+\tuse strict 'refs';\n+    }\n+}\n+\n+1;\ndiff --git a/perl/Git/LoadCPAN/Error.pm b/perl/Git/LoadCPAN/Error.pm\nindex 3513fe745b..9ba53cccf2 100644\n--- a/perl/Git/LoadCPAN/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-Wraps the import function for the L<Error> module.\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-sub import {\n-    shift;\n-    my $caller = caller;\n-\n-    eval {\n-\trequire Error;\n-\t1;\n-    } or do {\n-\tmy $error = $@ || \"Zombie Error\";\n-\n-\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n-\n-\trequire File::Basename;\n-\tmy $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'!\";\n-\n-\trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n-\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n-\n-\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n-\trequire Error;\n-    };\n-\n-    unshift @_, $caller;\n-    goto &Error::import;\n-}\n+use Git::LoadCPAN (\n+    module => 'Error',\n+    import => 1,\n+);\n \n 1;\ndiff --git a/perl/Git/LoadCPAN/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nindex 879c2f5cd1..a13f0e58cf 100644\n--- a/perl/Git/LoadCPAN/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -2,23 +2,9 @@ package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-eval {\n-    require Mail::Address;\n-    1;\n-} or do {\n-    require Git::FromCPAN::Mail::Address;\n-};\n+use Git::LoadCPAN (\n+    module => 'Mail::Address',\n+    import => 0,\n+);\n \n 1;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339403","messageId":"20180214222146.10655-7-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 6/8] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:44Z","receivedAt":"2018-02-14T22:22:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Net::SMTP and Net::Domain were both first released with perl\nv5.7.3, since my d48b284183 (\"perl: bump the required Perl version to\n5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's no\nreason to conditionally require this anymore.\n\nThis conditional loading was initially added in\n87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\nto give real name of the calling host to HELO/EHLO\", 2010-03-14) for\nNet::Domain, both of which predate the hard dependency on 5.8.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-send-email.perl | 24 +++++++++++-------------\n 1 file changed, 11 insertions(+), 13 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 85bb6482f2..69bd443245 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1143,10 +1143,9 @@ sub valid_fqdn {\n sub maildomain_net {\n \tmy $maildomain;\n \n-\tif (eval { require Net::Domain; 1 }) {\n-\t\tmy $domain = Net::Domain::domainname();\n-\t\t$maildomain = $domain if valid_fqdn($domain);\n-\t}\n+\trequire Net::Domain;\n+\tmy $domain = Net::Domain::domainname();\n+\t$maildomain = $domain if valid_fqdn($domain);\n \n \treturn $maildomain;\n }\n@@ -1154,17 +1153,16 @@ sub maildomain_net {\n sub maildomain_mta {\n \tmy $maildomain;\n \n-\tif (eval { require Net::SMTP; 1 }) {\n-\t\tfor my $host (qw(mailhost localhost)) {\n-\t\t\tmy $smtp = Net::SMTP->new($host);\n-\t\t\tif (defined $smtp) {\n-\t\t\t\tmy $domain = $smtp->domain;\n-\t\t\t\t$smtp->quit;\n+\trequire Net::SMTP;\n+\tfor my $host (qw(mailhost localhost)) {\n+\t\tmy $smtp = Net::SMTP->new($host);\n+\t\tif (defined $smtp) {\n+\t\t\tmy $domain = $smtp->domain;\n+\t\t\t$smtp->quit;\n \n-\t\t\t\t$maildomain = $domain if valid_fqdn($domain);\n+\t\t\t$maildomain = $domain if valid_fqdn($domain);\n \n-\t\t\t\tlast if $maildomain;\n-\t\t\t}\n+\t\t\tlast if $maildomain;\n \t\t}\n \t}\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339404","messageId":"20180214222146.10655-8-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 7/8] gitweb: hard-depend on the Digest::MD5 5.8 module","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:45Z","receivedAt":"2018-02-14T22:22:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require Digest::MD5 anymore. It was released with perl\nv5.7.3.\n\nThe initial introduction of the dependency in\ne9fdd74e53 (\"gitweb: (gr)avatar support\", 2009-06-30) says as much,\nthis also undoes part of the later 2e9c8789b7 (\"gitweb: Mention\noptional Perl modules in INSTALL\", 2011-02-04) since gitweb will\nalways be run on at least 5.8, so there's no need to mention\nDigest::MD5 as a required module in the documentation, let's instead\nsay that we require perl 5.8.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n gitweb/INSTALL     |  3 +--\n gitweb/gitweb.perl | 17 +++++------------\n 2 files changed, 6 insertions(+), 14 deletions(-)\n\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex 408f2859d3..a58e6b3c44 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -29,12 +29,11 @@ Requirements\n ------------\n \n  - Core git tools\n- - Perl\n+ - Perl 5.8\n  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.\n  - web server\n \n The following optional Perl modules are required for extra features\n- - Digest::MD5 - for gravatar support\n  - CGI::Fast and FCGI - for running gitweb as FastCGI script\n  - HTML::TagCloud - for fancy tag cloud in project list view\n  - HTTP::Date or Time::ParseDate - to support If-Modified-Since for feeds\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2417057f2b..8f48e3c02e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -490,7 +490,6 @@ our %feature = (\n \t# Currently available providers are gravatar and picon.\n \t# If an unknown provider is specified, the feature is disabled.\n \n-\t# Gravatar depends on Digest::MD5.\n \t# Picon currently relies on the indiana.edu database.\n \n \t# To enable system wide have in $GITWEB_CONFIG\n@@ -1166,18 +1165,11 @@ sub configure_gitweb_features {\n \tour @snapshot_fmts = gitweb_get_feature('snapshot');\n \t@snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);\n \n-\t# check that the avatar feature is set to a known provider name,\n-\t# and for each provider check if the dependencies are satisfied.\n-\t# if the provider name is invalid or the dependencies are not met,\n-\t# reset $git_avatar to the empty string.\n+\t# check that the avatar feature is set to a known provider\n+\t# name, if the provider name is invalid, reset $git_avatar to\n+\t# the empty string.\n \tour ($git_avatar) = gitweb_get_feature('avatar');\n-\tif ($git_avatar eq 'gravatar') {\n-\t\t$git_avatar = '' unless (eval { require Digest::MD5; 1; });\n-\t} elsif ($git_avatar eq 'picon') {\n-\t\t# no dependencies\n-\t} else {\n-\t\t$git_avatar = '';\n-\t}\n+\t$git_avatar = '' unless $git_avatar =~ /^(?:gravatar|picon)$/s;\n \n \tour @extra_branch_refs = gitweb_get_feature('extra-branch-refs');\n \t@extra_branch_refs = filter_and_validate_refs (@extra_branch_refs);\n@@ -2165,6 +2157,7 @@ sub picon_url {\n sub gravatar_url {\n \tmy $email = lc shift;\n \tmy $size = shift;\n+\trequire Digest::MD5;\n \t$avatar_cache{$email} ||=\n \t\t\"//www.gravatar.com/avatar/\" .\n \t\t\tDigest::MD5::md5_hex($email) . \"?s=\";\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339405","messageId":"20180214222146.10655-6-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 5/8] perl: update our copy of Mail::Address","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:43Z","receivedAt":"2018-02-14T22:22:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n23, 2018). This should be a trivial update[1] but it seems the version\nMatthieu Moy imported in bd869f67b9 (\"send-email: add and use a local\ncopy of Mail::Address\", 2018-01-05) doesn't correspond to any 2.19\nversion found on the CPAN. From the comment at the top of the file it\nlooks like some OS version with the POD stripped, and with different\nindentation.\n\nLet's instead use the upstream version as-is, and without copyright\nnotices stripped. Like Error.pm this doesn't cleanly pass --check, so\nadd a .gitattributes file to ignore the errors.\n\n1. https://metacpan.org/diff/file?target=MARKOV/MailTools-2.20/lib%2FMail%2FAddress.pod&source=MARKOV%2FMailTools-2.19%2Flib%2FMail%2FAddress.pod\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/Mail/.gitattributes |   1 +\n perl/Git/FromCPAN/Mail/Address.pm     | 436 +++++++++++++---------------------\n 2 files changed, 163 insertions(+), 274 deletions(-)\n create mode 100644 perl/Git/FromCPAN/Mail/.gitattributes\n\ndiff --git a/perl/Git/FromCPAN/Mail/.gitattributes b/perl/Git/FromCPAN/Mail/.gitattributes\nnew file mode 100644\nindex 0000000000..94f3e5bb86\n--- /dev/null\n+++ b/perl/Git/FromCPAN/Mail/.gitattributes\n@@ -0,0 +1 @@\n+/Address.pm whitespace=-trailing-space\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/Git/FromCPAN/Mail/Address.pm\nindex 13b2ff7d05..ee333e0f5a 100644\n--- a/perl/Git/FromCPAN/Mail/Address.pm\n+++ b/perl/Git/FromCPAN/Mail/Address.pm\n@@ -1,276 +1,164 @@\n-# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>].\n-#  For other contributors see ChangeLog.\n-# See the manual pages for details on the licensing terms.\n-# Pod stripped from pm file by OODoc 2.02.\n-package Mail::Address;\n-use vars '$VERSION';\n-$VERSION = '2.19';\n-\n-use strict;\n-\n-use Carp;\n-\n-# use locale;   removed in version 1.78, because it causes taint problems\n-\n-sub Version { our $VERSION }\n-\n-\n-\n-# given a comment, attempt to extract a person's name\n-sub _extract_name\n-{   # This function can be called as method as well\n-    my $self = @_ && ref $_[0] ? shift : undef;\n-\n-    local $_ = shift\n-        or return '';\n-\n-    # Using encodings, too hard. See Mail::Message::Field::Full.\n-    return '' if m/\\=\\?.*?\\?\\=/;\n-\n-    # trim whitespace\n-    s/^\\s+//;\n-    s/\\s+$//;\n-    s/\\s+/ /;\n-\n-    # Disregard numeric names (e.g. 123456.1234@compuserve.com)\n-    return \"\" if /^[\\d ]+$/;\n-\n-    s/^\\((.*)\\)$/$1/; # remove outermost parenthesis\n-    s/^\"(.*)\"$/$1/;   # remove outer quotation marks\n-    s/\\(.*?\\)//g;     # remove minimal embedded comments\n-    s/\\\\//g;          # remove all escapes\n-    s/^\"(.*)\"$/$1/;   # remove internal quotation marks\n-    s/^([^\\s]+) ?, ?(.*)$/$2 $1/; # reverse \"Last, First M.\" if applicable\n-    s/,.*//;\n-\n-    # Change casing only when the name contains only upper or only\n-    # lower cased characters.\n-    unless( m/[A-Z]/ && m/[a-z]/ )\n-    {   # Set the case of the name to first char upper rest lower\n-        s/\\b(\\w+)/\\L\\u$1/igo;  # Upcase first letter on name\n-        s/\\bMc(\\w)/Mc\\u$1/igo; # Scottish names such as 'McLeod'\n-        s/\\bo'(\\w)/O'\\u$1/igo; # Irish names such as 'O'Malley, O'Reilly'\n-        s/\\b(x*(ix)?v*(iv)?i*)\\b/\\U$1/igo; # Roman numerals, eg 'Level III Support'\n-    }\n+=encoding utf8\n \n-    # some cleanup\n-    s/\\[[^\\]]*\\]//g;\n-    s/(^[\\s'\"]+|[\\s'\"]+$)//g;\n-    s/\\s{2,}/ /g;\n-\n-    $_;\n-}\n-\n-sub _tokenise\n-{   local $_ = join ',', @_;\n-    my (@words,$snippet,$field);\n-\n-    s/\\A\\s+//;\n-    s/[\\r\\n]+/ /g;\n-\n-    while ($_ ne '')\n-    {   $field = '';\n-        if(s/^\\s*\\(/(/ )    # (...)\n-        {   my $depth = 0;\n-\n-     PAREN: while(s/^(\\(([^\\(\\)\\\\]|\\\\.)*)//)\n-            {   $field .= $1;\n-                $depth++;\n-                while(s/^(([^\\(\\)\\\\]|\\\\.)*\\)\\s*)//)\n-                {   $field .= $1;\n-                    last PAREN unless --$depth;\n-\t            $field .= $1 if s/^(([^\\(\\)\\\\]|\\\\.)+)//;\n-                }\n-            }\n-\n-            carp \"Unmatched () '$field' '$_'\"\n-                if $depth;\n-\n-            $field =~ s/\\s+\\Z//;\n-            push @words, $field;\n-\n-            next;\n-        }\n-\n-        if( s/^(\"(?:[^\"\\\\]+|\\\\.)*\")\\s*//       # \"...\"\n-         || s/^(\\[(?:[^\\]\\\\]+|\\\\.)*\\])\\s*//    # [...]\n-         || s/^([^\\s()<>\\@,;:\\\\\".[\\]]+)\\s*//\n-         || s/^([()<>\\@,;:\\\\\".[\\]])\\s*//\n-          )\n-        {   push @words, $1;\n-            next;\n-        }\n-\n-        croak \"Unrecognised line: $_\";\n-    }\n-\n-    push @words, \",\";\n-    \\@words;\n-}\n-\n-sub _find_next\n-{   my ($idx, $tokens, $len) = @_;\n-\n-    while($idx < $len)\n-    {   my $c = $tokens->[$idx];\n-        return $c if $c eq ',' || $c eq ';' || $c eq '<';\n-        $idx++;\n-    }\n-\n-    \"\";\n-}\n-\n-sub _complete\n-{   my ($class, $phrase, $address, $comment) = @_;\n-\n-    @$phrase || @$comment || @$address\n-       or return undef;\n-\n-    my $o = $class->new(join(\" \",@$phrase), join(\"\",@$address), join(\" \",@$comment));\n-    @$phrase = @$address = @$comment = ();\n-    $o;\n-}\n-\n-#------------\n-\n-sub new(@)\n-{   my $class = shift;\n-    bless [@_], $class;\n-}\n-\n-\n-sub parse(@)\n-{   my $class = shift;\n-    my @line  = grep {defined} @_;\n-    my $line  = join '', @line;\n-\n-    my (@phrase, @comment, @address, @objs);\n-    my ($depth, $idx) = (0, 0);\n-\n-    my $tokens  = _tokenise @line;\n-    my $len     = @$tokens;\n-    my $next    = _find_next $idx, $tokens, $len;\n-\n-    local $_;\n-    for(my $idx = 0; $idx < $len; $idx++)\n-    {   $_ = $tokens->[$idx];\n-\n-        if(substr($_,0,1) eq '(') { push @comment, $_ }\n-        elsif($_ eq '<')    { $depth++ }\n-        elsif($_ eq '>')    { $depth-- if $depth }\n-        elsif($_ eq ',' || $_ eq ';')\n-        {   warn \"Unmatched '<>' in $line\" if $depth;\n-            my $o = $class->_complete(\\@phrase, \\@address, \\@comment);\n-            push @objs, $o if defined $o;\n-            $depth = 0;\n-            $next = _find_next $idx+1, $tokens, $len;\n-        }\n-        elsif($depth)       { push @address, $_ }\n-        elsif($next eq '<') { push @phrase,  $_ }\n-        elsif( /^[.\\@:;]$/ || !@address || $address[-1] =~ /^[.\\@:;]$/ )\n-        {   push @address, $_ }\n-        else\n-        {   warn \"Unmatched '<>' in $line\" if $depth;\n-            my $o = $class->_complete(\\@phrase, \\@address, \\@comment);\n-            push @objs, $o if defined $o;\n-            $depth = 0;\n-            push @address, $_;\n-        }\n-    }\n-    @objs;\n-}\n-\n-#------------\n-\n-sub phrase  { shift->set_or_get(0, @_) }\n-sub address { shift->set_or_get(1, @_) }\n-sub comment { shift->set_or_get(2, @_) }\n-\n-sub set_or_get($)\n-{   my ($self, $i) = (shift, shift);\n-    @_ or return $self->[$i];\n-\n-    my $val = $self->[$i];\n-    $self->[$i] = shift if @_;\n-    $val;\n-}\n-\n-\n-my $atext = '[\\-\\w !#$%&\\'*+/=?^`{|}~]';\n-sub format\n-{   my @addrs;\n-\n-    foreach (@_)\n-    {   my ($phrase, $email, $comment) = @$_;\n-        my @addr;\n-\n-        if(defined $phrase && length $phrase)\n-        {   push @addr\n-              , $phrase =~ /^(?:\\s*$atext\\s*)+$/o ? $phrase\n-              : $phrase =~ /(?<!\\\\)\"/             ? $phrase\n-              :                                    qq(\"$phrase\");\n-\n-            push @addr, \"<$email>\"\n-                if defined $email && length $email;\n-        }\n-        elsif(defined $email && length $email)\n-        {   push @addr, $email;\n-        }\n-\n-        if(defined $comment && $comment =~ /\\S/)\n-        {   $comment =~ s/^\\s*\\(?/(/;\n-            $comment =~ s/\\)?\\s*$/)/;\n-        }\n-\n-        push @addr, $comment\n-            if defined $comment && length $comment;\n-\n-        push @addrs, join(\" \", @addr)\n-            if @addr;\n-    }\n-\n-    join \", \", @addrs;\n-}\n-\n-#------------\n-\n-sub name\n-{   my $self   = shift;\n-    my $phrase = $self->phrase;\n-    my $addr   = $self->address;\n-\n-    $phrase    = $self->comment\n-        unless defined $phrase && length $phrase;\n-\n-    my $name   = $self->_extract_name($phrase);\n-\n-    # first.last@domain address\n-    if($name eq '' && $addr =~ /([^\\%\\.\\@_]+([\\._][^\\%\\.\\@_]+)+)[\\@\\%]/)\n-    {   ($name  = $1) =~ s/[\\._]+/ /g;\n-\t$name   = _extract_name $name;\n-    }\n-\n-    if($name eq '' && $addr =~ m#/g=#i)    # X400 style address\n-    {   my ($f) = $addr =~ m#g=([^/]*)#i;\n-\tmy ($l) = $addr =~ m#s=([^/]*)#i;\n-\t$name   = _extract_name \"$f $l\";\n-    }\n-\n-    length $name ? $name : undef;\n-}\n-\n-\n-sub host\n-{   my $addr = shift->address || '';\n-    my $i    = rindex $addr, '@';\n-    $i >= 0 ? substr($addr, $i+1) : undef;\n-}\n-\n-\n-sub user\n-{   my $addr = shift->address || '';\n-    my $i    = rindex $addr, '@';\n-    $i >= 0 ? substr($addr,0,$i) : $addr;\n-}\n+=head1 NAME\n+\n+Mail::Address - parse mail addresses\n+\n+=head1 SYNOPSIS\n+\n+ use Mail::Address;\n+ my @addrs = Mail::Address->parse($line);\n+\n+ foreach $addr (@addrs) {\n+     print $addr->format,\"\\n\";\n+ }\n+\n+=head1 DESCRIPTION\n+\n+C<Mail::Address> extracts and manipulates email addresses from a message\n+header.  It cannot be used to extract addresses from some random text.\n+You can use this module to create RFC822 compliant fields.\n+\n+Although C<Mail::Address> is a very popular subject for books, and is\n+used in many applications, it does a very poor job on the more complex\n+message fields.  It does only handle simple address formats (which\n+covers about 95% of what can be found). Problems are with\n+\n+=over 4\n+\n+=item *\n+\n+no support for address groups, even not with the semi-colon as\n+separator between addresses;\n+\n+=item *\n+\n+limited support for escapes in phrases and comments.  There are\n+cases where it can get wrong; and\n+\n+=item *\n+\n+you have to take care of most escaping when you create an address yourself:\n+C<Mail::Address> does not do that for you.\n+\n+=back\n+\n+Often requests are made to the maintainers of this code improve this\n+situation, but this is not a good idea, where it will break zillions\n+of existing applications.  If you wish for a fully RFC2822 compliant\n+implementation you may take a look at L<Mail::Message::Field::Full>,\n+part of MailBox.\n+\n+B<. Example>\n+\n+  my $s = Mail::Message::Field::Full->new($from_header);\n+  # ref $s isa Mail::Message::Field::Addresses;\n+\n+  my @g = $s->groups;          # all groups, at least one\n+  # ref $g[0] isa Mail::Message::Field::AddrGroup;\n+  my $ga = $g[0]->addresses;   # group addresses\n+\n+  my @a = $s->addresses;       # all addresses\n+  # ref $a[0] isa Mail::Message::Field::Address;\n+\n+=head1 METHODS\n+\n+=head2 Constructors\n+\n+=over 4\n+\n+=item Mail::Address-E<gt>B<new>( $phrase, $address, [ $comment ] )\n+\n+Create a new C<Mail::Address> object which represents an address with the\n+elements given. In a message these 3 elements would be seen like:\n+\n+ PHRASE <ADDRESS> (COMMENT)\n+ ADDRESS (COMMENT)\n+\n+example: \n+\n+ Mail::Address->new(\"Perl5 Porters\", \"perl5-porters@africa.nicoh.com\");\n+\n+=item $obj-E<gt>B<parse>($line)\n+\n+Parse the given line a return a list of extracted C<Mail::Address> objects.\n+The line would normally be one taken from a To,Cc or Bcc line in a message\n+\n+example: \n+\n+ my @addr = Mail::Address->parse($line);\n+\n+=back\n+\n+=head2 Accessors\n+\n+=over 4\n+\n+=item $obj-E<gt>B<address>()\n+\n+Return the address part of the object.\n+\n+=item $obj-E<gt>B<comment>()\n+\n+Return the comment part of the object\n+\n+=item $obj-E<gt>B<format>(@addresses)\n+\n+Return a string representing the address in a suitable form to be placed\n+on a C<To>, C<Cc>, or C<Bcc> line of a message.  This method is called on\n+the first address to be used; other specified addresses will be appended,\n+separated by commas.\n+\n+=item $obj-E<gt>B<phrase>()\n+\n+Return the phrase part of the object.\n+\n+=back\n+\n+=head2 Smart accessors\n+\n+=over 4\n+\n+=item $obj-E<gt>B<host>()\n+\n+Return the address excluding the user id and '@'\n+\n+=item $obj-E<gt>B<name>()\n+\n+Using the information contained within the object attempt to identify what\n+the person or groups name is.\n+\n+B<Note:> This function tries to be smart with the \"phrase\" of the\n+email address, which is probably a very bad idea.  Consider to use\n+L<phrase()|Mail::Address/\"Accessors\"> itself.\n+\n+=item $obj-E<gt>B<user>()\n+\n+Return the address excluding the '@' and the mail domain\n+\n+=back\n+\n+=head1 SEE ALSO\n+\n+This module is part of the MailTools distribution,\n+F<http://perl.overmeer.net/mailtools/>.\n+\n+=head1 AUTHORS\n+\n+The MailTools bundle was developed by Graham Barr.  Later, Mark\n+Overmeer took over maintenance without commitment to further development.\n+\n+Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>.\n+Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>.\n+Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>.\n+For other contributors see ChangeLog.\n+\n+=head1 LICENSE\n+\n+Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and\n+2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>.\n+\n+This program is free software; you can redistribute it and/or modify it\n+under the same terms as Perl itself.\n+See F<http://www.perl.com/perl/misc/Artistic.html>\n \n-1;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339406","messageId":"20180214222146.10655-9-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-14T22:21:46Z","receivedAt":"2018-02-14T22:22:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require File::Temp and File::Spec anymore. They were\nfirst released with perl versions v5.6.1 and 5.00405, respectively.\n\nThis code was originally added in c14c8ceb13 (\"Git.pm: Make File::Spec\nand File::Temp requirement lazy\", 2008-08-15), presumably to make\nGit.pm work on 5.6.0.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 8e02ee2cca..221e827e83 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -1324,8 +1324,9 @@ sub _temp_cache {\n }\n \n sub _verify_require {\n-\teval { require File::Temp; require File::Spec; };\n-\t$@ and throw Error::Simple($@);\n+\trequire File::Temp;\n+\trequire File::Spec;\n+\treturn;\n }\n \n =item temp_reset ( FILEHANDLE )\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"339408","messageId":"20180214224137.GA136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-2-avarab@gmail.com","subject":"Re: [PATCH 1/8] perl: *.pm files should not have the executable bit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T22:41:37Z","receivedAt":"2018-02-14T22:42:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nÆvar Arnfjörð Bjarmason wrote:\n\n> The Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\n> use a local copy of Mail::Address\", 2018-01-05) had the executable bit\n> set, this should not be the case with *.pm files, it breaks nothing,\n> but is redundant and confusing as none of the other files have it, and\n> it's never executed as a stand-alone program.\n\nNeeds a period somewhere to break up the long sentence with comma\nsplices.  How about:\n\n\tThe Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\n\tuse a local copy of Mail::Address\", 2018-01-05) had the executable bit\n\tset. That bit should not be set for *.pm files. It breaks nothing but\n\tbut it is redundant and confusing as none of the other files have it\n\tand these files are never executed as stand-alone programs.\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\nWith or without such a tweak,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"},{"id":"339409","messageId":"20180214224334.GB136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-3-avarab@gmail.com","subject":"Re: [PATCH 2/8] perl: move CPAN loader wrappers to another namespace","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T22:43:34Z","receivedAt":"2018-02-14T22:43:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Move the Git::Error and Git::Mail::Address wrappers to the\n> Git::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error, that\n> module will then either load Error from CPAN (if installed on the OS),\n> or use Git::FromCPAN::Error.\n[...]\n> This also makes things a bit less confusing since there was already a\n> Git::Error namespace ever since 8b9150e3e3 (\"Git.pm: Handle failed\n> commands' output\", 2006-06-24).\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\nMakes sense.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"339411","messageId":"20180214225754.GC136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-4-avarab@gmail.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T22:57:54Z","receivedAt":"2018-02-14T22:58:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Change the two wrappers to load from CPAN (local OS) or our own copy\n> to do so via the same codepath.\n\nnit: I think with s/to load/that load/ this will be easier to read.\n\n> I added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\n> perl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\n> afterwards Matthieu Moy added a wrapper for Mail::Address in\n> bd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n> 2018-01-05).\n>\n> His was simpler since Mail::Address doesn't have an \"import\" method,\n> but didn't do the same sanity checking, e.g. a missing FromCPAN\n> directory (which OS packages are likely not to have) wouldn't be\n> explicitly warned about.\n\nI'm having trouble parsing this.  Mail::Address didn't do the same\nsanity checking or his didn't?\n\nThe comma before e.g. should be a period or semicolon, since it's\nstarting a new independent clause.\n\n> Now both use a modification of the previously Error.pm-specific\n> codepath, which has been amended to take the module to load as\n> parameter, as well as whether or not that module has an import method.\n\nDoes \"now\" mean before this patch or after this patch?  Usually\ncommit messages describe the status quo without the patch in the\npresent tense and the change the patch will make in the imperative.\nSo this could say:\n\n\tUpdate both to use a common implementation based on the previous\n\tError.pm loader.\n\n[...]\n> +++ b/perl/Git/LoadCPAN.pm\n> @@ -0,0 +1,74 @@\n[...]\n> +The Perl code in Git depends on some modules from the CPAN, but we\n> +don't want to make those a hard requirement for anyone building from\n> +source.\n\nnot about this patch: have we considered making it a hard requirement?\nBoth Mail::Address and Error.pm are pretty widely available, and I\nwonder if we could make the instructions in the INSTALL file say that\nthey are required dependencies to simplify things.\n\nI admit part of my bias here is coming from the distro world, where we\nhave to do extra work to get rid of the FromCPAN embedded copies and\nwould be happier not to have to.\n\n[...]\n> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,\n> +preferring to use their own packaging of CPAN modules instead.\n\nnit: I think the plural of OS is OSes, or something like\n\"distributors\" or \"operating systems\".\n\n[...]\n> +    eval {\n> +\trequire $package_pm;\n> +\t1;\n> +    } or do {\n\nalso not about this patch: this mixed tabs/spacing formatting feels a\nbit unusual.  I don't know if it's idiomatic for perl, and if it is\nthen no complaints; it just stood out a little.  Can\nDocumentation/CodingGuidelines say something about the preferred\nindentation in Perl to avoid having to think about such questions?\n\n> --- a/perl/Git/LoadCPAN/Error.pm\n> +++ b/perl/Git/LoadCPAN/Error.pm\n> @@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;\n>  use 5.008;\n>  use strict;\n>  use warnings;\n> +use Git::LoadCPAN (\n> +    module => 'Error',\n> +    import => 1,\n> +);\n\nNice!\n\nThanks and hope that helps,\nJonathan\n"},{"id":"339412","messageId":"20180214230359.GD136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-5-avarab@gmail.com","subject":"Re: [PATCH 4/8] perl: update our ancient copy of Error.pm","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T23:03:59Z","receivedAt":"2018-02-14T23:04:08Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> The Error.pm shipped with Git as a fallback if there was no Error.pm\n> on the system was released in April 2006, there's been dozens of\n> releases since then, the latest at August 7, 2017, let's update to\n> that.\n\nComma splices:\n s/, there's/. There's/\n s/, let's/. Let's/\n\nThe one piece of information I was curious about that this (quite clear,\nthank you) commit message is missing is what changed in the intervening\ntime.  Is this just about keeping up with upstream to make it easy to\nkeep up later, or has upstream made any useful changes?  E.g. did any\nAPI or behaviors get better?\n\nRelated: do we have to worry about in-tree users taking advantage of\nimproved API and packagers forgetting to add a dependency on the new\nversion?  Do we declare the minimal required Error.pm version somewhere\n(e.g. in the INSTALL file)?\n\n[...]\n>  perl/Git/FromCPAN/.gitattributes |   1 +\n>  perl/Git/FromCPAN/Error.pm       | 296 +++++++++++++++++++++++++++++++++------\n>  2 files changed, 256 insertions(+), 41 deletions(-)\n>  create mode 100644 perl/Git/FromCPAN/.gitattributes\n\nMost of the added lines are documentation, so this diffstat doesn't look\nhalf-bad.\n\nThanks for writing it.\n\nJonathan\n"},{"id":"339413","messageId":"20180214234630.GE136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-6-avarab@gmail.com","subject":"Re: [PATCH 5/8] perl: update our copy of Mail::Address","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T23:46:30Z","receivedAt":"2018-02-14T23:46:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n> 23, 2018). This should be a trivial update[1] but it seems the version\n> Matthieu Moy imported in bd869f67b9 (\"send-email: add and use a local\n> copy of Mail::Address\", 2018-01-05) doesn't correspond to any 2.19\n> version found on the CPAN. From the comment at the top of the file it\n> looks like some OS version with the POD stripped, and with different\n> indentation.\n\nWere there changes other than the POD stripping?\n\n> Let's instead use the upstream version as-is, and without copyright\n> notices stripped. Like Error.pm this doesn't cleanly pass --check, so\n> add a .gitattributes file to ignore the errors.\n>\n> 1. https://metacpan.org/diff/file?target=MARKOV/MailTools-2.20/lib%2FMail%2FAddress.pod&source=MARKOV%2FMailTools-2.19%2Flib%2FMail%2FAddress.pod\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  perl/Git/FromCPAN/Mail/.gitattributes |   1 +\n>  perl/Git/FromCPAN/Mail/Address.pm     | 436 +++++++++++++---------------------\n>  2 files changed, 163 insertions(+), 274 deletions(-)\n>  create mode 100644 perl/Git/FromCPAN/Mail/.gitattributes\n\nYikes re the stripped POD with license notice. Thanks for fixing it.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"339414","messageId":"20180214234901.GF136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-7-avarab@gmail.com","subject":"Re: [PATCH 6/8] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T23:49:01Z","receivedAt":"2018-02-14T23:49:11Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> The Net::SMTP and Net::Domain were both first released with perl\n> v5.7.3, since my d48b284183 (\"perl: bump the required Perl version to\n> 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's no\n> reason to conditionally require this anymore.\n>\n> This conditional loading was initially added in\n> 87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n> 2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\n> to give real name of the calling host to HELO/EHLO\", 2010-03-14) for\n> Net::Domain, both of which predate the hard dependency on 5.8.\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  git-send-email.perl | 24 +++++++++++-------------\n>  1 file changed, 11 insertions(+), 13 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 85bb6482f2..69bd443245 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1143,10 +1143,9 @@ sub valid_fqdn {\n>  sub maildomain_net {\n>  \tmy $maildomain;\n>  \n> -\tif (eval { require Net::Domain; 1 }) {\n> -\t\tmy $domain = Net::Domain::domainname();\n> -\t\t$maildomain = $domain if valid_fqdn($domain);\n> -\t}\n> +\trequire Net::Domain;\n> +\tmy $domain = Net::Domain::domainname();\n> +\t$maildomain = $domain if valid_fqdn($domain);\n\nNow that we indeed require the module, any reason not to 'use' it?\nE.g. is it particularly expensive to load?\n\nI haven't checked the assertions above about minimal perl versions\nincluding these modules, but I assume they're true. :)  So this looks\nlike a good change.\n\nThanks,\nJonathan\n"},{"id":"339415","messageId":"20180214235256.GG136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-8-avarab@gmail.com","subject":"Re: [PATCH 7/8] gitweb: hard-depend on the Digest::MD5 5.8 module","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T23:52:56Z","receivedAt":"2018-02-14T23:53:08Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  gitweb/INSTALL     |  3 +--\n>  gitweb/gitweb.perl | 17 +++++------------\n>  2 files changed, 6 insertions(+), 14 deletions(-)\n\nMakes sense, and I like the diffstat.\n\n[...]\n> +++ b/gitweb/gitweb.perl\n[...]\n> @@ -1166,18 +1165,11 @@ sub configure_gitweb_features {\n>  \tour @snapshot_fmts = gitweb_get_feature('snapshot');\n>  \t@snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);\n>  \n> -\t# check that the avatar feature is set to a known provider name,\n> -\t# and for each provider check if the dependencies are satisfied.\n> -\t# if the provider name is invalid or the dependencies are not met,\n> -\t# reset $git_avatar to the empty string.\n> +\t# check that the avatar feature is set to a known provider\n> +\t# name, if the provider name is invalid, reset $git_avatar to\n> +\t# the empty string.\n\nComma splice.  Formatting as sentences would make this easier to read,\nanyway:\n\n\t# Check that the avatar feature is set to a known provider name.\n\t# If the provider name is invalid, reset $git_avatar to the empty\n\t# string.\n\nEven better would be to remove the comment altogether.  The code is\nclear enough on its own and the comment should not be needed now that\nit is a one-liner.\n\n[...]\n> @@ -2165,6 +2157,7 @@ sub picon_url {\n>  sub gravatar_url {\n>  \tmy $email = lc shift;\n>  \tmy $size = shift;\n> +\trequire Digest::MD5;\n\nSame question as the previous patch: how do we decide whether to 'use'\nor to 'require' in cases like this?\n\nThanks,\nJonathan\n"},{"id":"339416","messageId":"20180214235404.GH136185@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180214222146.10655-9-avarab@gmail.com","subject":"Re: [PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-14T23:54:04Z","receivedAt":"2018-02-14T23:54:18Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> --- a/perl/Git.pm\n> +++ b/perl/Git.pm\n> @@ -1324,8 +1324,9 @@ sub _temp_cache {\n>  }\n>  \n>  sub _verify_require {\n> -\teval { require File::Temp; require File::Spec; };\n> -\t$@ and throw Error::Simple($@);\n> +\trequire File::Temp;\n> +\trequire File::Spec;\n> +\treturn;\n\nSame question as in the other patches: any reason not to simplify by\nusing 'use' at the top of the file instead?\n\nThanks,\nJonathan\n"},{"id":"339433","messageId":"20180215045301.GC27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"20180214222146.10655-4-avarab@gmail.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-15T04:53:02Z","receivedAt":"2018-02-15T04:53:11Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Hi Ævar,\n\nÆvar Arnfjörð Bjarmason wrote:\n> +Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy\n> +\n> +=head1 DESCRIPTION\n> +\n> +The Perl code in Git depends on some modules from the CPAN, but we\n> +don't want to make those a hard requirement for anyone building from\n> +source.\n> +\n> +Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n> +wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n> +attempt to load C<Module::Name> from the OS, and if that doesn't work\n> +will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n> +itself.\n> +\n> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,\n> +preferring to use their own packaging of CPAN modules instead.\n\nThis is something I wondered about.  What's the recommended\nmethod to ensure git packaged for an OS/distribution doesn't\never use the fallbacks?  Remove $perllibdir/Git/FromCPAN\nafter make install?\n\nIf so, would it be useful to add a Makefile knob to not\ninstall the FromCPAN bits, which may be generally useful to\npackagers?\n\nSomething like the following, perhaps?\n\n(I'd feel bad suggesting this without a patch, after all the\nwork you've already done to simplify and improve the perl\nbits.)\n\n---- 8< ----\nFrom: Todd Zullinger <tmz@pobox.com>\nDate: Wed, 14 Feb 2018 23:00:30 -0500\nSubject: [PATCH] Makefile: add NO_PERL_CPAN to disable fallback module install\n\nAs noted in perl/Git/LoadCPAN.pm, operating system packages often don't\nwant to ship Git::FromCPAN tree at all, preferring to use their own\npackaging of CPAN modules instead.  Allow such packagers to set\nNO_PERL_CPAN to easily avoid installing these fallback perl CPAN\nmodules.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\n---\n Makefile | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 5bcd83ddf3..c4e035e5bf 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,9 @@ all::\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n+# Define NO_PERL_CPAN if you do not want to install fallbacks for perl CPAN\n+# modules.\n+#\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n # but /usr/bin/python2.7 on some platforms).\n #\n@@ -2572,6 +2575,7 @@ ifndef NO_GETTEXT\n endif\n ifndef NO_PERL\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n+\ttest -z \"$(NO_PERL_CPAN)\" || rm -rf perl/build/lib/Git/FromCPAN\n \t(cd perl/build/lib && $(TAR) cf - .) | \\\n \t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n \t$(MAKE) -C gitweb install\n-- \n2.16.1\n\nI don't particularly like NO_PERL_CPAN, but I'm confident\nsomeone else will suggest an obviously better name.\n\nI thought about moving the 'rm -rf Git/FromCPAN' after the\ntar/untar, to keep the files in place for the tests.  No\ntests seem to rely on those local files, so I stuck with\nremoving them before.  That diff was:\n\n--- a/Makefile\n+++ b/Makefile\n@@ -2574,6 +2574,7 @@\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n \t(cd perl/build/lib && $(TAR) cf - .) | \\\n \t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n+\ttest -n \"$(NO_PERL_CPAN)\" && rm -rf '$(DESTDIR_SQ)$(perllibdir_SQ)'/Git/FromCPAN\n \t$(MAKE) -C gitweb install\n endif\n ifndef NO_TCLTK\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nMan has made use of his intelligence, he invented stupidity.\n    -- Remy De Gourmant\n\n"},{"id":"339435","messageId":"20180215050909.GD27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"20180214225754.GC136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-15T05:09:10Z","receivedAt":"2018-02-15T05:09:18Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n> [...]\n>> +++ b/perl/Git/LoadCPAN.pm\n>> @@ -0,0 +1,74 @@\n> [...]\n>> +The Perl code in Git depends on some modules from the CPAN, but we\n>> +don't want to make those a hard requirement for anyone building from\n>> +source.\n> \n> not about this patch: have we considered making it a hard requirement?\n> Both Mail::Address and Error.pm are pretty widely available, and I\n> wonder if we could make the instructions in the INSTALL file say that\n> they are required dependencies to simplify things.\n> \n> I admit part of my bias here is coming from the distro world, where we\n> have to do extra work to get rid of the FromCPAN embedded copies and\n> would be happier not to have to.\n\nHeh, a similar bias is what led me to suggest a Makefile\nknob to prevent installing the fallbacks.  I neglected to\nadd you to the Cc list on that reply.  But I was thinking of\nDebian and other distributions whom I know would similarly\nwant to exclude Git/FromCPAN from their git packages.  I\nknow it's a simple rm, but it might as well be a simple rm\nin one place than spread across each package.  :)\n\nIt may still be worth considering whether it's reasonable to\nmake Mail::Address and Error.pm hard requirements, but I'm\nnot sure if there are any platforms where such a requirement\nwould be a pain.  If there are folks here who are happy to\nmaintain this fallback method, then a simple Makefile knob\ngives us the best of both worlds.\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nHistorian, n. A broad-gauge gossip.\n    -- Ambrose Bierce, \"The Devil's Dictionary\"\n\n"},{"id":"339454","messageId":"1227220836.729681.1518687134631.JavaMail.zimbra@matthieu-moy.fr","threadId":"47849","inReplyTo":"20180214234630.GE136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 5/8] perl: update our copy of Mail::Address","fromName":"Matthieu Moy","fromEmail":"git@matthieu-moy.fr","sentAt":"2018-02-15T09:32:14Z","receivedAt":"2018-02-15T09:58:03Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Jonathan Nieder\" <jrnieder@gmail.com> wrote:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>\n> > Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n> > 23, 2018). This should be a trivial update[1] but it seems the version\n> > Matthieu Moy imported in bd869f67b9 (\"send-email: add and use a local\n> > copy of Mail::Address\", 2018-01-05) doesn't correspond to any 2.19\n> > version found on the CPAN. From the comment at the top of the file it\n> > looks like some OS version with the POD stripped, and with different\n> > indentation.\n>\n> Were there changes other than the POD stripping?\n\nNo.\n\nI should have mentionned it in the commit message, but the one I took was\nfrom:\n\n  http://cpansearch.perl.org/src/MARKOV/MailTools-2.19/lib/Mail/Address.pm\n\ni.e. following the \"source\" link from:\n\n  http://search.cpan.org/~markov/MailTools-2.19/lib/Mail/Address.pod\n\nThe link name suggested it was the actual source code but indeed it's a\npre-processed file with the POD stripped.\n\nIt would make sense to indicate explicitly where this file is from in\nthis commit's message to avoid having the same discussion next time someone\nupgrades the package.\n\n-- \nMatthieu Moy\nhttps://matthieu-moy.fr/\n"},{"id":"339498","messageId":"87tvuif10e.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"1227220836.729681.1518687134631.JavaMail.zimbra@matthieu-moy.fr","subject":"Re: [PATCH 5/8] perl: update our copy of Mail::Address","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T20:31:29Z","receivedAt":"2018-02-15T20:31:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Feb 15 2018, Matthieu Moy jotted:\n\n> \"Jonathan Nieder\" <jrnieder@gmail.com> wrote:\n>\n>> Ævar Arnfjörð Bjarmason wrote:\n>>\n>> > Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n>> > 23, 2018). This should be a trivial update[1] but it seems the version\n>> > Matthieu Moy imported in bd869f67b9 (\"send-email: add and use a local\n>> > copy of Mail::Address\", 2018-01-05) doesn't correspond to any 2.19\n>> > version found on the CPAN. From the comment at the top of the file it\n>> > looks like some OS version with the POD stripped, and with different\n>> > indentation.\n>>\n>> Were there changes other than the POD stripping?\n>\n> No.\n>\n> I should have mentionned it in the commit message, but the one I took was\n> from:\n>\n>   http://cpansearch.perl.org/src/MARKOV/MailTools-2.19/lib/Mail/Address.pm\n>\n> i.e. following the \"source\" link from:\n>\n>   http://search.cpan.org/~markov/MailTools-2.19/lib/Mail/Address.pod\n>\n> The link name suggested it was the actual source code but indeed it's a\n> pre-processed file with the POD stripped.\n>\n> It would make sense to indicate explicitly where this file is from in\n> this commit's message to avoid having the same discussion next time someone\n> upgrades the package.\n\nI see that I'm being a complete idiot and added the *.pod file in the\ndistro instead of the *.pm file, I got it from metacpan and didn't check\nit carefully enough (and only tested with system Error.pm removed, not\nMail::Address), sorry. So yours was the right version. Will fix in a\nre-roll.\n"},{"id":"339499","messageId":"87sha2f0j1.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180215045301.GC27038@zaya.teonanacatl.net","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T20:41:54Z","receivedAt":"2018-02-15T20:42:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Feb 15 2018, Todd Zullinger jotted:\n\n> Hi Ævar,\n>\n> Ævar Arnfjörð Bjarmason wrote:\n>> +Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy\n>> +\n>> +=head1 DESCRIPTION\n>> +\n>> +The Perl code in Git depends on some modules from the CPAN, but we\n>> +don't want to make those a hard requirement for anyone building from\n>> +source.\n>> +\n>> +Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n>> +wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n>> +attempt to load C<Module::Name> from the OS, and if that doesn't work\n>> +will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n>> +itself.\n>> +\n>> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,\n>> +preferring to use their own packaging of CPAN modules instead.\n>\n> This is something I wondered about.  What's the recommended\n> method to ensure git packaged for an OS/distribution doesn't\n> ever use the fallbacks?  Remove $perllibdir/Git/FromCPAN\n> after make install?\n>\n> If so, would it be useful to add a Makefile knob to not\n> install the FromCPAN bits, which may be generally useful to\n> packagers?\n>\n> Something like the following, perhaps?\n>\n> (I'd feel bad suggesting this without a patch, after all the\n> work you've already done to simplify and improve the perl\n> bits.)\n>\n> ---- 8< ----\n> From: Todd Zullinger <tmz@pobox.com>\n> Date: Wed, 14 Feb 2018 23:00:30 -0500\n> Subject: [PATCH] Makefile: add NO_PERL_CPAN to disable fallback module install\n>\n> As noted in perl/Git/LoadCPAN.pm, operating system packages often don't\n> want to ship Git::FromCPAN tree at all, preferring to use their own\n> packaging of CPAN modules instead.  Allow such packagers to set\n> NO_PERL_CPAN to easily avoid installing these fallback perl CPAN\n> modules.\n>\n> Signed-off-by: Todd Zullinger <tmz@pobox.com>\n> ---\n>  Makefile | 4 ++++\n>  1 file changed, 4 insertions(+)\n>\n> diff --git a/Makefile b/Makefile\n> index 5bcd83ddf3..c4e035e5bf 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -296,6 +296,9 @@ all::\n>  #\n>  # Define NO_PERL if you do not want Perl scripts or libraries at all.\n>  #\n> +# Define NO_PERL_CPAN if you do not want to install fallbacks for perl CPAN\n> +# modules.\n> +#\n>  # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n>  # but /usr/bin/python2.7 on some platforms).\n>  #\n> @@ -2572,6 +2575,7 @@ ifndef NO_GETTEXT\n>  endif\n>  ifndef NO_PERL\n>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n> +\ttest -z \"$(NO_PERL_CPAN)\" || rm -rf perl/build/lib/Git/FromCPAN\n>  \t(cd perl/build/lib && $(TAR) cf - .) | \\\n>  \t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n>  \t$(MAKE) -C gitweb install\n> --\n> 2.16.1\n>\n> I don't particularly like NO_PERL_CPAN, but I'm confident\n> someone else will suggest an obviously better name.\n>\n> I thought about moving the 'rm -rf Git/FromCPAN' after the\n> tar/untar, to keep the files in place for the tests.  No\n> tests seem to rely on those local files, so I stuck with\n> removing them before.  That diff was:\n>\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -2574,6 +2574,7 @@\n>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'\n>  \t(cd perl/build/lib && $(TAR) cf - .) | \\\n>  \t(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)\n> +\ttest -n \"$(NO_PERL_CPAN)\" && rm -rf '$(DESTDIR_SQ)$(perllibdir_SQ)'/Git/FromCPAN\n>  \t$(MAKE) -C gitweb install\n>  endif\n>  ifndef NO_TCLTK\n\nThat makes sense, I'll incorporate that in a re-roll. I like\nNO_PERL_CPAN_FALLBACKS or just NO_CPAN_FALLBACKS better.\n\nI'd really like to find some solution that works differently though,\nbecause with this approach we'll run the full test suite against a\nsystem where our fallbacks will be in place (although if the OS\ndistributor has done as promised we won't use them), and then just\nremove this at 'make install' time, also meaning we'll re-gen it before\nrunning 'make install' again, only to rm it again.\n\nThe former issue we could deal with by munging the Git::LoadCPAN file so\nit knows about NO_PERL_CPAN_FALLBACKS, and will always refuse to use the\nfallbacks if that's set. That's a good idea anyway, because right now if\nyou e.g. uninstall Error.pm on Debian (which strips the CPAN fallbacks)\nyou get a cryptic \"BUG: ...\" message, it should instead say \"we couldn't\nget this module the OS promised we'd have\" or something to that effect.\n\nThe latter is trickier, I don't see an easy way to coerce the Makefile\ninto not copying the FromCPAN directory without going back to a\nhardcoded list again, the easiest thing is probably to turn that:\n\n    $(TAR) cf - .)\n\nInto:\n\n    $(TAR) cf - $(find ... -not ....)\n\nOr something like that to get all the stuff that isn't the Git/FromCPAN\ndirectory.\n\nOther suggestions most welcome.\n"},{"id":"339500","messageId":"87r2pmf0hs.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180214235404.GH136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T20:42:39Z","receivedAt":"2018-02-15T20:42:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 14 2018, Jonathan Nieder jotted:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> --- a/perl/Git.pm\n>> +++ b/perl/Git.pm\n>> @@ -1324,8 +1324,9 @@ sub _temp_cache {\n>>  }\n>>\n>>  sub _verify_require {\n>> -\teval { require File::Temp; require File::Spec; };\n>> -\t$@ and throw Error::Simple($@);\n>> +\trequire File::Temp;\n>> +\trequire File::Spec;\n>> +\treturn;\n>\n> Same question as in the other patches: any reason not to simplify by\n> using 'use' at the top of the file instead?\n\nI was just going for the minimal change, but yeah, that makes\nsense. Will do that in v2.\n"},{"id":"339502","messageId":"87po56f0fm.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180214234901.GF136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 6/8] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T20:43:57Z","receivedAt":"2018-02-15T20:44:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 14 2018, Jonathan Nieder jotted:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> The Net::SMTP and Net::Domain were both first released with perl\n>> v5.7.3, since my d48b284183 (\"perl: bump the required Perl version to\n>> 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's no\n>> reason to conditionally require this anymore.\n>>\n>> This conditional loading was initially added in\n>> 87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n>> 2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\n>> to give real name of the calling host to HELO/EHLO\", 2010-03-14) for\n>> Net::Domain, both of which predate the hard dependency on 5.8.\n>>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>>  git-send-email.perl | 24 +++++++++++-------------\n>>  1 file changed, 11 insertions(+), 13 deletions(-)\n>>\n>> diff --git a/git-send-email.perl b/git-send-email.perl\n>> index 85bb6482f2..69bd443245 100755\n>> --- a/git-send-email.perl\n>> +++ b/git-send-email.perl\n>> @@ -1143,10 +1143,9 @@ sub valid_fqdn {\n>>  sub maildomain_net {\n>>  \tmy $maildomain;\n>>\n>> -\tif (eval { require Net::Domain; 1 }) {\n>> -\t\tmy $domain = Net::Domain::domainname();\n>> -\t\t$maildomain = $domain if valid_fqdn($domain);\n>> -\t}\n>> +\trequire Net::Domain;\n>> +\tmy $domain = Net::Domain::domainname();\n>> +\t$maildomain = $domain if valid_fqdn($domain);\n>\n> Now that we indeed require the module, any reason not to 'use' it?\n> E.g. is it particularly expensive to load?\n>\n> I haven't checked the assertions above about minimal perl versions\n> including these modules, but I assume they're true. :)  So this looks\n> like a good change.\n\nFWIW this is easily found out for any given module by running `corelist\n<module name>` on a system with perl installed:\n\n    $ corelist File::Spec\n    Data for 2017-01-14\n    File::Spec was first released with perl 5.00405\n"},{"id":"339503","messageId":"87o9kqf0b9.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180214230359.GD136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 4/8] perl: update our ancient copy of Error.pm","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T20:46:34Z","receivedAt":"2018-02-15T20:46:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 14 2018, Jonathan Nieder jotted:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> The Error.pm shipped with Git as a fallback if there was no Error.pm\n>> on the system was released in April 2006, there's been dozens of\n>> releases since then, the latest at August 7, 2017, let's update to\n>> that.\n>\n> Comma splices:\n>  s/, there's/. There's/\n>  s/, let's/. Let's/\n>\n> The one piece of information I was curious about that this (quite clear,\n> thank you) commit message is missing is what changed in the intervening\n> time.  Is this just about keeping up with upstream to make it easy to\n> keep up later, or has upstream made any useful changes?  E.g. did any\n> API or behaviors get better?\n\nWill note that in v2, nothing we need changed, this is just a matter of\nkeeping up, and e.g. if I run Git on Debian I get a few month old\nError.pm, but if I build Git from source I get one that's more than a\ndecade old.\n\n> Related: do we have to worry about in-tree users taking advantage of\n> improved API and packagers forgetting to add a dependency on the new\n> version?  Do we declare the minimal required Error.pm version somewhere\n> (e.g. in the INSTALL file)?\n\nWe don't, but if that situation arises we could just start doing 'use\n<module> <version>' to declare it, see \"perldoc -f use\", but right now\nwe work on seemingly every version of these modules ever released.\n"},{"id":"339506","messageId":"20180215212338.GL27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"87sha2f0j1.fsf@evledraar.gmail.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-15T21:23:38Z","receivedAt":"2018-02-15T21:23:50Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"[I dropped bbourbie@slb.com from the Cc: list, as it bounced\non my previous reply.]\n\nÆvar Arnfjörð Bjarmason wrote:\n> That makes sense, I'll incorporate that in a re-roll. I like\n> NO_PERL_CPAN_FALLBACKS or just NO_CPAN_FALLBACKS better.\n\nEither is an improvement.  Starting with NO_PERL_ seems\nlike a slightly better bikeshed color. :)\n\n> I'd really like to find some solution that works differently though,\n> because with this approach we'll run the full test suite against a\n> system where our fallbacks will be in place (although if the OS\n> distributor has done as promised we won't use them), and then just\n> remove this at 'make install' time, also meaning we'll re-gen it before\n> running 'make install' again, only to rm it again.\n> \n> The former issue we could deal with by munging the Git::LoadCPAN file so\n> it knows about NO_PERL_CPAN_FALLBACKS, and will always refuse to use the\n> fallbacks if that's set. That's a good idea anyway, because right now if\n> you e.g. uninstall Error.pm on Debian (which strips the CPAN fallbacks)\n> you get a cryptic \"BUG: ...\" message, it should instead say \"we couldn't\n> get this module the OS promised we'd have\" or something to that effect.\n\nTeaching Git::LoadCPAN to never fallback sounds like a good\nidea.  At least then if the packager intended to avoid the\nfallbacks and didn't get it right the error message could be\nmore useful.\n\nHopefully that's not a common problem for packagers though.\n(And adding the Makefile knob was intended to help make it\neasier for packagers to achieve this common goal.)\n\n> The latter is trickier, I don't see an easy way to coerce the Makefile\n> into not copying the FromCPAN directory without going back to a\n> hardcoded list again, the easiest thing is probably to turn that:\n> \n>     $(TAR) cf - .)\n> \n> Into:\n> \n>     $(TAR) cf - $(find ... -not ....)\n> \n> Or something like that to get all the stuff that isn't the Git/FromCPAN\n> directory.\n> \n> Other suggestions most welcome.\n\nWhat about moving perl/Git/FromCPAN to perl/FromCPAN and\nthen including perl/FromCPAN in LIB_PERL{,_GEN} only if\nNO_PERL_CPAN_FALLBACKS is unset?\n\n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n+ifndef NO_PERL_CPAN_FALLBACKS\n+LIB_PERL += $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n+endif\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n\nI haven't tested that at all, so it could be broken in many\nways.\n\nThanks,\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe nice thing about egotists is that they don't talk about other\npeople.\n    -- Lucille S. Harper\n\n"},{"id":"339508","messageId":"xmqqd1167xas.fsf@gitster-ct.c.googlers.com","threadId":"47849","inReplyTo":"87r2pmf0hs.fsf@evledraar.gmail.com","subject":"Re: [PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-15T21:33:31Z","receivedAt":"2018-02-15T21:33:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Wed, Feb 14 2018, Jonathan Nieder jotted:\n>\n>> Ævar Arnfjörð Bjarmason wrote:\n>>\n>>> --- a/perl/Git.pm\n>>> +++ b/perl/Git.pm\n>>> @@ -1324,8 +1324,9 @@ sub _temp_cache {\n>>>  }\n>>>\n>>>  sub _verify_require {\n>>> -\teval { require File::Temp; require File::Spec; };\n>>> -\t$@ and throw Error::Simple($@);\n>>> +\trequire File::Temp;\n>>> +\trequire File::Spec;\n>>> +\treturn;\n>>\n>> Same question as in the other patches: any reason not to simplify by\n>> using 'use' at the top of the file instead?\n>\n> I was just going for the minimal change, but yeah, that makes\n> sense. Will do that in v2.\n\nYes, if we are making them hard dependency, unless a major part of\nthe perl/Git.pm can be used without hitting _verify_require in the\ncurrent code, there is no point using \"require only if we use it\"\npattern.  As _verify_require is used even in the Git::repository\nconstructor, I think it makes more sense to have \"use\" upfront for\nthese two modules.\n\n"},{"id":"339536","messageId":"87k1vdf188.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180215212338.GL27038@zaya.teonanacatl.net","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-16T14:39:03Z","receivedAt":"2018-02-16T14:39:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Feb 15 2018, Todd Zullinger jotted:\n\n> [I dropped bbourbie@slb.com from the Cc: list, as it bounced\n> on my previous reply.]\n>\n> Ævar Arnfjörð Bjarmason wrote:\n>> That makes sense, I'll incorporate that in a re-roll. I like\n>> NO_PERL_CPAN_FALLBACKS or just NO_CPAN_FALLBACKS better.\n>\n> Either is an improvement.  Starting with NO_PERL_ seems\n> like a slightly better bikeshed color. :)\n>\n>> I'd really like to find some solution that works differently though,\n>> because with this approach we'll run the full test suite against a\n>> system where our fallbacks will be in place (although if the OS\n>> distributor has done as promised we won't use them), and then just\n>> remove this at 'make install' time, also meaning we'll re-gen it before\n>> running 'make install' again, only to rm it again.\n>>\n>> The former issue we could deal with by munging the Git::LoadCPAN file so\n>> it knows about NO_PERL_CPAN_FALLBACKS, and will always refuse to use the\n>> fallbacks if that's set. That's a good idea anyway, because right now if\n>> you e.g. uninstall Error.pm on Debian (which strips the CPAN fallbacks)\n>> you get a cryptic \"BUG: ...\" message, it should instead say \"we couldn't\n>> get this module the OS promised we'd have\" or something to that effect.\n>\n> Teaching Git::LoadCPAN to never fallback sounds like a good\n> idea.  At least then if the packager intended to avoid the\n> fallbacks and didn't get it right the error message could be\n> more useful.\n>\n> Hopefully that's not a common problem for packagers though.\n> (And adding the Makefile knob was intended to help make it\n> easier for packagers to achieve this common goal.)\n>\n>> The latter is trickier, I don't see an easy way to coerce the Makefile\n>> into not copying the FromCPAN directory without going back to a\n>> hardcoded list again, the easiest thing is probably to turn that:\n>>\n>>     $(TAR) cf - .)\n>>\n>> Into:\n>>\n>>     $(TAR) cf - $(find ... -not ....)\n>>\n>> Or something like that to get all the stuff that isn't the Git/FromCPAN\n>> directory.\n>>\n>> Other suggestions most welcome.\n>\n> What about moving perl/Git/FromCPAN to perl/FromCPAN and\n> then including perl/FromCPAN in LIB_PERL{,_GEN} only if\n> NO_PERL_CPAN_FALLBACKS is unset?\n>\n>  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n> +ifndef NO_PERL_CPAN_FALLBACKS\n> +LIB_PERL += $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n> +endif\n>  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n>\n> I haven't tested that at all, so it could be broken in many\n> ways.\n\nYes that's a much better idea, it evades the whole problem of conflating\nthe perl/Git* glob.\n"},{"id":"339560","messageId":"20180216175519.GQ27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"87k1vdf188.fsf@evledraar.gmail.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-16T17:55:19Z","receivedAt":"2018-02-16T17:55:31Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> On Thu, Feb 15 2018, Todd Zullinger jotted:\n>> What about moving perl/Git/FromCPAN to perl/FromCPAN and\n>> then including perl/FromCPAN in LIB_PERL{,_GEN} only if\n>> NO_PERL_CPAN_FALLBACKS is unset?\n>>\n>>  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n>> +ifndef NO_PERL_CPAN_FALLBACKS\n>> +LIB_PERL += $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n>> +endif\n>>  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n>>\n>> I haven't tested that at all, so it could be broken in many\n>> ways.\n> \n> Yes that's a much better idea, it evades the whole problem of conflating\n> the perl/Git* glob.\n\nI did test this yesterday and it seems to work well.  Here\nit is in patch form, in case it's helpful to you for the\nnext version.  It might well be better as part of a commit\nteaching Git::LoadCPAN to respect NO_PERL_CPAN_FALLBACKS.\n\n---- 8< ----\nFrom: Todd Zullinger <tmz@pobox.com>\nSubject: [PATCH] Makefile: add NO_PERL_CPAN_FALLBACKS to disable fallback\n module install\n\nAs noted in perl/Git/LoadCPAN.pm, operating system packages often don't\nwant to ship Git::FromCPAN tree at all, preferring to use their own\npackaging of CPAN modules instead.  Allow such packagers to set\nNO_PERL_CPAN_FALLBACKS to easily avoid installing these fallback perl\nCPAN modules.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\n---\n Makefile                                    | 6 ++++++\n perl/{Git => }/FromCPAN/.gitattributes      | 0\n perl/{Git => }/FromCPAN/Error.pm            | 0\n perl/{Git => }/FromCPAN/Mail/.gitattributes | 0\n perl/{Git => }/FromCPAN/Mail/Address.pm     | 0\n 5 files changed, 6 insertions(+)\n rename perl/{Git => }/FromCPAN/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Error.pm (100%)\n rename perl/{Git => }/FromCPAN/Mail/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 5bcd83ddf3..838b3c6393 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,9 @@ all::\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n+# Define NO_PERL_CPAN_FALLBACKS if you do not want to install fallbacks for\n+# perl CPAN modules.\n+#\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n # but /usr/bin/python2.7 on some platforms).\n #\n@@ -2297,6 +2300,9 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n \n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n+ifndef NO_PERL_CPAN_FALLBACKS\n+LIB_PERL += $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n+endif\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n \n ifndef NO_PERL\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/FromCPAN/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/.gitattributes\nrename to perl/FromCPAN/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Error.pm\nrename to perl/FromCPAN/Error.pm\ndiff --git a/perl/Git/FromCPAN/Mail/.gitattributes b/perl/FromCPAN/Mail/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/.gitattributes\nrename to perl/FromCPAN/Mail/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/FromCPAN/Mail/Address.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/Address.pm\nrename to perl/FromCPAN/Mail/Address.pm\n-- \n2.16.1\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nDamn you and your estrogenical treachery!\n    -- Stewie Griffin\n\n"},{"id":"339583","messageId":"20180216220300.GC216564@aiede.svl.corp.google.com","threadId":"47849","inReplyTo":"20180216175519.GQ27038@zaya.teonanacatl.net","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-16T22:03:00Z","receivedAt":"2018-02-16T22:03:10Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nTodd Zullinger wrote:\n\n> Subject: [PATCH] Makefile: add NO_PERL_CPAN_FALLBACKS to disable fallback module install\n>\n> As noted in perl/Git/LoadCPAN.pm, operating system packages often don't\n> want to ship Git::FromCPAN tree at all, preferring to use their own\n> packaging of CPAN modules instead.  Allow such packagers to set\n> NO_PERL_CPAN_FALLBACKS to easily avoid installing these fallback perl\n> CPAN modules.\n>\n> Signed-off-by: Todd Zullinger <tmz@pobox.com>\n> ---\n>  Makefile                                    | 6 ++++++\n>  perl/{Git => }/FromCPAN/.gitattributes      | 0\n>  perl/{Git => }/FromCPAN/Error.pm            | 0\n>  perl/{Git => }/FromCPAN/Mail/.gitattributes | 0\n>  perl/{Git => }/FromCPAN/Mail/Address.pm     | 0\n>  5 files changed, 6 insertions(+)\n>  rename perl/{Git => }/FromCPAN/.gitattributes (100%)\n>  rename perl/{Git => }/FromCPAN/Error.pm (100%)\n>  rename perl/{Git => }/FromCPAN/Mail/.gitattributes (100%)\n>  rename perl/{Git => }/FromCPAN/Mail/Address.pm (100%)\n\nNice!  I like it.\n\n[...]\n> +++ b/Makefile\n> @@ -296,6 +296,9 @@ all::\n>  #\n>  # Define NO_PERL if you do not want Perl scripts or libraries at all.\n>  #\n> +# Define NO_PERL_CPAN_FALLBACKS if you do not want to install fallbacks for\n> +# perl CPAN modules.\n\nnit: Looking at this as a naive user, it's not obvious what kind of\nfallbacks are meant. How about:\n\n\tDefine NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n\tcopies of CPAN modules that serve as a fallback in case the modules are\n\tnot available on the system.\n\nOr perhaps:\n\n\tDefine HAVE_CPAN_MODULES if you have Error.pm and Mail::Address installed\n\tand do not want to install the fallback copies from perl/FromCPAN.\n\nWould this patch need to update the loader to expect the modules in\nthe new location?\n\nThanks,\nJonathan\n"},{"id":"339586","messageId":"20180217004753.GS27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"20180216220300.GC216564@aiede.svl.corp.google.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-17T00:47:54Z","receivedAt":"2018-02-17T00:48:01Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder wrote:\n> Todd Zullinger wrote:\n[...]\n>> +++ b/Makefile\n>> @@ -296,6 +296,9 @@ all::\n>>  #\n>>  # Define NO_PERL if you do not want Perl scripts or libraries at all.\n>>  #\n>> +# Define NO_PERL_CPAN_FALLBACKS if you do not want to install fallbacks for\n>> +# perl CPAN modules.\n> \n> nit: Looking at this as a naive user, it's not obvious what kind of\n> fallbacks are meant. How about:\n> \n> \tDefine NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n> \tcopies of CPAN modules that serve as a fallback in case the modules are\n> \tnot available on the system.\n> \n> Or perhaps:\n> \n> \tDefine HAVE_CPAN_MODULES if you have Error.pm and Mail::Address installed\n> \tand do not want to install the fallback copies from perl/FromCPAN.\n\nHmm, a positive variable like HAVE_CPAN_MODULES is\nappealing.\n\nI don't know about listing the modules, as those seem likely\nto change and then the comment becomes stale.  It's nice to\nhave a shorter name.  I could easily go back and forth.\nHopefully some other folks will chime in with preferences.\n\n> Would this patch need to update the loader to expect the modules in\n> the new location?\n\nThat's a good catch.  In checking how this ends up when not\nsetting NO_PERL_CPAN_FALLBACKS, we end up installing\nFromCPAN at the root of $perllibdir rather than under the\nGit dir.\n\nWhile we could probably fix Git::LoadCPAN, I doubt we want\nto pollute the namespace. ;) So we'll want to ensure the\nfiles get put in the right place from the start.  I'll try\nto fix that up.\n\nThanks for the careful eyes, as usual.\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nHappiness is like peeing on yourself. Everyone can see it, but only\nyou can feel its warmth\n\n"},{"id":"339589","messageId":"20180217054052.GU27038@zaya.teonanacatl.net","threadId":"47849","inReplyTo":"20180217004753.GS27038@zaya.teonanacatl.net","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2018-02-17T05:40:52Z","receivedAt":"2018-02-17T05:41:03Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"I wrote:\n> Hi Jonathan,\n> \n> Jonathan Nieder wrote:\n>> Todd Zullinger wrote:\n> [...]\n>>> +++ b/Makefile\n>>> @@ -296,6 +296,9 @@ all::\n>>>  #\n>>>  # Define NO_PERL if you do not want Perl scripts or libraries at all.\n>>>  #\n>>> +# Define NO_PERL_CPAN_FALLBACKS if you do not want to install fallbacks for\n>>> +# perl CPAN modules.\n>> \n>> nit: Looking at this as a naive user, it's not obvious what kind of\n>> fallbacks are meant. How about:\n>> \n>> \tDefine NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n>> \tcopies of CPAN modules that serve as a fallback in case the modules are\n>> \tnot available on the system.\n>> \n>> Or perhaps:\n>> \n>> \tDefine HAVE_CPAN_MODULES if you have Error.pm and Mail::Address installed\n>> \tand do not want to install the fallback copies from perl/FromCPAN.\n> \n> Hmm, a positive variable like HAVE_CPAN_MODULES is\n> appealing.\n> \n> I don't know about listing the modules, as those seem likely\n> to change and then the comment becomes stale.  It's nice to\n> have a shorter name.  I could easily go back and forth.\n> Hopefully some other folks will chime in with preferences.\n> \n>> Would this patch need to update the loader to expect the modules in\n>> the new location?\n> \n> That's a good catch.  In checking how this ends up when not\n> setting NO_PERL_CPAN_FALLBACKS, we end up installing\n> FromCPAN at the root of $perllibdir rather than under the\n> Git dir.\n> \n> While we could probably fix Git::LoadCPAN, I doubt we want\n> to pollute the namespace. ;) So we'll want to ensure the\n> files get put in the right place from the start.  I'll try\n> to fix that up.\n\nI ended up adding a second variable to hold the FromCPAN\nwildcard match, as I couldn't come up with any clean way to\ndo it in the same LIB_PERL{,_GEN} vars.\n\nI tested it with and without NO_PERL_CPAN_FALLBACKS set and\nwith and without the system Error and Mail::Address modules\ninstalled.  There's nothing which automatically removes the\nperl/build/lib/Git/FromCPAN tree if make was run without\nNO_PERL_CPAN_FALLBACKS set and then re-run with it.  I don't\nknow if that's something we'd care to support or not.  I\nsuspect it's simpler to require 'make clean' between such\nruns.\n\n(I had to restore the FromCPAN copy of Address.pm, as noted\nin <87tvuif10e.fsf@evledraar.gmail.com>, of course.)\n\nHere's what it looks like now (still subject to changing the\nNO_PERL_CPAN_FALLBACKS variable).\n\n---- 8> ----\nFrom: Todd Zullinger <tmz@pobox.com>\nSubject: [PATCH] Makefile: add NO_PERL_CPAN_FALLBACKS knob\n\nWe include some perl modules which are not part of the core perl\ninstall, as a convenience.  This allows us to rely on those modules in\nour perl-based tools and scripts without requiring users to install the\nmodules from CPAN or their operating system packages.\n\nUsers whose operating system provides these modules and packagers of Git\noften don't want to ship or use these bundled modules.  Allow these\nusers to set NO_PERL_CPAN_FALLBACKS to avoid installing the bundled\nmodules.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\n---\n Makefile                                    | 14 ++++++++++++++\n perl/{Git => }/FromCPAN/.gitattributes      |  0\n perl/{Git => }/FromCPAN/Error.pm            |  0\n perl/{Git => }/FromCPAN/Mail/.gitattributes |  0\n perl/{Git => }/FromCPAN/Mail/Address.pm     |  0\n 5 files changed, 14 insertions(+)\n rename perl/{Git => }/FromCPAN/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Error.pm (100%)\n rename perl/{Git => }/FromCPAN/Mail/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (100%)\n\ndiff --git a/Makefile b/Makefile\nindex bdd50069af..49244fb116 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,10 @@ all::\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n+# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n+# copies of CPAN modules that serve as a fallback in case the modules are\n+# not available on the system.\n+#\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n # but /usr/bin/python2.7 on some platforms).\n #\n@@ -2300,15 +2304,25 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n+ifndef NO_PERL_CPAN_FALLBACKS\n+LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n+LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/Git/%.pm,$(LIB_CPAN))\n+endif\n \n ifndef NO_PERL\n all:: $(LIB_PERL_GEN)\n+ifndef NO_PERL_CPAN_FALLBACKS\n+all:: $(LIB_CPAN_GEN)\n+endif\n endif\n \n perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n \tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n \n+perl/build/lib/Git/FromCPAN/%.pm: perl/FromCPAN/%.pm\n+\t$(QUIET_GEN)mkdir -p $(dir $@) && cp $< $@\n+\n perl/build/man/man3/Git.3pm: perl/Git.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n \tpod2man $< $@\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/FromCPAN/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/.gitattributes\nrename to perl/FromCPAN/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Error.pm\nrename to perl/FromCPAN/Error.pm\ndiff --git a/perl/Git/FromCPAN/Mail/.gitattributes b/perl/FromCPAN/Mail/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/.gitattributes\nrename to perl/FromCPAN/Mail/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/FromCPAN/Mail/Address.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/Address.pm\nrename to perl/FromCPAN/Mail/Address.pm\n-- \n2.16.2\n\nI thought about using '$(INSTALL) -m 644' instead of 'cp' to\nallow users to set 'INSTALL = install -p' to preserve the\ntimestamp of the FromCPAN files, but that would only be\nuseful to users installing from the same tarball version\nmultiple times.  The intersection of users who care that\nmuch about consistent timestamps and don't care about using\nsystem perl modules seems small.\n\n-- \nTodd\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nA person who smiles in the face of adversity ... probably has a\nscapegoat.\n\n"},{"id":"340210","messageId":"87sh9oew4d.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180214225754.GC136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T18:56:34Z","receivedAt":"2018-02-25T18:56:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 14 2018, Jonathan Nieder jotted:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> Change the two wrappers to load from CPAN (local OS) or our own copy\n>> to do so via the same codepath.\n>\n> nit: I think with s/to load/that load/ this will be easier to read.\n>\n>> I added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\n>> perl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\n>> afterwards Matthieu Moy added a wrapper for Mail::Address in\n>> bd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n>> 2018-01-05).\n>>\n>> His was simpler since Mail::Address doesn't have an \"import\" method,\n>> but didn't do the same sanity checking, e.g. a missing FromCPAN\n>> directory (which OS packages are likely not to have) wouldn't be\n>> explicitly warned about.\n>\n> I'm having trouble parsing this.  Mail::Address didn't do the same\n> sanity checking or his didn't?\n>\n> The comma before e.g. should be a period or semicolon, since it's\n> starting a new independent clause.\n>\n>> Now both use a modification of the previously Error.pm-specific\n>> codepath, which has been amended to take the module to load as\n>> parameter, as well as whether or not that module has an import method.\n>\n> Does \"now\" mean before this patch or after this patch?  Usually\n> commit messages describe the status quo without the patch in the\n> present tense and the change the patch will make in the imperative.\n> So this could say:\n>\n> \tUpdate both to use a common implementation based on the previous\n> \tError.pm loader.\n\nAll good feeedback, thanks. Incorporated into v2 which I'm about to\nsubmit.\n\n> [...]\n>> +++ b/perl/Git/LoadCPAN.pm\n>> @@ -0,0 +1,74 @@\n> [...]\n>> +The Perl code in Git depends on some modules from the CPAN, but we\n>> +don't want to make those a hard requirement for anyone building from\n>> +source.\n>\n> not about this patch: have we considered making it a hard requirement?\n> Both Mail::Address and Error.pm are pretty widely available, and I\n> wonder if we could make the instructions in the INSTALL file say that\n> they are required dependencies to simplify things.\n\nI can't remember when, but at some point this was discussed on list, and\nthe consensus was that us using perl should be kept as a non-invasive\nimplementation detail that would be as small of a pain as possible for\nusers.\n\nIt's easy for distros to package these modules, but for users building\nfrom source who know nothing about perl it can be a pain.\n\nI also think it's very useful to avoid the side-discussion about not\nusing some useful CPAN module in the future just because it's not widely\nused, but would be perfect for some use-case of ours.\n\n> I admit part of my bias here is coming from the distro world, where we\n> have to do extra work to get rid of the FromCPAN embedded copies and\n> would be happier not to have to.\n\nI think there's a very good argument to be made for inverting the\nNO_PERL_CPAN_FALLBACKS logic, but my soon to be submitted v2 keeps it\noff by default.\n\n> [...]\n>> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,\n>> +preferring to use their own packaging of CPAN modules instead.\n>\n> nit: I think the plural of OS is OSes, or something like\n> \"distributors\" or \"operating systems\".\n\nThanks.\n\n> [...]\n>> +    eval {\n>> +\trequire $package_pm;\n>> +\t1;\n>> +    } or do {\n>\n> also not about this patch: this mixed tabs/spacing formatting feels a\n> bit unusual.  I don't know if it's idiomatic for perl, and if it is\n> then no complaints; it just stood out a little.  Can\n> Documentation/CodingGuidelines say something about the preferred\n> indentation in Perl to avoid having to think about such questions?\n\nThanks, that sucked. Changed to \\t. I still haven't gotten around to\nhacking my $EDITOR settings for git.git (like for C & SH).\n\n>> --- a/perl/Git/LoadCPAN/Error.pm\n>> +++ b/perl/Git/LoadCPAN/Error.pm\n>> @@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;\n>>  use 5.008;\n>>  use strict;\n>>  use warnings;\n>> +use Git::LoadCPAN (\n>> +    module => 'Error',\n>> +    import => 1,\n>> +);\n>\n> Nice!\n>\n> Thanks and hope that helps,\n> Jonathan\n"},{"id":"340211","messageId":"87r2p8evwh.fsf@evledraar.gmail.com","threadId":"47849","inReplyTo":"20180214224137.GA136185@aiede.svl.corp.google.com","subject":"Re: [PATCH 1/8] perl: *.pm files should not have the executable bit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:01:18Z","receivedAt":"2018-02-25T19:01:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 14 2018, Jonathan Nieder jotted:\n\n> Hi,\n>\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> The Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\n>> use a local copy of Mail::Address\", 2018-01-05) had the executable bit\n>> set, this should not be the case with *.pm files, it breaks nothing,\n>> but is redundant and confusing as none of the other files have it, and\n>> it's never executed as a stand-alone program.\n>\n> Needs a period somewhere to break up the long sentence with comma\n> splices.  How about:\n>\n> \tThe Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\n> \tuse a local copy of Mail::Address\", 2018-01-05) had the executable bit\n> \tset. That bit should not be set for *.pm files. It breaks nothing but\n> \tbut it is redundant and confusing as none of the other files have it\n> \tand these files are never executed as stand-alone programs.\n\nThanks, used this with s/but but/but/\n\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>\n> With or without such a tweak,\n> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n>\n> Thanks.\n\n"},{"id":"340212","messageId":"001201d3ae6b$a67ba0d0$f372e270$@nexbridge.com","threadId":"47849","inReplyTo":"87sh9oew4d.fsf@evledraar.gmail.com","subject":"RE: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2018-02-25T19:05:44Z","receivedAt":"2018-02-25T19:05:57Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On February 25, 2018 1:57 PM, Ævar Arnfjörð Bjarmason wrote:\n> On Wed, Feb 14 2018, Jonathan Nieder jotted:\n> \n> > Ævar Arnfjörð Bjarmason wrote:\n> >\n> >> Change the two wrappers to load from CPAN (local OS) or our own copy\n> >> to do so via the same codepath.\n> >\n> > nit: I think with s/to load/that load/ this will be easier to read.\n> >\n> >> I added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\n> >> perl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\n> >> afterwards Matthieu Moy added a wrapper for Mail::Address in\n> >> bd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n> >> 2018-01-05).\n> >>\n> >> His was simpler since Mail::Address doesn't have an \"import\" method,\n> >> but didn't do the same sanity checking, e.g. a missing FromCPAN\n> >> directory (which OS packages are likely not to have) wouldn't be\n> >> explicitly warned about.\n> >\n> > I'm having trouble parsing this.  Mail::Address didn't do the same\n> > sanity checking or his didn't?\n> >\n> > The comma before e.g. should be a period or semicolon, since it's\n> > starting a new independent clause.\n> >\n> >> Now both use a modification of the previously Error.pm-specific\n> >> codepath, which has been amended to take the module to load as\n> >> parameter, as well as whether or not that module has an import method.\n> >\n> > Does \"now\" mean before this patch or after this patch?  Usually commit\n> > messages describe the status quo without the patch in the present\n> > tense and the change the patch will make in the imperative.\n> > So this could say:\n> >\n> > \tUpdate both to use a common implementation based on the\n> previous\n> > \tError.pm loader.\n> \n> All good feeedback, thanks. Incorporated into v2 which I'm about to submit.\n> \n> > [...]\n> >> +++ b/perl/Git/LoadCPAN.pm\n> >> @@ -0,0 +1,74 @@\n> > [...]\n> >> +The Perl code in Git depends on some modules from the CPAN, but we\n> >> +don't want to make those a hard requirement for anyone building from\n> >> +source.\n> >\n> > not about this patch: have we considered making it a hard requirement?\n> > Both Mail::Address and Error.pm are pretty widely available, and I\n> > wonder if we could make the instructions in the INSTALL file say that\n> > they are required dependencies to simplify things.\n> \n> I can't remember when, but at some point this was discussed on list, and the\n> consensus was that us using perl should be kept as a non-invasive\n> implementation detail that would be as small of a pain as possible for users.\n\nThat would include the platform I'm maintaining, where perl is currently pretty handcuffed and blindfolded (including completion code misinterprets). CPAN isn't currently an option, but might be soon.\n\n> It's easy for distros to package these modules, but for users building from\n> source who know nothing about perl it can be a pain.\n\nKnow perl I do. Use it not, can I. ;-)\n\n> I also think it's very useful to avoid the side-discussion about not using some\n> useful CPAN module in the future just because it's not widely used, but\n> would be perfect for some use-case of ours.\n> \n> > I admit part of my bias here is coming from the distro world, where we\n> > have to do extra work to get rid of the FromCPAN embedded copies and\n> > would be happier not to have to.\n> \n> I think there's a very good argument to be made for inverting the\n> NO_PERL_CPAN_FALLBACKS logic, but my soon to be submitted v2 keeps it\n> off by default.\n\nCool, thanks.\n\nCheers,\nRandall\n\n-- Brief whoami:\n  NonStop developer since approximately NonStop(211288444200000000)\n  UNIX developer since approximately 421664400\n-- In my real life, I talk too much.\n\n\n\n"},{"id":"340213","messageId":"20180225194637.18630-1-avarab@gmail.com","threadId":"47849","inReplyTo":"20180214222146.10655-1-avarab@gmail.com","subject":"[PATCH v2 00/13] various perl fixes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:24Z","receivedAt":"2018-02-25T19:46:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Addresses comments against v1, and ships with a new\nNO_PERL_CPAN_FALLBACKS knob (thanks Todd!) which distributions can\nturn on to not get our FromCPAN copies. Details below.\n\nTodd Zullinger (1):\n  Makefile: add NO_PERL_CPAN_FALLBACKS knob\n\nSome of this was split off into into my \"perl: move the\nperl/Git/FromCPAN tree to perl/FromCPAN\", and I added \"This option is\nintended[...]\" to the Makefile documentation.\n\nÆvar Arnfjörð Bjarmason (12):\n  perl: *.pm files should not have the executable bit\n\nJN: Rephrased commit message.\n\n  Git.pm: remove redundant \"use strict\" from sub-package\n  Git.pm: add the \"use warnings\" pragma\n\nThese are both new, something I noticed and seems sensible to fix\nwhile we're at it.\n\n  gitweb: hard-depend on the Digest::MD5 5.8 module\n  Git.pm: hard-depend on the File::{Temp,Spec} modules\n  git-send-email: unconditionally use Net::{SMTP,Domain}\n\nThese all \"use\" the modules now, instead of using \"require\".\n\nJN: Removed a comment from the gitweb code that isn't needed anymore.\n\nClarifications / fixes to the commit messages. \n\n  perl: update our ancient copy of Error.pm\n\nRephrased commit message.\n\n  perl: update our copy of Mail::Address\n\nActually ships with the working version of Mail::Address now (oops!),\nwhich makes the patch much smaller, and requires less explanation.\n\n  perl: move CPAN loader wrappers to another namespace\n\nJN: Commit message phrasing.\n\n  perl: generalize the Git::LoadCPAN facility\n\nJN: Commit message phrasing, and s/    /\\t/g.\n\n  perl: move the perl/Git/FromCPAN tree to perl/FromCPAN\n  perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS\n\nThese are both new. There's now a NO_PERL_CPAN_FALLBACKS option for\ndistributors to turn on to stop us from installing these CPAN\nfallbacks.\n\n13/13 updates the docs, and emits a better error than what we emit now\nin master if the CPAN module we expect from the OS isn't installed.\n\n INSTALL                                 |  11 +-\n Makefile                                |  16 +-\n contrib/examples/git-difftool.perl      |   2 +-\n git-send-email.perl                     |  28 ++-\n gitweb/INSTALL                          |   3 +-\n gitweb/gitweb.perl                      |  17 +-\n perl/FromCPAN/.gitattributes            |   1 +\n perl/{Git => }/FromCPAN/Error.pm        | 296 +++++++++++++++++++++++++++-----\n perl/{Git => }/FromCPAN/Mail/Address.pm |   8 +-\n perl/Git.pm                             |  14 +-\n perl/Git/Error.pm                       |  46 -----\n perl/Git/LoadCPAN.pm                    | 104 +++++++++++\n perl/Git/LoadCPAN/Error.pm              |  10 ++\n perl/Git/LoadCPAN/Mail/Address.pm       |  10 ++\n perl/Git/Mail/Address.pm                |  24 ---\n 15 files changed, 432 insertions(+), 158 deletions(-)\n create mode 100644 perl/FromCPAN/.gitattributes\n rename perl/{Git => }/FromCPAN/Error.pm (72%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (96%)\n delete mode 100644 perl/Git/Error.pm\n create mode 100644 perl/Git/LoadCPAN.pm\n create mode 100644 perl/Git/LoadCPAN/Error.pm\n create mode 100644 perl/Git/LoadCPAN/Mail/Address.pm\n delete mode 100755 perl/Git/Mail/Address.pm\n\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340214","messageId":"20180225194637.18630-2-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 01/13] perl: *.pm files should not have the executable bit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:25Z","receivedAt":"2018-02-25T19:47:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\nuse a local copy of Mail::Address\", 2018-01-05) had the executable bit\nset. That bit should not be set for *.pm files. It breaks nothing but\nit is redundant and confusing as none of the other files have it and\nthese files are never executed as stand-alone programs.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/Mail/Address.pm | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n mode change 100755 => 100644 perl/Git/Mail/Address.pm\n\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/Mail/Address.pm\nold mode 100755\nnew mode 100644\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340215","messageId":"20180225194637.18630-3-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 02/13] Git.pm: remove redundant \"use strict\" from sub-package","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:26Z","receivedAt":"2018-02-25T19:47:07Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In Perl the \"use strict/warnings\" pragmas are lexical, thus there's no\nreason to do:\n\n    package Foo;\n    use strict;\n    package Bar;\n    use strict;\n    $x = 5;\n\nTo satisfy the desire that the undeclared $x variable will be spotted\nat compile-time. It's enough to include the first \"use strict\".\n\nThis functionally changes nothing, but makes a subsequent change where\n\"use warnings\" will be added to Git.pm less confusing and less\nverbose, since as with \"strict\" we'll only need to do that at the top\nof the file.\n\nChanges code initially added in a6065b548f (\"Git.pm: Try to support\nActiveState output pipe\", 2006-06-25).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 9d60d7948b..99e5d943af 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -1692,7 +1692,6 @@ sub DESTROY {\n # Pipe implementation for ActiveState Perl.\n \n package Git::activestate_pipe;\n-use strict;\n \n sub TIEHANDLE {\n \tmy ($class, @params) = @_;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340216","messageId":"20180225194637.18630-4-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 03/13] Git.pm: add the \"use warnings\" pragma","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:27Z","receivedAt":"2018-02-25T19:47:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend Git.pm to load the \"warnings\" pragma like the rest of the code\nin perl/ in addition to the existing \"strict\" pragma. This is\nconsidered the bare minimum best practice in Perl.\n\nEver since this code was introduced in b1edc53d06 (\"Introduce\nGit.pm (v4)\", 2006-06-24) it's only been using \"strict\", not\n\"warnings\".\n\nThis leaves contrib/buildsystems/Generators/{QMake,VCproj}.pm and\ncontrib/mw-to-git/Git/Mediawiki.pm without \"use warnings\". Amending\nthose would be a sensible follow-up change, but I don't have an easy\nway to test those so I'm not changing them.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 99e5d943af..7ec16e6dde 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -9,6 +9,7 @@ package Git;\n \n use 5.008;\n use strict;\n+use warnings;\n \n \n BEGIN {\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340217","messageId":"20180225194637.18630-5-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 04/13] gitweb: hard-depend on the Digest::MD5 5.8 module","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:28Z","receivedAt":"2018-02-25T19:47:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require Digest::MD5 anymore. It was released with perl\nv5.7.3[1]\n\nThe initial introduction of the dependency in\ne9fdd74e53 (\"gitweb: (gr)avatar support\", 2009-06-30) says as much,\nthis also undoes part of the later 2e9c8789b7 (\"gitweb: Mention\noptional Perl modules in INSTALL\", 2011-02-04) since gitweb will\nalways be run on at least 5.8, so there's no need to mention\nDigest::MD5 as a required module in the documentation, let's instead\nsay that we require perl 5.8.\n\nAs with the preceding Net::{SMTP,Domain} change we now unconditionally\n\"use\" the module instead.\n\n1. $ corelist Digest::MD5\n   Data for 2015-02-14\n   Digest::MD5 was first released with perl v5.7.3\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n gitweb/INSTALL     |  3 +--\n gitweb/gitweb.perl | 17 ++++-------------\n 2 files changed, 5 insertions(+), 15 deletions(-)\n\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex 408f2859d3..a58e6b3c44 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -29,12 +29,11 @@ Requirements\n ------------\n \n  - Core git tools\n- - Perl\n+ - Perl 5.8\n  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.\n  - web server\n \n The following optional Perl modules are required for extra features\n- - Digest::MD5 - for gravatar support\n  - CGI::Fast and FCGI - for running gitweb as FastCGI script\n  - HTML::TagCloud - for fancy tag cloud in project list view\n  - HTTP::Date or Time::ParseDate - to support If-Modified-Since for feeds\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2417057f2b..2594a4badb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -20,6 +20,8 @@ use Fcntl ':mode';\n use File::Find qw();\n use File::Basename qw(basename);\n use Time::HiRes qw(gettimeofday tv_interval);\n+use Digest::MD5 qw(md5_hex);\n+\n binmode STDOUT, ':utf8';\n \n if (!defined($CGI::VERSION) || $CGI::VERSION < 4.08) {\n@@ -490,7 +492,6 @@ our %feature = (\n \t# Currently available providers are gravatar and picon.\n \t# If an unknown provider is specified, the feature is disabled.\n \n-\t# Gravatar depends on Digest::MD5.\n \t# Picon currently relies on the indiana.edu database.\n \n \t# To enable system wide have in $GITWEB_CONFIG\n@@ -1166,18 +1167,8 @@ sub configure_gitweb_features {\n \tour @snapshot_fmts = gitweb_get_feature('snapshot');\n \t@snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);\n \n-\t# check that the avatar feature is set to a known provider name,\n-\t# and for each provider check if the dependencies are satisfied.\n-\t# if the provider name is invalid or the dependencies are not met,\n-\t# reset $git_avatar to the empty string.\n \tour ($git_avatar) = gitweb_get_feature('avatar');\n-\tif ($git_avatar eq 'gravatar') {\n-\t\t$git_avatar = '' unless (eval { require Digest::MD5; 1; });\n-\t} elsif ($git_avatar eq 'picon') {\n-\t\t# no dependencies\n-\t} else {\n-\t\t$git_avatar = '';\n-\t}\n+\t$git_avatar = '' unless $git_avatar =~ /^(?:gravatar|picon)$/s;\n \n \tour @extra_branch_refs = gitweb_get_feature('extra-branch-refs');\n \t@extra_branch_refs = filter_and_validate_refs (@extra_branch_refs);\n@@ -2167,7 +2158,7 @@ sub gravatar_url {\n \tmy $size = shift;\n \t$avatar_cache{$email} ||=\n \t\t\"//www.gravatar.com/avatar/\" .\n-\t\t\tDigest::MD5::md5_hex($email) . \"?s=\";\n+\t\t\tmd5_hex($email) . \"?s=\";\n \treturn $avatar_cache{$email} . $size;\n }\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340218","messageId":"20180225194637.18630-6-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 05/13] Git.pm: hard-depend on the File::{Temp,Spec} modules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:29Z","receivedAt":"2018-02-25T19:47:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require File::Temp and File::Spec anymore. They were\nfirst released with perl versions v5.6.1 and 5.00405, respectively.\n\nThis code was originally added in c14c8ceb13 (\"Git.pm: Make File::Spec\nand File::Temp requirement lazy\", 2008-08-15), presumably to make\nGit.pm work on 5.6.0.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 7ec16e6dde..151b0e7144 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -11,6 +11,8 @@ use 5.008;\n use strict;\n use warnings;\n \n+use File::Temp ();\n+use File::Spec ();\n \n BEGIN {\n \n@@ -190,7 +192,6 @@ sub repository {\n \t\t};\n \n \t\tif ($dir) {\n-\t\t\t_verify_require();\n \t\t\tFile::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir;\n \t\t\t$opts{Repository} = abs_path($dir);\n \n@@ -1289,8 +1290,6 @@ sub temp_release {\n sub _temp_cache {\n \tmy ($self, $name) = _maybe_self(@_);\n \n-\t_verify_require();\n-\n \tmy $temp_fd = \\$TEMP_FILEMAP{$name};\n \tif (defined $$temp_fd and $$temp_fd->opened) {\n \t\tif ($TEMP_FILES{$$temp_fd}{locked}) {\n@@ -1324,11 +1323,6 @@ sub _temp_cache {\n \t$$temp_fd;\n }\n \n-sub _verify_require {\n-\teval { require File::Temp; require File::Spec; };\n-\t$@ and throw Error::Simple($@);\n-}\n-\n =item temp_reset ( FILEHANDLE )\n \n Truncates and resets the position of the C<FILEHANDLE>.\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340219","messageId":"20180225194637.18630-8-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 07/13] perl: update our ancient copy of Error.pm","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:31Z","receivedAt":"2018-02-25T19:47:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Error.pm shipped with Git as a fallback if there was no Error.pm\non the system was released in April 2006. There's been dozens of\nreleases since then, the latest at August 7, 2017. Let's update to\nthat.\n\nI don't know of anything we need from this new release or which this\nfixes. This change is simply a matter of keeping up with\nupstream. Before this users who'd install git via their package system\nwould get an up-to-date Error.pm, but if it's installed from source\nthey'd get one more than a decade old.\n\nThis undoes a local hack we'd accumulated in 96bc4de85c (\"Eliminate\nScalar::Util usage from private-Error.pm\", 2006-07-26), it's been\nredundant since my d48b284183 (\"perl: bump the required Perl version\nto 5.8 from 5.6.[21]\", 2010-09-24).\n\nThis also undoes 3a51467b94 (\"Typo fix: replacing it's -> its\",\n2013-04-13). This is the Nth time I find that some upstream code of\nours (in contrib/, in sha1dc/ and now in perl/ ...) has diverged from\nupstream because of some tree-wide typo fixing. Let's not do those\nfixes against upstream projects, it's more valuable that we have a 1=1\nmapping to upstream than to fix typos in docs we never even generate\nfrom this code. If someone wants to fix typos in them fine, but they\nshould do it with a patch to upstream which git.git can then\nincorporate.\n\nThe upstream code doesn't cleanly pass a --check, so I'm adding a\n.gitattributes file for similar reasons as done for sha1dc in\n5d184f468e (\"sha1dc: ignore indent-with-non-tab whitespace\nviolations\", 2017-06-06).\n\nThe updated source was retrieved from\nhttps://fastapi.metacpan.org/source/SHLOMIF/Error-0.17025/lib/Error.pm\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/.gitattributes |   1 +\n perl/Git/FromCPAN/Error.pm       | 296 +++++++++++++++++++++++++++++++++------\n 2 files changed, 256 insertions(+), 41 deletions(-)\n create mode 100644 perl/Git/FromCPAN/.gitattributes\n\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/Git/FromCPAN/.gitattributes\nnew file mode 100644\nindex 0000000000..8b64fc5e22\n--- /dev/null\n+++ b/perl/Git/FromCPAN/.gitattributes\n@@ -0,0 +1 @@\n+/Error.pm whitespace=-blank-at-eof\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/Git/FromCPAN/Error.pm\nindex 6098135ae2..f9c36e9e98 100644\n--- a/perl/Git/FromCPAN/Error.pm\n+++ b/perl/Git/FromCPAN/Error.pm\n@@ -12,10 +12,12 @@\n package Error;\n \n use strict;\n+use warnings;\n+\n use vars qw($VERSION);\n use 5.004;\n \n-$VERSION = \"0.15009\";\n+$VERSION = \"0.17025\";\n \n use overload (\n \t'\"\"'\t   =>\t'stringify',\n@@ -32,21 +34,35 @@ $Error::THROWN = undef;\t# last error thrown, a workaround until die $ref works\n my $LAST;\t\t# Last error created\n my %ERROR;\t\t# Last error associated with package\n \n-sub throw_Error_Simple\n+sub _throw_Error_Simple\n {\n     my $args = shift;\n     return Error::Simple->new($args->{'text'});\n }\n \n-$Error::ObjectifyCallback = \\&throw_Error_Simple;\n+$Error::ObjectifyCallback = \\&_throw_Error_Simple;\n \n \n # Exported subs are defined in Error::subs\n \n+use Scalar::Util ();\n+\n sub import {\n     shift;\n+    my @tags = @_;\n     local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;\n-    Error::subs->import(@_);\n+\n+    @tags = grep {\n+       if( $_ eq ':warndie' ) {\n+          Error::WarnDie->import();\n+          0;\n+       }\n+       else {\n+          1;\n+       }\n+    } @tags;\n+\n+    Error::subs->import(@tags);\n }\n \n # I really want to use last for the name of this method, but it is a keyword\n@@ -107,10 +123,6 @@ sub stacktrace {\n     $text;\n }\n \n-# Allow error propagation, ie\n-#\n-# $ber->encode(...) or\n-#    return Error->prior($ber)->associate($ldap);\n \n sub associate {\n     my $err = shift;\n@@ -130,6 +142,7 @@ sub associate {\n     return;\n }\n \n+\n sub new {\n     my $self = shift;\n     my($pkg,$file,$line) = caller($Error::Depth);\n@@ -246,6 +259,10 @@ sub value {\n \n package Error::Simple;\n \n+use vars qw($VERSION);\n+\n+$VERSION = \"0.17025\";\n+\n @Error::Simple::ISA = qw(Error);\n \n sub new {\n@@ -288,14 +305,6 @@ use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS);\n \n @ISA = qw(Exporter);\n \n-\n-sub blessed {\n-\tmy $item = shift;\n-\tlocal $@; # don't kill an outer $@\n-\tref $item and eval { $item->can('can') };\n-}\n-\n-\n sub run_clauses ($$$\\@) {\n     my($clauses,$err,$wantarray,$result) = @_;\n     my $code = undef;\n@@ -314,16 +323,17 @@ sub run_clauses ($$$\\@) {\n \t\tmy $pkg = $catch->[$i];\n \t\tunless(defined $pkg) {\n \t\t    #except\n-\t\t    splice(@$catch,$i,2,$catch->[$i+1]->());\n+\t\t    splice(@$catch,$i,2,$catch->[$i+1]->($err));\n \t\t    $i -= 2;\n \t\t    next CATCHLOOP;\n \t\t}\n-\t\telsif(blessed($err) && $err->isa($pkg)) {\n+\t\telsif(Scalar::Util::blessed($err) && $err->isa($pkg)) {\n \t\t    $code = $catch->[$i+1];\n \t\t    while(1) {\n \t\t\tmy $more = 0;\n-\t\t\tlocal($Error::THROWN);\n+\t\t\tlocal($Error::THROWN, $@);\n \t\t\tmy $ok = eval {\n+\t\t\t    $@ = $err;\n \t\t\t    if($wantarray) {\n \t\t\t\t@{$result} = $code->($err,\\$more);\n \t\t\t    }\n@@ -341,10 +351,9 @@ sub run_clauses ($$$\\@) {\n \t\t\t    undef $err;\n \t\t\t}\n \t\t\telse {\n-\t\t\t    $err = defined($Error::THROWN)\n-\t\t\t\t    ? $Error::THROWN : $@;\n-                $err = $Error::ObjectifyCallback->({'text' =>$err})\n-                    unless ref($err);\n+\t\t\t    $err = $@ || $Error::THROWN;\n+\t\t\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\t\t\tunless ref($err);\n \t\t\t}\n \t\t\tlast CATCH;\n \t\t    };\n@@ -357,7 +366,9 @@ sub run_clauses ($$$\\@) {\n \tif(defined($owise = $clauses->{'otherwise'})) {\n \t    my $code = $clauses->{'otherwise'};\n \t    my $more = 0;\n+        local($Error::THROWN, $@);\n \t    my $ok = eval {\n+\t\t$@ = $err;\n \t\tif($wantarray) {\n \t\t    @{$result} = $code->($err,\\$more);\n \t\t}\n@@ -374,11 +385,10 @@ sub run_clauses ($$$\\@) {\n \t\tundef $err;\n \t    }\n \t    else {\n-\t\t$err = defined($Error::THROWN)\n-\t\t\t? $Error::THROWN : $@;\n+\t\t$err = $@ || $Error::THROWN;\n \n-        $err = $Error::ObjectifyCallback->({'text' =>$err})\n-            unless ref($err);\n+\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\tunless ref($err);\n \t    }\n \t}\n     }\n@@ -398,7 +408,7 @@ sub try (&;$) {\n \n     do {\n \tlocal $Error::THROWN = undef;\n-    local $@ = undef;\n+\tlocal $@ = undef;\n \n \t$ok = eval {\n \t    if($wantarray) {\n@@ -413,21 +423,21 @@ sub try (&;$) {\n \t    1;\n \t};\n \n-\t$err = defined($Error::THROWN) ? $Error::THROWN : $@\n+\t$err = $@ || $Error::THROWN\n \t    unless $ok;\n     };\n \n     shift @Error::STACK;\n \n     $err = run_clauses($clauses,$err,wantarray,@result)\n-\tunless($ok);\n+    unless($ok);\n \n     $clauses->{'finally'}->()\n \tif(defined($clauses->{'finally'}));\n \n     if (defined($err))\n     {\n-        if (blessed($err) && $err->can('throw'))\n+        if (Scalar::Util::blessed($err) && $err->can('throw'))\n         {\n             throw $err;\n         }\n@@ -506,12 +516,116 @@ sub otherwise (&;$) {\n }\n \n 1;\n+\n+package Error::WarnDie;\n+\n+sub gen_callstack($)\n+{\n+    my ( $start ) = @_;\n+\n+    require Carp;\n+    local $Carp::CarpLevel = $start;\n+    my $trace = Carp::longmess(\"\");\n+    # Remove try calls from the trace\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::run_clauses[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    my @callstack = split( m/\\n/, $trace );\n+    return @callstack;\n+}\n+\n+my $old_DIE;\n+my $old_WARN;\n+\n+sub DEATH\n+{\n+    my ( $e ) = @_;\n+\n+    local $SIG{__DIE__} = $old_DIE if( defined $old_DIE );\n+\n+    die @_ if $^S;\n+\n+    my ( $etype, $message, $location, @callstack );\n+    if ( ref($e) && $e->isa( \"Error\" ) ) {\n+        $etype = \"exception of type \" . ref( $e );\n+        $message = $e->text;\n+        $location = $e->file . \":\" . $e->line;\n+        @callstack = split( m/\\n/, $e->stacktrace );\n+    }\n+    else {\n+        # Don't apply subsequent layer of message formatting\n+        die $e if( $e =~ m/^\\nUnhandled perl error caught at toplevel:\\n\\n/ );\n+        $etype = \"perl error\";\n+        my $stackdepth = 0;\n+        while( caller( $stackdepth ) =~ m/^Error(?:$|::)/ ) {\n+            $stackdepth++\n+        }\n+\n+        @callstack = gen_callstack( $stackdepth + 1 );\n+\n+        $message = \"$e\";\n+        chomp $message;\n+\n+        if ( $message =~ s/ at (.*?) line (\\d+)\\.$// ) {\n+            $location = $1 . \":\" . $2;\n+        }\n+        else {\n+            my @caller = caller( $stackdepth );\n+            $location = $caller[1] . \":\" . $caller[2];\n+        }\n+    }\n+\n+    shift @callstack;\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    die \"\\nUnhandled $etype caught at toplevel:\\n\\n  $message\\n\\nThrown from: $location\\n\\nFull stack trace:\\n\\n$callstack\\n\";\n+}\n+\n+sub TAXES\n+{\n+    my ( $message ) = @_;\n+\n+    local $SIG{__WARN__} = $old_WARN if( defined $old_WARN );\n+\n+    $message =~ s/ at .*? line \\d+\\.$//;\n+    chomp $message;\n+\n+    my @callstack = gen_callstack( 1 );\n+    my $location = shift @callstack;\n+\n+    # $location already starts in a leading space\n+    $message .= $location;\n+\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    warn \"$message:\\n$callstack\";\n+}\n+\n+sub import\n+{\n+    $old_DIE  = $SIG{__DIE__};\n+    $old_WARN = $SIG{__WARN__};\n+\n+    $SIG{__DIE__}  = \\&DEATH;\n+    $SIG{__WARN__} = \\&TAXES;\n+}\n+\n+1;\n+\n __END__\n \n =head1 NAME\n \n Error - Error/exception handling in an OO-ish way\n \n+=head1 WARNING\n+\n+Using the \"Error\" module is B<no longer recommended> due to the black-magical\n+nature of its syntactic sugar, which often tends to break. Its maintainers\n+have stopped actively writing code that uses it, and discourage people\n+from doing so. See the \"SEE ALSO\" section below for better recommendations.\n+\n =head1 SYNOPSIS\n \n     use Error qw(:try);\n@@ -529,7 +643,7 @@ Error - Error/exception handling in an OO-ish way\n     try {\n \tdo_some_stuff();\n \tdie \"error!\" if $condition;\n-\tthrow Error::Simple -text => \"Oops!\" if $other_condition;\n+\tthrow Error::Simple \"Oops!\" if $other_condition;\n     }\n     catch Error::IO with {\n \tmy $E = shift;\n@@ -587,7 +701,7 @@ C<BLOCK> will be passed two arguments. The first will be the error\n being thrown. The second is a reference to a scalar variable. If this\n variable is set by the catch block then, on return from the catch\n block, try will continue processing as if the catch block was never\n-found.\n+found. The error will also be available in C<$@>.\n \n To propagate the error the catch block may call C<$err-E<gt>throw>\n \n@@ -608,7 +722,7 @@ type.\n Catch any error by executing the code in C<BLOCK>\n \n When evaluated C<BLOCK> will be passed one argument, which will be the\n-error being processed.\n+error being processed. The error will also be available in C<$@>.\n \n Only one otherwise block may be specified per try block\n \n@@ -625,12 +739,25 @@ Only one finally block may be specified per try block\n \n =back\n \n+=head1 COMPATIBILITY\n+\n+L<Moose> exports a keyword called C<with> which clashes with Error's. This\n+example returns a prototype mismatch error:\n+\n+    package MyTest;\n+\n+    use warnings;\n+    use Moose;\n+    use Error qw(:try);\n+\n+(Thanks to C<maik.hentsche@amd.com> for the report.).\n+\n =head1 CLASS INTERFACE\n \n =head2 CONSTRUCTORS\n \n The C<Error> object is implemented as a HASH. This HASH is initialized\n-with the arguments that are passed to its constructor. The elements\n+with the arguments that are passed to it's constructor. The elements\n that are used by, or are retrievable by the C<Error> class are listed\n below, other classes may add to these.\n \n@@ -655,6 +782,10 @@ an object blessed into that package as the C<-object> argument.\n \n =over 4\n \n+=item Error->new()\n+\n+See the Error::Simple documentation.\n+\n =item throw ( [ ARGS ] )\n \n Create a new C<Error> object and throw an error, which will be caught\n@@ -730,6 +861,13 @@ The line where the constructor of this error was called from\n \n The text of the error\n \n+=item $err->associate($obj)\n+\n+Associates an error with an object to allow error propagation. I.e:\n+\n+    $ber->encode(...) or\n+        return Error->prior($ber)->associate($ldap);\n+\n =back\n \n =head2 OVERLOAD METHODS\n@@ -759,11 +897,9 @@ to the constructor.\n \n =head1 PRE-DEFINED ERROR CLASSES\n \n-=over 4\n-\n-=item Error::Simple\n+=head2 Error::Simple\n \n-This class can be used to hold simple error strings and values. Its\n+This class can be used to hold simple error strings and values. It's\n constructor takes two arguments. The first is a text value, the second\n is a numeric value. These values are what will be returned by the\n overload methods.\n@@ -775,7 +911,6 @@ of the error object.\n This class is used internally if an eval'd block die's with an error\n that is a plain string. (Unless C<$Error::ObjectifyCallback> is modified)\n \n-=back\n \n =head1 $Error::ObjectifyCallback\n \n@@ -804,6 +939,76 @@ class MyError::Bar by default:\n         # Error handling here.\n     }\n \n+=cut\n+\n+=head1 MESSAGE HANDLERS\n+\n+C<Error> also provides handlers to extend the output of the C<warn()> perl\n+function, and to handle the printing of a thrown C<Error> that is not caught\n+or otherwise handled. These are not installed by default, but are requested\n+using the C<:warndie> tag in the C<use> line.\n+\n+ use Error qw( :warndie );\n+\n+These new error handlers are installed in C<$SIG{__WARN__}> and\n+C<$SIG{__DIE__}>. If these handlers are already defined when the tag is\n+imported, the old values are stored, and used during the new code. Thus, to\n+arrange for custom handling of warnings and errors, you will need to perform\n+something like the following:\n+\n+ BEGIN {\n+   $SIG{__WARN__} = sub {\n+     print STDERR \"My special warning handler: $_[0]\"\n+   };\n+ }\n+\n+ use Error qw( :warndie );\n+\n+Note that setting C<$SIG{__WARN__}> after the C<:warndie> tag has been\n+imported will overwrite the handler that C<Error> provides. If this cannot be\n+avoided, then the tag can be explicitly C<import>ed later\n+\n+ use Error;\n+\n+ $SIG{__WARN__} = ...;\n+\n+ import Error qw( :warndie );\n+\n+=head2 EXAMPLE\n+\n+The C<__DIE__> handler turns messages such as\n+\n+ Can't call method \"foo\" on an undefined value at examples/warndie.pl line 16.\n+\n+into\n+\n+ Unhandled perl error caught at toplevel:\n+\n+   Can't call method \"foo\" on an undefined value\n+\n+ Thrown from: examples/warndie.pl:16\n+\n+ Full stack trace:\n+\n+         main::inner('undef') called at examples/warndie.pl line 20\n+         main::outer('undef') called at examples/warndie.pl line 23\n+\n+=cut\n+\n+=head1 SEE ALSO\n+\n+See L<Exception::Class> for a different module providing Object-Oriented\n+exception handling, along with a convenient syntax for declaring hierarchies\n+for them. It doesn't provide Error's syntactic sugar of C<try { ... }>,\n+C<catch { ... }>, etc. which may be a good thing or a bad thing based\n+on what you want. (Because Error's syntactic sugar tends to break.)\n+\n+L<Error::Exception> aims to combine L<Error> and L<Exception::Class>\n+\"with correct stringification\".\n+\n+L<TryCatch> and L<Try::Tiny> are similar in concept to Error.pm only providing\n+a syntax that hopefully breaks less.\n+\n =head1 KNOWN BUGS\n \n None, but that does not mean there are not any.\n@@ -816,12 +1021,21 @@ The code that inspired me to write this was originally written by\n Peter Seibel <peter@weblogic.com> and adapted by Jesse Glick\n <jglick@sig.bsh.com>.\n \n+C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>\n+\n =head1 MAINTAINER\n \n-Shlomi Fish <shlomif@iglu.org.il>\n+Shlomi Fish, L<http://www.shlomifish.org/> .\n \n =head1 PAST MAINTAINERS\n \n Arun Kumar U <u_arunkumar@yahoo.com>\n \n+=head1 COPYRIGHT\n+\n+Copyright (c) 1997-8  Graham Barr. All rights reserved.\n+This program is free software; you can redistribute it and/or modify it\n+under the same terms as Perl itself.\n+\n =cut\n+\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340220","messageId":"20180225194637.18630-7-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 06/13] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:30Z","receivedAt":"2018-02-25T19:47:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Net::SMTP and Net::Domain were both first released with perl\nv5.7.3[1], since my d48b284183 (\"perl: bump the required Perl version\nto 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's\nno reason to conditionally require this anymore.\n\nThis conditional loading was initially added in\n87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\nto give real name of the calling host to HELO/EHLO\", 2010-03-14) for\nNet::Domain, both of which predate the hard dependency on 5.8.\n\nSince they're guaranteed to be installed now let's \"use\" them\ninstead. The cost of loading them both is trivial given what\ngit-send-email does (~15ms on my system), and it's better to not defer\nany potential loading errors until runtime.\n\nThis patch is better viewed with -w, which shows that the only change\nin the last two hunks is removing the \"if eval\" wrapper block.\n\n1. $ parallel 'corelist {}' ::: Net::{SMTP,Domain}\n   Data for 2015-02-14\n   Net::SMTP was first released with perl v5.7.3\n\n   Data for 2015-02-14\n   Net::Domain was first released with perl v5.7.3\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-send-email.perl | 24 +++++++++++-------------\n 1 file changed, 11 insertions(+), 13 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex bbf4deaa0d..d5a4826a1c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -31,6 +31,8 @@ use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\n use Git::Mail::Address;\n+use Net::Domain ();\n+use Net::SMTP ();\n \n Getopt::Long::Configure qw/ pass_through /;\n \n@@ -1143,10 +1145,8 @@ sub valid_fqdn {\n sub maildomain_net {\n \tmy $maildomain;\n \n-\tif (eval { require Net::Domain; 1 }) {\n-\t\tmy $domain = Net::Domain::domainname();\n-\t\t$maildomain = $domain if valid_fqdn($domain);\n-\t}\n+\tmy $domain = Net::Domain::domainname();\n+\t$maildomain = $domain if valid_fqdn($domain);\n \n \treturn $maildomain;\n }\n@@ -1154,17 +1154,15 @@ sub maildomain_net {\n sub maildomain_mta {\n \tmy $maildomain;\n \n-\tif (eval { require Net::SMTP; 1 }) {\n-\t\tfor my $host (qw(mailhost localhost)) {\n-\t\t\tmy $smtp = Net::SMTP->new($host);\n-\t\t\tif (defined $smtp) {\n-\t\t\t\tmy $domain = $smtp->domain;\n-\t\t\t\t$smtp->quit;\n+\tfor my $host (qw(mailhost localhost)) {\n+\t\tmy $smtp = Net::SMTP->new($host);\n+\t\tif (defined $smtp) {\n+\t\t\tmy $domain = $smtp->domain;\n+\t\t\t$smtp->quit;\n \n-\t\t\t\t$maildomain = $domain if valid_fqdn($domain);\n+\t\t\t$maildomain = $domain if valid_fqdn($domain);\n \n-\t\t\t\tlast if $maildomain;\n-\t\t\t}\n+\t\t\tlast if $maildomain;\n \t\t}\n \t}\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340221","messageId":"20180225194637.18630-10-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 09/13] perl: move CPAN loader wrappers to another namespace","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:33Z","receivedAt":"2018-02-25T19:47:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the Git::Error and Git::Mail::Address wrappers to the\nGit::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error. That\nmodule will then either load Error from CPAN (if installed on the OS),\nor use Git::FromCPAN::Error.\n\nWhen I added the Error wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10) I didn't think\nabout how confusing it would be to have these modules sitting in the\nsame tree as our normal modules. Let's put these all into\nGit::{Load,From}CPAN::* to clearly distinguish them from the rest.\n\nThis also makes things a bit less confusing since there was already a\nGit::Error namespace ever since 8b9150e3e3 (\"Git.pm: Handle failed\ncommands' output\", 2006-06-24).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/examples/git-difftool.perl      | 2 +-\n git-send-email.perl                     | 4 ++--\n perl/Git.pm                             | 2 +-\n perl/Git/{ => LoadCPAN}/Error.pm        | 8 ++++----\n perl/Git/{ => LoadCPAN}/Mail/Address.pm | 4 ++--\n 5 files changed, 10 insertions(+), 10 deletions(-)\n rename perl/Git/{ => LoadCPAN}/Error.pm (78%)\n rename perl/Git/{ => LoadCPAN}/Mail/Address.pm (69%)\n\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex fb0fd0b84b..b2ea80f9ed 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d5a4826a1c..1ec22c5ef3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,13 +26,13 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\n-use Git::Mail::Address;\n use Net::Domain ();\n use Net::SMTP ();\n+use Git::LoadCPAN::Mail::Address;\n \n Getopt::Long::Configure qw/ pass_through /;\n \ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 151b0e7144..9f246c7988 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -104,7 +104,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/LoadCPAN/Error.pm\nsimilarity index 78%\nrename from perl/Git/Error.pm\nrename to perl/Git/LoadCPAN/Error.pm\nindex 09bbc97390..3513fe745b 100644\n--- a/perl/Git/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -1,11 +1,11 @@\n-package Git::Error;\n+package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n@@ -26,13 +26,13 @@ sub import {\n     } or do {\n \tmy $error = $@ || \"Zombie Error\";\n \n-\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n \n \trequire File::Basename;\n \tmy $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'!\";\n \n \trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n \tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n \n \tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nsimilarity index 69%\nrename from perl/Git/Mail/Address.pm\nrename to perl/Git/LoadCPAN/Mail/Address.pm\nindex 2ce3e84670..879c2f5cd1 100644\n--- a/perl/Git/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -1,11 +1,11 @@\n-package Git::Mail::Address;\n+package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n+Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340222","messageId":"20180225194637.18630-9-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 08/13] perl: update our copy of Mail::Address","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:32Z","receivedAt":"2018-02-25T19:47:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n23, 2018). Like the preceding Error.pm update this is done simply to\nkeep up-to-date with upstream, and as can be shown from the diff\nthere's no functional changes.\n\nThe updated source was retrieved from\nhttps://fastapi.metacpan.org/source/MARKOV/MailTools-2.20/lib/Mail/Address.pm\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/Mail/Address.pm | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/Git/FromCPAN/Mail/Address.pm\nindex 13b2ff7d05..683d490b2b 100644\n--- a/perl/Git/FromCPAN/Mail/Address.pm\n+++ b/perl/Git/FromCPAN/Mail/Address.pm\n@@ -1,10 +1,14 @@\n-# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>].\n+# Copyrights 1995-2018 by [Mark Overmeer].\n #  For other contributors see ChangeLog.\n # See the manual pages for details on the licensing terms.\n # Pod stripped from pm file by OODoc 2.02.\n+# This code is part of the bundle MailTools.  Meta-POD processed with\n+# OODoc into POD and HTML manual-pages.  See README.md for Copyright.\n+# Licensed under the same terms as Perl itself.\n+\n package Mail::Address;\n use vars '$VERSION';\n-$VERSION = '2.19';\n+$VERSION = '2.20';\n \n use strict;\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340223","messageId":"20180225194637.18630-11-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 10/13] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:34Z","receivedAt":"2018-02-25T19:47:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the two wrappers that load from CPAN (local OS) or our own copy\nto do so via the same codepath.\n\nI added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\nafterwards Matthieu Moy added a wrapper for Mail::Address in\nbd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n2018-01-05).\n\nHis loader was simpler since Mail::Address doesn't have an \"import\"\nmethod, but didn't do the same sanity checking; For example, a missing\nFromCPAN directory (which OS packages are likely not to have) wouldn't\nbe explicitly warned about as a \"BUG: ...\".\n\nUpdate both to use a common implementation based on the previous\nError.pm loader. Which has been amended to take the module to load as\nparameter, as well as whether or not that module has an import\nmethod.\n\nThis loader should be generic enough to handle almost all CPAN modules\nout there, some use some crazy loading magic and wouldn't like being\nwrapped like this, but that would be immediately obvious, and we'd\nfind out right away since the module wouldn't work at all.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/LoadCPAN.pm              | 74 +++++++++++++++++++++++++++++++++++++++\n perl/Git/LoadCPAN/Error.pm        | 44 +++--------------------\n perl/Git/LoadCPAN/Mail/Address.pm | 22 +++---------\n 3 files changed, 82 insertions(+), 58 deletions(-)\n create mode 100644 perl/Git/LoadCPAN.pm\n\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nnew file mode 100644\nindex 0000000000..1568c177fe\n--- /dev/null\n+++ b/perl/Git/LoadCPAN.pm\n@@ -0,0 +1,74 @@\n+package Git::LoadCPAN;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy\n+\n+=head1 DESCRIPTION\n+\n+The Perl code in Git depends on some modules from the CPAN, but we\n+don't want to make those a hard requirement for anyone building from\n+source.\n+\n+Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n+wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n+attempt to load C<Module::Name> from the OS, and if that doesn't work\n+will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n+itself.\n+\n+Usually distributors will not ship with Git's Git::FromCPAN tree at\n+all, preferring to use their own packaging of CPAN modules instead.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+\tshift;\n+\tmy $caller = caller;\n+\tmy %args = @_;\n+\tmy $module = exists $args{module} ? delete $args{module} : die \"BUG: Expected 'module' parameter!\";\n+\tmy $import = exists $args{import} ? delete $args{import} : die \"BUG: Expected 'import' parameter!\";\n+\tdie \"BUG: Too many arguments!\" if keys %args;\n+\n+\t# Foo::Bar to Foo/Bar.pm\n+\tmy $package_pm = $module;\n+\t$package_pm =~ s[::][/]g;\n+\t$package_pm .= '.pm';\n+\n+\teval {\n+\t\trequire $package_pm;\n+\t\t1;\n+\t} or do {\n+\t\tmy $error = $@ || \"Zombie Error\";\n+\n+\t\tmy $Git_LoadCPAN_pm_path = $INC{\"Git/LoadCPAN.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\t\trequire File::Basename;\n+\t\tmy $Git_LoadCPAN_pm_root = File::Basename::dirname($Git_LoadCPAN_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_LoadCPAN_pm_path'!\";\n+\n+\t\trequire File::Spec;\n+\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, 'FromCPAN');\n+\t\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\t\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\t\trequire $package_pm;\n+\t};\n+\n+\tif ($import) {\n+\t\tno strict 'refs';\n+\t\t*{\"${caller}::import\"} = sub {\n+\t\t\tshift;\n+\t\t\tuse strict 'refs';\n+\t\t\tunshift @_, $module;\n+\t\t\tgoto &{\"${module}::import\"};\n+\t\t};\n+\t\tuse strict 'refs';\n+\t}\n+}\n+\n+1;\ndiff --git a/perl/Git/LoadCPAN/Error.pm b/perl/Git/LoadCPAN/Error.pm\nindex 3513fe745b..c6d2c45d80 100644\n--- a/perl/Git/LoadCPAN/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-Wraps the import function for the L<Error> module.\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-sub import {\n-    shift;\n-    my $caller = caller;\n-\n-    eval {\n-\trequire Error;\n-\t1;\n-    } or do {\n-\tmy $error = $@ || \"Zombie Error\";\n-\n-\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n-\n-\trequire File::Basename;\n-\tmy $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'!\";\n-\n-\trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n-\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n-\n-\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n-\trequire Error;\n-    };\n-\n-    unshift @_, $caller;\n-    goto &Error::import;\n-}\n+use Git::LoadCPAN (\n+\tmodule => 'Error',\n+\timport => 1,\n+);\n \n 1;\ndiff --git a/perl/Git/LoadCPAN/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nindex 879c2f5cd1..f70a4f064c 100644\n--- a/perl/Git/LoadCPAN/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -2,23 +2,9 @@ package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-eval {\n-    require Mail::Address;\n-    1;\n-} or do {\n-    require Git::FromCPAN::Mail::Address;\n-};\n+use Git::LoadCPAN (\n+\tmodule => 'Mail::Address',\n+\timport => 0,\n+);\n \n 1;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340224","messageId":"20180225194637.18630-12-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 11/13] perl: move the perl/Git/FromCPAN tree to perl/FromCPAN","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:35Z","receivedAt":"2018-02-25T19:47:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the CPAN modules that have lived under perl/Git/FromCPAN since my\n20d2a30f8f (\"Makefile: replace perl/Makefile.PL with simple make\nrules\", 2017-12-10) to perl/FromCPAN.\n\nA subsequent change will teach the Makefile to only install these\ncopies of CPAN modules if a flag that distro packagers would like to\nset isn't set. Due to how the wildcard globbing is being done it's\nmuch easier to accomplish that if they're moved to their own\ndirectory.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                                | 3 +++\n perl/{Git => }/FromCPAN/.gitattributes  | 0\n perl/{Git => }/FromCPAN/Error.pm        | 0\n perl/{Git => }/FromCPAN/Mail/Address.pm | 0\n perl/Git/LoadCPAN.pm                    | 5 ++---\n 5 files changed, 5 insertions(+), 3 deletions(-)\n rename perl/{Git => }/FromCPAN/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Error.pm (100%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (100%)\n\ndiff --git a/Makefile b/Makefile\nindex c56fdc14ca..7b97699864 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2300,9 +2300,12 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n+LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n+LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))\n \n ifndef NO_PERL\n all:: $(LIB_PERL_GEN)\n+all:: $(LIB_CPAN_GEN)\n endif\n \n perl/build/lib/%.pm: perl/%.pm\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/FromCPAN/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/.gitattributes\nrename to perl/FromCPAN/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Error.pm\nrename to perl/FromCPAN/Error.pm\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/FromCPAN/Mail/Address.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/Address.pm\nrename to perl/FromCPAN/Mail/Address.pm\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nindex 1568c177fe..229c1ee87d 100644\n--- a/perl/Git/LoadCPAN.pm\n+++ b/perl/Git/LoadCPAN.pm\n@@ -16,8 +16,7 @@ source.\n Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n attempt to load C<Module::Name> from the OS, and if that doesn't work\n-will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n-itself.\n+will fall back on C<FromCPAN::Module::Name> shipped with Git itself.\n \n Usually distributors will not ship with Git's Git::FromCPAN tree at\n all, preferring to use their own packaging of CPAN modules instead.\n@@ -52,7 +51,7 @@ sub import {\n \t\tmy $Git_LoadCPAN_pm_root = File::Basename::dirname($Git_LoadCPAN_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_LoadCPAN_pm_path'!\";\n \n \t\trequire File::Spec;\n-\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, 'FromCPAN');\n+\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, '..', 'FromCPAN');\n \t\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n \n \t\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340225","messageId":"20180225194637.18630-14-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 13/13] perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:37Z","receivedAt":"2018-02-25T19:47:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Before my 20d2a30f8f (\"Makefile: replace perl/Makefile.PL with simple\nmake rules\", 2017-12-10) on an OS package that removed the\nprivate-Error.pm copy we carried around manually removing the OS's\nError.pm would yield:\n\n    $ git add -p\n    Can't locate Error.pm in @INC (you may need to install the Error module) [...]\n\nNow, before this change we'll instead emit this more cryptic error:\n\n    $ git add -p\n    BUG: '/usr/share/perl5/Git/FromCPAN' should be a directory! at /usr/share/perl5/Git/Error.pm line 36.\n\nThis is a confusing error. Now if the new NO_PERL_CPAN_FALLBACKS\noption is specified and we can't find the module we'll instead emit:\n\n    $ /tmp/git/bin/git add -p\n    BUG: The 'Error' module is not here, but NO_PERL_CPAN_FALLBACKS was set!\n\n    [...]\n\nWhere [...] is the lengthy explanation seen in the change below, which\nexplains what the potential breakage is, and how to fix it.\n\nThe reason for checking @@NO_PERL_CPAN_FALLBACKS@@] against the empty\nstring in Perl is as opposed to checking for a boolean value is that\nthat's (as far as I can tell) make's idea of a string that's set, and\ne.g. NO_PERL_CPAN_FALLBACKS=0 is enough to set NO_PERL_CPAN_FALLBACKS.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n INSTALL              | 11 ++++++++---\n Makefile             |  5 ++++-\n perl/Git/LoadCPAN.pm | 33 ++++++++++++++++++++++++++++++++-\n 3 files changed, 44 insertions(+), 5 deletions(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex 808e07b659..60e515eaf7 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -88,9 +88,9 @@ Issues of note:\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n  - By default (unless NO_PERL is provided) Git will ship various perl\n-   scripts & libraries it needs. However, for simplicity it doesn't\n-   use the ExtUtils::MakeMaker toolchain to decide where to place the\n-   perl libraries. Depending on the system this can result in the perl\n+   scripts. However, for simplicity it doesn't use the\n+   ExtUtils::MakeMaker toolchain to decide where to place the perl\n+   libraries. Depending on the system this can result in the perl\n    libraries not being where you'd like them if they're expected to be\n    used by things other than Git itself.\n \n@@ -102,6 +102,11 @@ Issues of note:\n    Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n    perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n \n+ - Unless NO_PERL is provided Git will ship various perl libraries it\n+   needs. Distributors of Git will usually want to set\n+   NO_PERL_CPAN_FALLBACKS if NO_PERL is not provided to use their own\n+   copies of the CPAN modules Git needs.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex 518c5f6be0..4e0cdb3ca4 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2314,11 +2314,14 @@ all:: $(LIB_PERL_GEN)\n ifndef NO_PERL_CPAN_FALLBACKS\n all:: $(LIB_CPAN_GEN)\n endif\n+NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\\'',$(NO_PERL_CPAN_FALLBACKS))\n endif\n \n perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n-\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \\\n+\t    -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \\\n+\t< $< > $@\n \n perl/build/man/man3/Git.3pm: perl/Git.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nindex 229c1ee87d..e5585e75e8 100644\n--- a/perl/Git/LoadCPAN.pm\n+++ b/perl/Git/LoadCPAN.pm\n@@ -19,13 +19,25 @@ attempt to load C<Module::Name> from the OS, and if that doesn't work\n will fall back on C<FromCPAN::Module::Name> shipped with Git itself.\n \n Usually distributors will not ship with Git's Git::FromCPAN tree at\n-all, preferring to use their own packaging of CPAN modules instead.\n+all via the C<NO_PERL_CPAN_FALLBACKS> option, preferring to use their\n+own packaging of CPAN modules instead.\n \n This module is only intended to be used for code shipping in the\n C<git.git> repository. Use it for anything else at your peril!\n \n =cut\n \n+# NO_PERL_CPAN_FALLBACKS_STR evades the sed search-replace from the\n+# Makefile, and allows for detecting whether the module is loaded from\n+# perl/Git as opposed to perl/build/Git, which is useful for one-off\n+# testing without having Error.pm et al installed.\n+use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';\n+use constant NO_PERL_CPAN_FALLBACKS => (\n+\tq[@@NO_PERL_CPAN_FALLBACKS@@] ne ''\n+\tand\n+\tq[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR\n+);\n+\n sub import {\n \tshift;\n \tmy $caller = caller;\n@@ -45,6 +57,25 @@ sub import {\n \t} or do {\n \t\tmy $error = $@ || \"Zombie Error\";\n \n+\t\tif (NO_PERL_CPAN_FALLBACKS) {\n+\t\t\tchomp(my $error = sprintf <<'THEY_PROMISED', $module);\n+BUG: The '%s' module is not here, but NO_PERL_CPAN_FALLBACKS was set!\n+\n+Git needs this Perl module from the CPAN, and will by default ship\n+with a copy of it. This Git was built with NO_PERL_CPAN_FALLBACKS,\n+meaning that whoever built it promised to provide this module.\n+\n+You're seeing this error because they broke that promise, and we can't\n+load our fallback version, since we were asked not to install it.\n+\n+If you're seeing this error and didn't package Git yourself the\n+package you're using is broken, or your system is broken. This error\n+won't appear if Git is built without NO_PERL_CPAN_FALLBACKS (instead\n+we'll use our fallback version of the module).\n+THEY_PROMISED\n+\t\t\tdie $error;\n+\t\t}\n+\n \t\tmy $Git_LoadCPAN_pm_path = $INC{\"Git/LoadCPAN.pm\"} || die \"BUG: Should have our own path from %INC!\";\n \n \t\trequire File::Basename;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340226","messageId":"20180225194637.18630-13-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v2 12/13] Makefile: add NO_PERL_CPAN_FALLBACKS knob","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-25T19:46:36Z","receivedAt":"2018-02-25T19:47:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Todd Zullinger <tmz@pobox.com>\n\nWe include some perl modules which are not part of the core perl\ninstall, as a convenience.  This allows us to rely on those modules in\nour perl-based tools and scripts without requiring users to install the\nmodules from CPAN or their operating system packages.\n\nUsers whose operating system provides these modules and packagers of Git\noften don't want to ship or use these bundled modules.  Allow these\nusers to set NO_PERL_CPAN_FALLBACKS to avoid installing the bundled\nmodules.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 7b97699864..518c5f6be0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,12 @@ all::\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n+# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n+# copies of CPAN modules that serve as a fallback in case the modules\n+# are not available on the system. This option is intended for\n+# distributions that want to use their packaged versions of Perl\n+# modules, instead of the fallbacks shipped with Git.\n+#\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n # but /usr/bin/python2.7 on some platforms).\n #\n@@ -2305,8 +2311,10 @@ LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))\n \n ifndef NO_PERL\n all:: $(LIB_PERL_GEN)\n+ifndef NO_PERL_CPAN_FALLBACKS\n all:: $(LIB_CPAN_GEN)\n endif\n+endif\n \n perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340228","messageId":"CAPig+cRg+DeGVwPLed4qMdRCqDDcB0b=Zsrf1i0L+aTRsqjRgg@mail.gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-5-avarab@gmail.com","subject":"Re: [PATCH v2 04/13] gitweb: hard-depend on the Digest::MD5 5.8 module","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-02-25T20:00:33Z","receivedAt":"2018-02-25T20:00:39Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Feb 25, 2018 at 2:46 PM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n> 5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\n> conditionally require Digest::MD5 anymore. It was released with perl\n> v5.7.3[1]\n>\n> The initial introduction of the dependency in\n> e9fdd74e53 (\"gitweb: (gr)avatar support\", 2009-06-30) says as much,\n> this also undoes part of the later 2e9c8789b7 (\"gitweb: Mention\n> optional Perl modules in INSTALL\", 2011-02-04) since gitweb will\n> always be run on at least 5.8, so there's no need to mention\n> Digest::MD5 as a required module in the documentation, let's instead\n> say that we require perl 5.8.\n>\n> As with the preceding Net::{SMTP,Domain} change we now unconditionally\n> \"use\" the module instead.\n\nThis is patch 4/13 but the Net::{SMTP,Domain} change doesn't come\nuntil 6/13, so saying \"preceding\" is confusing.\n\n> 1. $ corelist Digest::MD5\n>    Data for 2015-02-14\n>    Digest::MD5 was first released with perl v5.7.3\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"340229","messageId":"CAPig+cSy5-4ErsiftU95Mihw5BqKjf95=iiw_0FBDJtTY0YOXA@mail.gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-7-avarab@gmail.com","subject":"Re: [PATCH v2 06/13] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-02-25T20:03:18Z","receivedAt":"2018-02-25T20:03:23Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Feb 25, 2018 at 2:46 PM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> The Net::SMTP and Net::Domain were both first released with perl\n> v5.7.3[1], since my d48b284183 (\"perl: bump the required Perl version\n> to 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's\n> no reason to conditionally require this anymore.\n\ns/this/them/ or s/this/these/\n\n> This conditional loading was initially added in\n> 87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n> 2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\n> to give real name of the calling host to HELO/EHLO\", 2010-03-14) for\n> Net::Domain, both of which predate the hard dependency on 5.8.\n>\n> Since they're guaranteed to be installed now let's \"use\" them\n> instead. The cost of loading them both is trivial given what\n> git-send-email does (~15ms on my system), and it's better to not defer\n> any potential loading errors until runtime.\n>\n> This patch is better viewed with -w, which shows that the only change\n> in the last two hunks is removing the \"if eval\" wrapper block.\n>\n> 1. $ parallel 'corelist {}' ::: Net::{SMTP,Domain}\n>    Data for 2015-02-14\n>    Net::SMTP was first released with perl v5.7.3\n>\n>    Data for 2015-02-14\n>    Net::Domain was first released with perl v5.7.3\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"340942","messageId":"20180303153817.20270-1-avarab@gmail.com","threadId":"47849","inReplyTo":"20180225194637.18630-1-avarab@gmail.com","subject":"[PATCH v3 00/13] various perl fixes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:04Z","receivedAt":"2018-03-03T15:38:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Same as v2 except rebased on master & a couple of commit message\nfixes, thanks to Eric Sunshine (thanks!). tbdiff with v2:\n\n 4: 0d67af28fb !  4: 8ad874c944 gitweb: hard-depend on the Digest::MD5 5.8 module\n    @@ -14,9 +14,6 @@\n         always be run on at least 5.8, so there's no need to mention\n         Digest::MD5 as a required module in the documentation, let's instead\n         say that we require perl 5.8.\n    -    \n    -    As with the preceding Net::{SMTP,Domain} change we now unconditionally\n    -    \"use\" the module instead.\n         \n         1. $ corelist Digest::MD5\n            Data for 2015-02-14\n [...]\n 6: 92429af3a3 !  6: 3f44312821 git-send-email: unconditionally use Net::{SMTP,Domain}\n    @@ -5,7 +5,7 @@\n         The Net::SMTP and Net::Domain were both first released with perl\n         v5.7.3[1], since my d48b284183 (\"perl: bump the required Perl version\n         to 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's\n    -    no reason to conditionally require this anymore.\n    +    no reason to conditionally require them anymore.\n         \n         This conditional loading was initially added in\n         87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n\nTodd Zullinger (1):\n  Makefile: add NO_PERL_CPAN_FALLBACKS knob\n\nÆvar Arnfjörð Bjarmason (12):\n  perl: *.pm files should not have the executable bit\n  Git.pm: remove redundant \"use strict\" from sub-package\n  Git.pm: add the \"use warnings\" pragma\n  gitweb: hard-depend on the Digest::MD5 5.8 module\n  Git.pm: hard-depend on the File::{Temp,Spec} modules\n  git-send-email: unconditionally use Net::{SMTP,Domain}\n  perl: update our ancient copy of Error.pm\n  perl: update our copy of Mail::Address\n  perl: move CPAN loader wrappers to another namespace\n  perl: generalize the Git::LoadCPAN facility\n  perl: move the perl/Git/FromCPAN tree to perl/FromCPAN\n  perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS\n\n INSTALL                                 |  11 +-\n Makefile                                |  16 +-\n contrib/examples/git-difftool.perl      |   2 +-\n git-send-email.perl                     |  28 ++-\n gitweb/INSTALL                          |   3 +-\n gitweb/gitweb.perl                      |  17 +-\n perl/FromCPAN/.gitattributes            |   1 +\n perl/{Git => }/FromCPAN/Error.pm        | 296 +++++++++++++++++++++++++++-----\n perl/{Git => }/FromCPAN/Mail/Address.pm |   8 +-\n perl/Git.pm                             |  14 +-\n perl/Git/Error.pm                       |  46 -----\n perl/Git/LoadCPAN.pm                    | 104 +++++++++++\n perl/Git/LoadCPAN/Error.pm              |  10 ++\n perl/Git/LoadCPAN/Mail/Address.pm       |  10 ++\n perl/Git/Mail/Address.pm                |  24 ---\n 15 files changed, 432 insertions(+), 158 deletions(-)\n create mode 100644 perl/FromCPAN/.gitattributes\n rename perl/{Git => }/FromCPAN/Error.pm (72%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (96%)\n delete mode 100644 perl/Git/Error.pm\n create mode 100644 perl/Git/LoadCPAN.pm\n create mode 100644 perl/Git/LoadCPAN/Error.pm\n create mode 100644 perl/Git/LoadCPAN/Mail/Address.pm\n delete mode 100755 perl/Git/Mail/Address.pm\n\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340943","messageId":"20180303153817.20270-2-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 01/13] perl: *.pm files should not have the executable bit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:05Z","receivedAt":"2018-03-03T15:38:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Git::Mail::Address file added in bd869f67b9 (\"send-email: add and\nuse a local copy of Mail::Address\", 2018-01-05) had the executable bit\nset. That bit should not be set for *.pm files. It breaks nothing but\nit is redundant and confusing as none of the other files have it and\nthese files are never executed as stand-alone programs.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/Mail/Address.pm | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n mode change 100755 => 100644 perl/Git/Mail/Address.pm\n\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/Mail/Address.pm\nold mode 100755\nnew mode 100644\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340944","messageId":"20180303153817.20270-3-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 02/13] Git.pm: remove redundant \"use strict\" from sub-package","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:06Z","receivedAt":"2018-03-03T15:39:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In Perl the \"use strict/warnings\" pragmas are lexical, thus there's no\nreason to do:\n\n    package Foo;\n    use strict;\n    package Bar;\n    use strict;\n    $x = 5;\n\nTo satisfy the desire that the undeclared $x variable will be spotted\nat compile-time. It's enough to include the first \"use strict\".\n\nThis functionally changes nothing, but makes a subsequent change where\n\"use warnings\" will be added to Git.pm less confusing and less\nverbose, since as with \"strict\" we'll only need to do that at the top\nof the file.\n\nChanges code initially added in a6065b548f (\"Git.pm: Try to support\nActiveState output pipe\", 2006-06-25).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 9d60d7948b..99e5d943af 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -1692,7 +1692,6 @@ sub DESTROY {\n # Pipe implementation for ActiveState Perl.\n \n package Git::activestate_pipe;\n-use strict;\n \n sub TIEHANDLE {\n \tmy ($class, @params) = @_;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340945","messageId":"20180303153817.20270-5-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 04/13] gitweb: hard-depend on the Digest::MD5 5.8 module","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:08Z","receivedAt":"2018-03-03T15:39:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require Digest::MD5 anymore. It was released with perl\nv5.7.3[1]\n\nThe initial introduction of the dependency in\ne9fdd74e53 (\"gitweb: (gr)avatar support\", 2009-06-30) says as much,\nthis also undoes part of the later 2e9c8789b7 (\"gitweb: Mention\noptional Perl modules in INSTALL\", 2011-02-04) since gitweb will\nalways be run on at least 5.8, so there's no need to mention\nDigest::MD5 as a required module in the documentation, let's instead\nsay that we require perl 5.8.\n\n1. $ corelist Digest::MD5\n   Data for 2015-02-14\n   Digest::MD5 was first released with perl v5.7.3\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n gitweb/INSTALL     |  3 +--\n gitweb/gitweb.perl | 17 ++++-------------\n 2 files changed, 5 insertions(+), 15 deletions(-)\n\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex 408f2859d3..a58e6b3c44 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -29,12 +29,11 @@ Requirements\n ------------\n \n  - Core git tools\n- - Perl\n+ - Perl 5.8\n  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.\n  - web server\n \n The following optional Perl modules are required for extra features\n- - Digest::MD5 - for gravatar support\n  - CGI::Fast and FCGI - for running gitweb as FastCGI script\n  - HTML::TagCloud - for fancy tag cloud in project list view\n  - HTTP::Date or Time::ParseDate - to support If-Modified-Since for feeds\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2417057f2b..2594a4badb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -20,6 +20,8 @@ use Fcntl ':mode';\n use File::Find qw();\n use File::Basename qw(basename);\n use Time::HiRes qw(gettimeofday tv_interval);\n+use Digest::MD5 qw(md5_hex);\n+\n binmode STDOUT, ':utf8';\n \n if (!defined($CGI::VERSION) || $CGI::VERSION < 4.08) {\n@@ -490,7 +492,6 @@ our %feature = (\n \t# Currently available providers are gravatar and picon.\n \t# If an unknown provider is specified, the feature is disabled.\n \n-\t# Gravatar depends on Digest::MD5.\n \t# Picon currently relies on the indiana.edu database.\n \n \t# To enable system wide have in $GITWEB_CONFIG\n@@ -1166,18 +1167,8 @@ sub configure_gitweb_features {\n \tour @snapshot_fmts = gitweb_get_feature('snapshot');\n \t@snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);\n \n-\t# check that the avatar feature is set to a known provider name,\n-\t# and for each provider check if the dependencies are satisfied.\n-\t# if the provider name is invalid or the dependencies are not met,\n-\t# reset $git_avatar to the empty string.\n \tour ($git_avatar) = gitweb_get_feature('avatar');\n-\tif ($git_avatar eq 'gravatar') {\n-\t\t$git_avatar = '' unless (eval { require Digest::MD5; 1; });\n-\t} elsif ($git_avatar eq 'picon') {\n-\t\t# no dependencies\n-\t} else {\n-\t\t$git_avatar = '';\n-\t}\n+\t$git_avatar = '' unless $git_avatar =~ /^(?:gravatar|picon)$/s;\n \n \tour @extra_branch_refs = gitweb_get_feature('extra-branch-refs');\n \t@extra_branch_refs = filter_and_validate_refs (@extra_branch_refs);\n@@ -2167,7 +2158,7 @@ sub gravatar_url {\n \tmy $size = shift;\n \t$avatar_cache{$email} ||=\n \t\t\"//www.gravatar.com/avatar/\" .\n-\t\t\tDigest::MD5::md5_hex($email) . \"?s=\";\n+\t\t\tmd5_hex($email) . \"?s=\";\n \treturn $avatar_cache{$email} . $size;\n }\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340946","messageId":"20180303153817.20270-6-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 05/13] Git.pm: hard-depend on the File::{Temp,Spec} modules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:09Z","receivedAt":"2018-03-03T15:39:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since my d48b284183 (\"perl: bump the required Perl version to 5.8 from\n5.6.[21]\", 2010-09-24), we've depended on 5.8, so there's no reason to\nconditionally require File::Temp and File::Spec anymore. They were\nfirst released with perl versions v5.6.1 and 5.00405, respectively.\n\nThis code was originally added in c14c8ceb13 (\"Git.pm: Make File::Spec\nand File::Temp requirement lazy\", 2008-08-15), presumably to make\nGit.pm work on 5.6.0.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 7ec16e6dde..151b0e7144 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -11,6 +11,8 @@ use 5.008;\n use strict;\n use warnings;\n \n+use File::Temp ();\n+use File::Spec ();\n \n BEGIN {\n \n@@ -190,7 +192,6 @@ sub repository {\n \t\t};\n \n \t\tif ($dir) {\n-\t\t\t_verify_require();\n \t\t\tFile::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir;\n \t\t\t$opts{Repository} = abs_path($dir);\n \n@@ -1289,8 +1290,6 @@ sub temp_release {\n sub _temp_cache {\n \tmy ($self, $name) = _maybe_self(@_);\n \n-\t_verify_require();\n-\n \tmy $temp_fd = \\$TEMP_FILEMAP{$name};\n \tif (defined $$temp_fd and $$temp_fd->opened) {\n \t\tif ($TEMP_FILES{$$temp_fd}{locked}) {\n@@ -1324,11 +1323,6 @@ sub _temp_cache {\n \t$$temp_fd;\n }\n \n-sub _verify_require {\n-\teval { require File::Temp; require File::Spec; };\n-\t$@ and throw Error::Simple($@);\n-}\n-\n =item temp_reset ( FILEHANDLE )\n \n Truncates and resets the position of the C<FILEHANDLE>.\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340947","messageId":"20180303153817.20270-4-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 03/13] Git.pm: add the \"use warnings\" pragma","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:07Z","receivedAt":"2018-03-03T15:39:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend Git.pm to load the \"warnings\" pragma like the rest of the code\nin perl/ in addition to the existing \"strict\" pragma. This is\nconsidered the bare minimum best practice in Perl.\n\nEver since this code was introduced in b1edc53d06 (\"Introduce\nGit.pm (v4)\", 2006-06-24) it's only been using \"strict\", not\n\"warnings\".\n\nThis leaves contrib/buildsystems/Generators/{QMake,VCproj}.pm and\ncontrib/mw-to-git/Git/Mediawiki.pm without \"use warnings\". Amending\nthose would be a sensible follow-up change, but I don't have an easy\nway to test those so I'm not changing them.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git.pm | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 99e5d943af..7ec16e6dde 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -9,6 +9,7 @@ package Git;\n \n use 5.008;\n use strict;\n+use warnings;\n \n \n BEGIN {\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340948","messageId":"20180303153817.20270-7-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 06/13] git-send-email: unconditionally use Net::{SMTP,Domain}","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:10Z","receivedAt":"2018-03-03T15:39:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Net::SMTP and Net::Domain were both first released with perl\nv5.7.3[1], since my d48b284183 (\"perl: bump the required Perl version\nto 5.8 from 5.6.[21]\", 2010-09-24) we've depended on 5.8, so there's\nno reason to conditionally require them anymore.\n\nThis conditional loading was initially added in\n87840620fd (\"send-email: only 'require' instead of 'use' Net::SMTP\",\n2006-06-01) for Net::SMTP and 134550fe21 (\"git-send-email.perl - try\nto give real name of the calling host to HELO/EHLO\", 2010-03-14) for\nNet::Domain, both of which predate the hard dependency on 5.8.\n\nSince they're guaranteed to be installed now let's \"use\" them\ninstead. The cost of loading them both is trivial given what\ngit-send-email does (~15ms on my system), and it's better to not defer\nany potential loading errors until runtime.\n\nThis patch is better viewed with -w, which shows that the only change\nin the last two hunks is removing the \"if eval\" wrapper block.\n\n1. $ parallel 'corelist {}' ::: Net::{SMTP,Domain}\n   Data for 2015-02-14\n   Net::SMTP was first released with perl v5.7.3\n\n   Data for 2015-02-14\n   Net::Domain was first released with perl v5.7.3\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-send-email.perl | 24 +++++++++++-------------\n 1 file changed, 11 insertions(+), 13 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex bbf4deaa0d..d5a4826a1c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -31,6 +31,8 @@ use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\n use Git::Mail::Address;\n+use Net::Domain ();\n+use Net::SMTP ();\n \n Getopt::Long::Configure qw/ pass_through /;\n \n@@ -1143,10 +1145,8 @@ sub valid_fqdn {\n sub maildomain_net {\n \tmy $maildomain;\n \n-\tif (eval { require Net::Domain; 1 }) {\n-\t\tmy $domain = Net::Domain::domainname();\n-\t\t$maildomain = $domain if valid_fqdn($domain);\n-\t}\n+\tmy $domain = Net::Domain::domainname();\n+\t$maildomain = $domain if valid_fqdn($domain);\n \n \treturn $maildomain;\n }\n@@ -1154,17 +1154,15 @@ sub maildomain_net {\n sub maildomain_mta {\n \tmy $maildomain;\n \n-\tif (eval { require Net::SMTP; 1 }) {\n-\t\tfor my $host (qw(mailhost localhost)) {\n-\t\t\tmy $smtp = Net::SMTP->new($host);\n-\t\t\tif (defined $smtp) {\n-\t\t\t\tmy $domain = $smtp->domain;\n-\t\t\t\t$smtp->quit;\n+\tfor my $host (qw(mailhost localhost)) {\n+\t\tmy $smtp = Net::SMTP->new($host);\n+\t\tif (defined $smtp) {\n+\t\t\tmy $domain = $smtp->domain;\n+\t\t\t$smtp->quit;\n \n-\t\t\t\t$maildomain = $domain if valid_fqdn($domain);\n+\t\t\t$maildomain = $domain if valid_fqdn($domain);\n \n-\t\t\t\tlast if $maildomain;\n-\t\t\t}\n+\t\t\tlast if $maildomain;\n \t\t}\n \t}\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340949","messageId":"20180303153817.20270-11-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 10/13] perl: generalize the Git::LoadCPAN facility","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:14Z","receivedAt":"2018-03-03T15:39:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the two wrappers that load from CPAN (local OS) or our own copy\nto do so via the same codepath.\n\nI added the Error.pm wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10), and shortly\nafterwards Matthieu Moy added a wrapper for Mail::Address in\nbd869f67b9 (\"send-email: add and use a local copy of Mail::Address\",\n2018-01-05).\n\nHis loader was simpler since Mail::Address doesn't have an \"import\"\nmethod, but didn't do the same sanity checking; For example, a missing\nFromCPAN directory (which OS packages are likely not to have) wouldn't\nbe explicitly warned about as a \"BUG: ...\".\n\nUpdate both to use a common implementation based on the previous\nError.pm loader. Which has been amended to take the module to load as\nparameter, as well as whether or not that module has an import\nmethod.\n\nThis loader should be generic enough to handle almost all CPAN modules\nout there, some use some crazy loading magic and wouldn't like being\nwrapped like this, but that would be immediately obvious, and we'd\nfind out right away since the module wouldn't work at all.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/LoadCPAN.pm              | 74 +++++++++++++++++++++++++++++++++++++++\n perl/Git/LoadCPAN/Error.pm        | 44 +++--------------------\n perl/Git/LoadCPAN/Mail/Address.pm | 22 +++---------\n 3 files changed, 82 insertions(+), 58 deletions(-)\n create mode 100644 perl/Git/LoadCPAN.pm\n\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nnew file mode 100644\nindex 0000000000..1568c177fe\n--- /dev/null\n+++ b/perl/Git/LoadCPAN.pm\n@@ -0,0 +1,74 @@\n+package Git::LoadCPAN;\n+use 5.008;\n+use strict;\n+use warnings;\n+\n+=head1 NAME\n+\n+Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy\n+\n+=head1 DESCRIPTION\n+\n+The Perl code in Git depends on some modules from the CPAN, but we\n+don't want to make those a hard requirement for anyone building from\n+source.\n+\n+Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n+wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n+attempt to load C<Module::Name> from the OS, and if that doesn't work\n+will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n+itself.\n+\n+Usually distributors will not ship with Git's Git::FromCPAN tree at\n+all, preferring to use their own packaging of CPAN modules instead.\n+\n+This module is only intended to be used for code shipping in the\n+C<git.git> repository. Use it for anything else at your peril!\n+\n+=cut\n+\n+sub import {\n+\tshift;\n+\tmy $caller = caller;\n+\tmy %args = @_;\n+\tmy $module = exists $args{module} ? delete $args{module} : die \"BUG: Expected 'module' parameter!\";\n+\tmy $import = exists $args{import} ? delete $args{import} : die \"BUG: Expected 'import' parameter!\";\n+\tdie \"BUG: Too many arguments!\" if keys %args;\n+\n+\t# Foo::Bar to Foo/Bar.pm\n+\tmy $package_pm = $module;\n+\t$package_pm =~ s[::][/]g;\n+\t$package_pm .= '.pm';\n+\n+\teval {\n+\t\trequire $package_pm;\n+\t\t1;\n+\t} or do {\n+\t\tmy $error = $@ || \"Zombie Error\";\n+\n+\t\tmy $Git_LoadCPAN_pm_path = $INC{\"Git/LoadCPAN.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\n+\t\trequire File::Basename;\n+\t\tmy $Git_LoadCPAN_pm_root = File::Basename::dirname($Git_LoadCPAN_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_LoadCPAN_pm_path'!\";\n+\n+\t\trequire File::Spec;\n+\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, 'FromCPAN');\n+\t\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n+\n+\t\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n+\t\trequire $package_pm;\n+\t};\n+\n+\tif ($import) {\n+\t\tno strict 'refs';\n+\t\t*{\"${caller}::import\"} = sub {\n+\t\t\tshift;\n+\t\t\tuse strict 'refs';\n+\t\t\tunshift @_, $module;\n+\t\t\tgoto &{\"${module}::import\"};\n+\t\t};\n+\t\tuse strict 'refs';\n+\t}\n+}\n+\n+1;\ndiff --git a/perl/Git/LoadCPAN/Error.pm b/perl/Git/LoadCPAN/Error.pm\nindex 3513fe745b..c6d2c45d80 100644\n--- a/perl/Git/LoadCPAN/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-Wraps the import function for the L<Error> module.\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-sub import {\n-    shift;\n-    my $caller = caller;\n-\n-    eval {\n-\trequire Error;\n-\t1;\n-    } or do {\n-\tmy $error = $@ || \"Zombie Error\";\n-\n-\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n-\n-\trequire File::Basename;\n-\tmy $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'!\";\n-\n-\trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n-\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n-\n-\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n-\trequire Error;\n-    };\n-\n-    unshift @_, $caller;\n-    goto &Error::import;\n-}\n+use Git::LoadCPAN (\n+\tmodule => 'Error',\n+\timport => 1,\n+);\n \n 1;\ndiff --git a/perl/Git/LoadCPAN/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nindex 879c2f5cd1..f70a4f064c 100644\n--- a/perl/Git/LoadCPAN/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -2,23 +2,9 @@ package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n-\n-=head1 NAME\n-\n-Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n-\n-=head1 DESCRIPTION\n-\n-This module is only intended to be used for code shipping in the\n-C<git.git> repository. Use it for anything else at your peril!\n-\n-=cut\n-\n-eval {\n-    require Mail::Address;\n-    1;\n-} or do {\n-    require Git::FromCPAN::Mail::Address;\n-};\n+use Git::LoadCPAN (\n+\tmodule => 'Mail::Address',\n+\timport => 0,\n+);\n \n 1;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340950","messageId":"20180303153817.20270-12-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 11/13] perl: move the perl/Git/FromCPAN tree to perl/FromCPAN","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:15Z","receivedAt":"2018-03-03T15:39:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the CPAN modules that have lived under perl/Git/FromCPAN since my\n20d2a30f8f (\"Makefile: replace perl/Makefile.PL with simple make\nrules\", 2017-12-10) to perl/FromCPAN.\n\nA subsequent change will teach the Makefile to only install these\ncopies of CPAN modules if a flag that distro packagers would like to\nset isn't set. Due to how the wildcard globbing is being done it's\nmuch easier to accomplish that if they're moved to their own\ndirectory.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                                | 3 +++\n perl/{Git => }/FromCPAN/.gitattributes  | 0\n perl/{Git => }/FromCPAN/Error.pm        | 0\n perl/{Git => }/FromCPAN/Mail/Address.pm | 0\n perl/Git/LoadCPAN.pm                    | 5 ++---\n 5 files changed, 5 insertions(+), 3 deletions(-)\n rename perl/{Git => }/FromCPAN/.gitattributes (100%)\n rename perl/{Git => }/FromCPAN/Error.pm (100%)\n rename perl/{Git => }/FromCPAN/Mail/Address.pm (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 5ae9616e0a..026b9fb6d6 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2302,9 +2302,12 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n+LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)\n+LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))\n \n ifndef NO_PERL\n all:: $(LIB_PERL_GEN)\n+all:: $(LIB_CPAN_GEN)\n endif\n \n perl/build/lib/%.pm: perl/%.pm\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/FromCPAN/.gitattributes\nsimilarity index 100%\nrename from perl/Git/FromCPAN/.gitattributes\nrename to perl/FromCPAN/.gitattributes\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Error.pm\nrename to perl/FromCPAN/Error.pm\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/FromCPAN/Mail/Address.pm\nsimilarity index 100%\nrename from perl/Git/FromCPAN/Mail/Address.pm\nrename to perl/FromCPAN/Mail/Address.pm\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nindex 1568c177fe..229c1ee87d 100644\n--- a/perl/Git/LoadCPAN.pm\n+++ b/perl/Git/LoadCPAN.pm\n@@ -16,8 +16,7 @@ source.\n Therefore the L<Git::LoadCPAN> namespace shipped with Git contains\n wrapper modules like C<Git::LoadCPAN::Module::Name> that will first\n attempt to load C<Module::Name> from the OS, and if that doesn't work\n-will fall back on C<Git::FromCPAN::Module::Name> shipped with Git\n-itself.\n+will fall back on C<FromCPAN::Module::Name> shipped with Git itself.\n \n Usually distributors will not ship with Git's Git::FromCPAN tree at\n all, preferring to use their own packaging of CPAN modules instead.\n@@ -52,7 +51,7 @@ sub import {\n \t\tmy $Git_LoadCPAN_pm_root = File::Basename::dirname($Git_LoadCPAN_pm_path) || die \"BUG: Can't figure out lib/Git dirname from '$Git_LoadCPAN_pm_path'!\";\n \n \t\trequire File::Spec;\n-\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, 'FromCPAN');\n+\t\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_LoadCPAN_pm_root, '..', 'FromCPAN');\n \t\tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n \n \t\tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340951","messageId":"20180303153817.20270-13-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 12/13] Makefile: add NO_PERL_CPAN_FALLBACKS knob","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:16Z","receivedAt":"2018-03-03T15:39:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Todd Zullinger <tmz@pobox.com>\n\nWe include some perl modules which are not part of the core perl\ninstall, as a convenience.  This allows us to rely on those modules in\nour perl-based tools and scripts without requiring users to install the\nmodules from CPAN or their operating system packages.\n\nUsers whose operating system provides these modules and packagers of Git\noften don't want to ship or use these bundled modules.  Allow these\nusers to set NO_PERL_CPAN_FALLBACKS to avoid installing the bundled\nmodules.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 026b9fb6d6..cbf0bc2344 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,12 @@ all::\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n+# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled\n+# copies of CPAN modules that serve as a fallback in case the modules\n+# are not available on the system. This option is intended for\n+# distributions that want to use their packaged versions of Perl\n+# modules, instead of the fallbacks shipped with Git.\n+#\n # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python\n # but /usr/bin/python2.7 on some platforms).\n #\n@@ -2307,8 +2313,10 @@ LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))\n \n ifndef NO_PERL\n all:: $(LIB_PERL_GEN)\n+ifndef NO_PERL_CPAN_FALLBACKS\n all:: $(LIB_CPAN_GEN)\n endif\n+endif\n \n perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340952","messageId":"20180303153817.20270-14-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 13/13] perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:17Z","receivedAt":"2018-03-03T15:39:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Before my 20d2a30f8f (\"Makefile: replace perl/Makefile.PL with simple\nmake rules\", 2017-12-10) on an OS package that removed the\nprivate-Error.pm copy we carried around manually removing the OS's\nError.pm would yield:\n\n    $ git add -p\n    Can't locate Error.pm in @INC (you may need to install the Error module) [...]\n\nNow, before this change we'll instead emit this more cryptic error:\n\n    $ git add -p\n    BUG: '/usr/share/perl5/Git/FromCPAN' should be a directory! at /usr/share/perl5/Git/Error.pm line 36.\n\nThis is a confusing error. Now if the new NO_PERL_CPAN_FALLBACKS\noption is specified and we can't find the module we'll instead emit:\n\n    $ /tmp/git/bin/git add -p\n    BUG: The 'Error' module is not here, but NO_PERL_CPAN_FALLBACKS was set!\n\n    [...]\n\nWhere [...] is the lengthy explanation seen in the change below, which\nexplains what the potential breakage is, and how to fix it.\n\nThe reason for checking @@NO_PERL_CPAN_FALLBACKS@@] against the empty\nstring in Perl is as opposed to checking for a boolean value is that\nthat's (as far as I can tell) make's idea of a string that's set, and\ne.g. NO_PERL_CPAN_FALLBACKS=0 is enough to set NO_PERL_CPAN_FALLBACKS.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n INSTALL              | 11 ++++++++---\n Makefile             |  5 ++++-\n perl/Git/LoadCPAN.pm | 33 ++++++++++++++++++++++++++++++++-\n 3 files changed, 44 insertions(+), 5 deletions(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex 808e07b659..60e515eaf7 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -88,9 +88,9 @@ Issues of note:\n \texport GIT_EXEC_PATH PATH GITPERLLIB\n \n  - By default (unless NO_PERL is provided) Git will ship various perl\n-   scripts & libraries it needs. However, for simplicity it doesn't\n-   use the ExtUtils::MakeMaker toolchain to decide where to place the\n-   perl libraries. Depending on the system this can result in the perl\n+   scripts. However, for simplicity it doesn't use the\n+   ExtUtils::MakeMaker toolchain to decide where to place the perl\n+   libraries. Depending on the system this can result in the perl\n    libraries not being where you'd like them if they're expected to be\n    used by things other than Git itself.\n \n@@ -102,6 +102,11 @@ Issues of note:\n    Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,\n    perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.\n \n+ - Unless NO_PERL is provided Git will ship various perl libraries it\n+   needs. Distributors of Git will usually want to set\n+   NO_PERL_CPAN_FALLBACKS if NO_PERL is not provided to use their own\n+   copies of the CPAN modules Git needs.\n+\n  - Git is reasonably self-sufficient, but does depend on a few external\n    programs and libraries.  Git can be used without most of them by adding\n    the approriate \"NO_<LIBRARY>=YesPlease\" to the make command line or\ndiff --git a/Makefile b/Makefile\nindex cbf0bc2344..56fc2d6f08 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2316,11 +2316,14 @@ all:: $(LIB_PERL_GEN)\n ifndef NO_PERL_CPAN_FALLBACKS\n all:: $(LIB_CPAN_GEN)\n endif\n+NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\\'',$(NO_PERL_CPAN_FALLBACKS))\n endif\n \n perl/build/lib/%.pm: perl/%.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\n-\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@\n+\tsed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \\\n+\t    -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \\\n+\t< $< > $@\n \n perl/build/man/man3/Git.3pm: perl/Git.pm\n \t$(QUIET_GEN)mkdir -p $(dir $@) && \\\ndiff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm\nindex 229c1ee87d..e5585e75e8 100644\n--- a/perl/Git/LoadCPAN.pm\n+++ b/perl/Git/LoadCPAN.pm\n@@ -19,13 +19,25 @@ attempt to load C<Module::Name> from the OS, and if that doesn't work\n will fall back on C<FromCPAN::Module::Name> shipped with Git itself.\n \n Usually distributors will not ship with Git's Git::FromCPAN tree at\n-all, preferring to use their own packaging of CPAN modules instead.\n+all via the C<NO_PERL_CPAN_FALLBACKS> option, preferring to use their\n+own packaging of CPAN modules instead.\n \n This module is only intended to be used for code shipping in the\n C<git.git> repository. Use it for anything else at your peril!\n \n =cut\n \n+# NO_PERL_CPAN_FALLBACKS_STR evades the sed search-replace from the\n+# Makefile, and allows for detecting whether the module is loaded from\n+# perl/Git as opposed to perl/build/Git, which is useful for one-off\n+# testing without having Error.pm et al installed.\n+use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';\n+use constant NO_PERL_CPAN_FALLBACKS => (\n+\tq[@@NO_PERL_CPAN_FALLBACKS@@] ne ''\n+\tand\n+\tq[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR\n+);\n+\n sub import {\n \tshift;\n \tmy $caller = caller;\n@@ -45,6 +57,25 @@ sub import {\n \t} or do {\n \t\tmy $error = $@ || \"Zombie Error\";\n \n+\t\tif (NO_PERL_CPAN_FALLBACKS) {\n+\t\t\tchomp(my $error = sprintf <<'THEY_PROMISED', $module);\n+BUG: The '%s' module is not here, but NO_PERL_CPAN_FALLBACKS was set!\n+\n+Git needs this Perl module from the CPAN, and will by default ship\n+with a copy of it. This Git was built with NO_PERL_CPAN_FALLBACKS,\n+meaning that whoever built it promised to provide this module.\n+\n+You're seeing this error because they broke that promise, and we can't\n+load our fallback version, since we were asked not to install it.\n+\n+If you're seeing this error and didn't package Git yourself the\n+package you're using is broken, or your system is broken. This error\n+won't appear if Git is built without NO_PERL_CPAN_FALLBACKS (instead\n+we'll use our fallback version of the module).\n+THEY_PROMISED\n+\t\t\tdie $error;\n+\t\t}\n+\n \t\tmy $Git_LoadCPAN_pm_path = $INC{\"Git/LoadCPAN.pm\"} || die \"BUG: Should have our own path from %INC!\";\n \n \t\trequire File::Basename;\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340953","messageId":"20180303153817.20270-9-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 08/13] perl: update our copy of Mail::Address","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:12Z","receivedAt":"2018-03-03T15:39:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Update our copy of Mail::Address from 2.19 (Aug 22, 2017) to 2.20 (Jan\n23, 2018). Like the preceding Error.pm update this is done simply to\nkeep up-to-date with upstream, and as can be shown from the diff\nthere's no functional changes.\n\nThe updated source was retrieved from\nhttps://fastapi.metacpan.org/source/MARKOV/MailTools-2.20/lib/Mail/Address.pm\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/Mail/Address.pm | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/FromCPAN/Mail/Address.pm b/perl/Git/FromCPAN/Mail/Address.pm\nindex 13b2ff7d05..683d490b2b 100644\n--- a/perl/Git/FromCPAN/Mail/Address.pm\n+++ b/perl/Git/FromCPAN/Mail/Address.pm\n@@ -1,10 +1,14 @@\n-# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>].\n+# Copyrights 1995-2018 by [Mark Overmeer].\n #  For other contributors see ChangeLog.\n # See the manual pages for details on the licensing terms.\n # Pod stripped from pm file by OODoc 2.02.\n+# This code is part of the bundle MailTools.  Meta-POD processed with\n+# OODoc into POD and HTML manual-pages.  See README.md for Copyright.\n+# Licensed under the same terms as Perl itself.\n+\n package Mail::Address;\n use vars '$VERSION';\n-$VERSION = '2.19';\n+$VERSION = '2.20';\n \n use strict;\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340954","messageId":"20180303153817.20270-10-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 09/13] perl: move CPAN loader wrappers to another namespace","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:13Z","receivedAt":"2018-03-03T15:39:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the Git::Error and Git::Mail::Address wrappers to the\nGit::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error. That\nmodule will then either load Error from CPAN (if installed on the OS),\nor use Git::FromCPAN::Error.\n\nWhen I added the Error wrapper in 20d2a30f8f (\"Makefile: replace\nperl/Makefile.PL with simple make rules\", 2017-12-10) I didn't think\nabout how confusing it would be to have these modules sitting in the\nsame tree as our normal modules. Let's put these all into\nGit::{Load,From}CPAN::* to clearly distinguish them from the rest.\n\nThis also makes things a bit less confusing since there was already a\nGit::Error namespace ever since 8b9150e3e3 (\"Git.pm: Handle failed\ncommands' output\", 2006-06-24).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/examples/git-difftool.perl      | 2 +-\n git-send-email.perl                     | 4 ++--\n perl/Git.pm                             | 2 +-\n perl/Git/{ => LoadCPAN}/Error.pm        | 8 ++++----\n perl/Git/{ => LoadCPAN}/Mail/Address.pm | 4 ++--\n 5 files changed, 10 insertions(+), 10 deletions(-)\n rename perl/Git/{ => LoadCPAN}/Error.pm (78%)\n rename perl/Git/{ => LoadCPAN}/Mail/Address.pm (69%)\n\ndiff --git a/contrib/examples/git-difftool.perl b/contrib/examples/git-difftool.perl\nindex fb0fd0b84b..b2ea80f9ed 100755\n--- a/contrib/examples/git-difftool.perl\n+++ b/contrib/examples/git-difftool.perl\n@@ -13,7 +13,7 @@\n use 5.008;\n use strict;\n use warnings;\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use File::Basename qw(dirname);\n use File::Copy;\n use File::Find;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d5a4826a1c..1ec22c5ef3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -26,13 +26,13 @@ use Text::ParseWords;\n use Term::ANSIColor;\n use File::Temp qw/ tempdir tempfile /;\n use File::Spec::Functions qw(catdir catfile);\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use Git;\n use Git::I18N;\n-use Git::Mail::Address;\n use Net::Domain ();\n use Net::SMTP ();\n+use Git::LoadCPAN::Mail::Address;\n \n Getopt::Long::Configure qw/ pass_through /;\n \ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 151b0e7144..9f246c7988 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -104,7 +104,7 @@ increase notwithstanding).\n \n \n use Carp qw(carp croak); # but croak is bad - throw instead\n-use Git::Error qw(:try);\n+use Git::LoadCPAN::Error qw(:try);\n use Cwd qw(abs_path cwd);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\ndiff --git a/perl/Git/Error.pm b/perl/Git/LoadCPAN/Error.pm\nsimilarity index 78%\nrename from perl/Git/Error.pm\nrename to perl/Git/LoadCPAN/Error.pm\nindex 09bbc97390..3513fe745b 100644\n--- a/perl/Git/Error.pm\n+++ b/perl/Git/LoadCPAN/Error.pm\n@@ -1,11 +1,11 @@\n-package Git::Error;\n+package Git::LoadCPAN::Error;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Error - Wrapper for the L<Error> module, in case it's not installed\n+Git::LoadCPAN::Error - Wrapper for the L<Error> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n@@ -26,13 +26,13 @@ sub import {\n     } or do {\n \tmy $error = $@ || \"Zombie Error\";\n \n-\tmy $Git_Error_pm_path = $INC{\"Git/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n+\tmy $Git_Error_pm_path = $INC{\"Git/LoadCPAN/Error.pm\"} || die \"BUG: Should have our own path from %INC!\";\n \n \trequire File::Basename;\n \tmy $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'!\";\n \n \trequire File::Spec;\n-\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');\n+\tmy $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, '..', 'FromCPAN');\n \tdie \"BUG: '$Git_pm_FromCPAN_root' should be a directory!\" unless -d $Git_pm_FromCPAN_root;\n \n \tlocal @INC = ($Git_pm_FromCPAN_root, @INC);\ndiff --git a/perl/Git/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm\nsimilarity index 69%\nrename from perl/Git/Mail/Address.pm\nrename to perl/Git/LoadCPAN/Mail/Address.pm\nindex 2ce3e84670..879c2f5cd1 100644\n--- a/perl/Git/Mail/Address.pm\n+++ b/perl/Git/LoadCPAN/Mail/Address.pm\n@@ -1,11 +1,11 @@\n-package Git::Mail::Address;\n+package Git::LoadCPAN::Mail::Address;\n use 5.008;\n use strict;\n use warnings;\n \n =head1 NAME\n \n-Git::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n+Git::LoadCPAN::Mail::Address - Wrapper for the L<Mail::Address> module, in case it's not installed\n \n =head1 DESCRIPTION\n \n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"340955","messageId":"20180303153817.20270-8-avarab@gmail.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"[PATCH v3 07/13] perl: update our ancient copy of Error.pm","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-03T15:38:11Z","receivedAt":"2018-03-03T15:40:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The Error.pm shipped with Git as a fallback if there was no Error.pm\non the system was released in April 2006. There's been dozens of\nreleases since then, the latest at August 7, 2017. Let's update to\nthat.\n\nI don't know of anything we need from this new release or which this\nfixes. This change is simply a matter of keeping up with\nupstream. Before this users who'd install git via their package system\nwould get an up-to-date Error.pm, but if it's installed from source\nthey'd get one more than a decade old.\n\nThis undoes a local hack we'd accumulated in 96bc4de85c (\"Eliminate\nScalar::Util usage from private-Error.pm\", 2006-07-26), it's been\nredundant since my d48b284183 (\"perl: bump the required Perl version\nto 5.8 from 5.6.[21]\", 2010-09-24).\n\nThis also undoes 3a51467b94 (\"Typo fix: replacing it's -> its\",\n2013-04-13). This is the Nth time I find that some upstream code of\nours (in contrib/, in sha1dc/ and now in perl/ ...) has diverged from\nupstream because of some tree-wide typo fixing. Let's not do those\nfixes against upstream projects, it's more valuable that we have a 1=1\nmapping to upstream than to fix typos in docs we never even generate\nfrom this code. If someone wants to fix typos in them fine, but they\nshould do it with a patch to upstream which git.git can then\nincorporate.\n\nThe upstream code doesn't cleanly pass a --check, so I'm adding a\n.gitattributes file for similar reasons as done for sha1dc in\n5d184f468e (\"sha1dc: ignore indent-with-non-tab whitespace\nviolations\", 2017-06-06).\n\nThe updated source was retrieved from\nhttps://fastapi.metacpan.org/source/SHLOMIF/Error-0.17025/lib/Error.pm\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n perl/Git/FromCPAN/.gitattributes |   1 +\n perl/Git/FromCPAN/Error.pm       | 296 +++++++++++++++++++++++++++++++++------\n 2 files changed, 256 insertions(+), 41 deletions(-)\n create mode 100644 perl/Git/FromCPAN/.gitattributes\n\ndiff --git a/perl/Git/FromCPAN/.gitattributes b/perl/Git/FromCPAN/.gitattributes\nnew file mode 100644\nindex 0000000000..8b64fc5e22\n--- /dev/null\n+++ b/perl/Git/FromCPAN/.gitattributes\n@@ -0,0 +1 @@\n+/Error.pm whitespace=-blank-at-eof\ndiff --git a/perl/Git/FromCPAN/Error.pm b/perl/Git/FromCPAN/Error.pm\nindex 6098135ae2..f9c36e9e98 100644\n--- a/perl/Git/FromCPAN/Error.pm\n+++ b/perl/Git/FromCPAN/Error.pm\n@@ -12,10 +12,12 @@\n package Error;\n \n use strict;\n+use warnings;\n+\n use vars qw($VERSION);\n use 5.004;\n \n-$VERSION = \"0.15009\";\n+$VERSION = \"0.17025\";\n \n use overload (\n \t'\"\"'\t   =>\t'stringify',\n@@ -32,21 +34,35 @@ $Error::THROWN = undef;\t# last error thrown, a workaround until die $ref works\n my $LAST;\t\t# Last error created\n my %ERROR;\t\t# Last error associated with package\n \n-sub throw_Error_Simple\n+sub _throw_Error_Simple\n {\n     my $args = shift;\n     return Error::Simple->new($args->{'text'});\n }\n \n-$Error::ObjectifyCallback = \\&throw_Error_Simple;\n+$Error::ObjectifyCallback = \\&_throw_Error_Simple;\n \n \n # Exported subs are defined in Error::subs\n \n+use Scalar::Util ();\n+\n sub import {\n     shift;\n+    my @tags = @_;\n     local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;\n-    Error::subs->import(@_);\n+\n+    @tags = grep {\n+       if( $_ eq ':warndie' ) {\n+          Error::WarnDie->import();\n+          0;\n+       }\n+       else {\n+          1;\n+       }\n+    } @tags;\n+\n+    Error::subs->import(@tags);\n }\n \n # I really want to use last for the name of this method, but it is a keyword\n@@ -107,10 +123,6 @@ sub stacktrace {\n     $text;\n }\n \n-# Allow error propagation, ie\n-#\n-# $ber->encode(...) or\n-#    return Error->prior($ber)->associate($ldap);\n \n sub associate {\n     my $err = shift;\n@@ -130,6 +142,7 @@ sub associate {\n     return;\n }\n \n+\n sub new {\n     my $self = shift;\n     my($pkg,$file,$line) = caller($Error::Depth);\n@@ -246,6 +259,10 @@ sub value {\n \n package Error::Simple;\n \n+use vars qw($VERSION);\n+\n+$VERSION = \"0.17025\";\n+\n @Error::Simple::ISA = qw(Error);\n \n sub new {\n@@ -288,14 +305,6 @@ use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS);\n \n @ISA = qw(Exporter);\n \n-\n-sub blessed {\n-\tmy $item = shift;\n-\tlocal $@; # don't kill an outer $@\n-\tref $item and eval { $item->can('can') };\n-}\n-\n-\n sub run_clauses ($$$\\@) {\n     my($clauses,$err,$wantarray,$result) = @_;\n     my $code = undef;\n@@ -314,16 +323,17 @@ sub run_clauses ($$$\\@) {\n \t\tmy $pkg = $catch->[$i];\n \t\tunless(defined $pkg) {\n \t\t    #except\n-\t\t    splice(@$catch,$i,2,$catch->[$i+1]->());\n+\t\t    splice(@$catch,$i,2,$catch->[$i+1]->($err));\n \t\t    $i -= 2;\n \t\t    next CATCHLOOP;\n \t\t}\n-\t\telsif(blessed($err) && $err->isa($pkg)) {\n+\t\telsif(Scalar::Util::blessed($err) && $err->isa($pkg)) {\n \t\t    $code = $catch->[$i+1];\n \t\t    while(1) {\n \t\t\tmy $more = 0;\n-\t\t\tlocal($Error::THROWN);\n+\t\t\tlocal($Error::THROWN, $@);\n \t\t\tmy $ok = eval {\n+\t\t\t    $@ = $err;\n \t\t\t    if($wantarray) {\n \t\t\t\t@{$result} = $code->($err,\\$more);\n \t\t\t    }\n@@ -341,10 +351,9 @@ sub run_clauses ($$$\\@) {\n \t\t\t    undef $err;\n \t\t\t}\n \t\t\telse {\n-\t\t\t    $err = defined($Error::THROWN)\n-\t\t\t\t    ? $Error::THROWN : $@;\n-                $err = $Error::ObjectifyCallback->({'text' =>$err})\n-                    unless ref($err);\n+\t\t\t    $err = $@ || $Error::THROWN;\n+\t\t\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\t\t\tunless ref($err);\n \t\t\t}\n \t\t\tlast CATCH;\n \t\t    };\n@@ -357,7 +366,9 @@ sub run_clauses ($$$\\@) {\n \tif(defined($owise = $clauses->{'otherwise'})) {\n \t    my $code = $clauses->{'otherwise'};\n \t    my $more = 0;\n+        local($Error::THROWN, $@);\n \t    my $ok = eval {\n+\t\t$@ = $err;\n \t\tif($wantarray) {\n \t\t    @{$result} = $code->($err,\\$more);\n \t\t}\n@@ -374,11 +385,10 @@ sub run_clauses ($$$\\@) {\n \t\tundef $err;\n \t    }\n \t    else {\n-\t\t$err = defined($Error::THROWN)\n-\t\t\t? $Error::THROWN : $@;\n+\t\t$err = $@ || $Error::THROWN;\n \n-        $err = $Error::ObjectifyCallback->({'text' =>$err})\n-            unless ref($err);\n+\t\t$err = $Error::ObjectifyCallback->({'text' =>$err})\n+\t\t\tunless ref($err);\n \t    }\n \t}\n     }\n@@ -398,7 +408,7 @@ sub try (&;$) {\n \n     do {\n \tlocal $Error::THROWN = undef;\n-    local $@ = undef;\n+\tlocal $@ = undef;\n \n \t$ok = eval {\n \t    if($wantarray) {\n@@ -413,21 +423,21 @@ sub try (&;$) {\n \t    1;\n \t};\n \n-\t$err = defined($Error::THROWN) ? $Error::THROWN : $@\n+\t$err = $@ || $Error::THROWN\n \t    unless $ok;\n     };\n \n     shift @Error::STACK;\n \n     $err = run_clauses($clauses,$err,wantarray,@result)\n-\tunless($ok);\n+    unless($ok);\n \n     $clauses->{'finally'}->()\n \tif(defined($clauses->{'finally'}));\n \n     if (defined($err))\n     {\n-        if (blessed($err) && $err->can('throw'))\n+        if (Scalar::Util::blessed($err) && $err->can('throw'))\n         {\n             throw $err;\n         }\n@@ -506,12 +516,116 @@ sub otherwise (&;$) {\n }\n \n 1;\n+\n+package Error::WarnDie;\n+\n+sub gen_callstack($)\n+{\n+    my ( $start ) = @_;\n+\n+    require Carp;\n+    local $Carp::CarpLevel = $start;\n+    my $trace = Carp::longmess(\"\");\n+    # Remove try calls from the trace\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    $trace =~ s/(\\n\\s+\\S+__ANON__[^\\n]+)?\\n\\s+eval[^\\n]+\\n\\s+Error::subs::run_clauses[^\\n]+\\n\\s+Error::subs::try[^\\n]+(?=\\n)//sog;\n+    my @callstack = split( m/\\n/, $trace );\n+    return @callstack;\n+}\n+\n+my $old_DIE;\n+my $old_WARN;\n+\n+sub DEATH\n+{\n+    my ( $e ) = @_;\n+\n+    local $SIG{__DIE__} = $old_DIE if( defined $old_DIE );\n+\n+    die @_ if $^S;\n+\n+    my ( $etype, $message, $location, @callstack );\n+    if ( ref($e) && $e->isa( \"Error\" ) ) {\n+        $etype = \"exception of type \" . ref( $e );\n+        $message = $e->text;\n+        $location = $e->file . \":\" . $e->line;\n+        @callstack = split( m/\\n/, $e->stacktrace );\n+    }\n+    else {\n+        # Don't apply subsequent layer of message formatting\n+        die $e if( $e =~ m/^\\nUnhandled perl error caught at toplevel:\\n\\n/ );\n+        $etype = \"perl error\";\n+        my $stackdepth = 0;\n+        while( caller( $stackdepth ) =~ m/^Error(?:$|::)/ ) {\n+            $stackdepth++\n+        }\n+\n+        @callstack = gen_callstack( $stackdepth + 1 );\n+\n+        $message = \"$e\";\n+        chomp $message;\n+\n+        if ( $message =~ s/ at (.*?) line (\\d+)\\.$// ) {\n+            $location = $1 . \":\" . $2;\n+        }\n+        else {\n+            my @caller = caller( $stackdepth );\n+            $location = $caller[1] . \":\" . $caller[2];\n+        }\n+    }\n+\n+    shift @callstack;\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    die \"\\nUnhandled $etype caught at toplevel:\\n\\n  $message\\n\\nThrown from: $location\\n\\nFull stack trace:\\n\\n$callstack\\n\";\n+}\n+\n+sub TAXES\n+{\n+    my ( $message ) = @_;\n+\n+    local $SIG{__WARN__} = $old_WARN if( defined $old_WARN );\n+\n+    $message =~ s/ at .*? line \\d+\\.$//;\n+    chomp $message;\n+\n+    my @callstack = gen_callstack( 1 );\n+    my $location = shift @callstack;\n+\n+    # $location already starts in a leading space\n+    $message .= $location;\n+\n+    # Do it this way in case there are no elements; we don't print a spurious \\n\n+    my $callstack = join( \"\", map { \"$_\\n\"} @callstack );\n+\n+    warn \"$message:\\n$callstack\";\n+}\n+\n+sub import\n+{\n+    $old_DIE  = $SIG{__DIE__};\n+    $old_WARN = $SIG{__WARN__};\n+\n+    $SIG{__DIE__}  = \\&DEATH;\n+    $SIG{__WARN__} = \\&TAXES;\n+}\n+\n+1;\n+\n __END__\n \n =head1 NAME\n \n Error - Error/exception handling in an OO-ish way\n \n+=head1 WARNING\n+\n+Using the \"Error\" module is B<no longer recommended> due to the black-magical\n+nature of its syntactic sugar, which often tends to break. Its maintainers\n+have stopped actively writing code that uses it, and discourage people\n+from doing so. See the \"SEE ALSO\" section below for better recommendations.\n+\n =head1 SYNOPSIS\n \n     use Error qw(:try);\n@@ -529,7 +643,7 @@ Error - Error/exception handling in an OO-ish way\n     try {\n \tdo_some_stuff();\n \tdie \"error!\" if $condition;\n-\tthrow Error::Simple -text => \"Oops!\" if $other_condition;\n+\tthrow Error::Simple \"Oops!\" if $other_condition;\n     }\n     catch Error::IO with {\n \tmy $E = shift;\n@@ -587,7 +701,7 @@ C<BLOCK> will be passed two arguments. The first will be the error\n being thrown. The second is a reference to a scalar variable. If this\n variable is set by the catch block then, on return from the catch\n block, try will continue processing as if the catch block was never\n-found.\n+found. The error will also be available in C<$@>.\n \n To propagate the error the catch block may call C<$err-E<gt>throw>\n \n@@ -608,7 +722,7 @@ type.\n Catch any error by executing the code in C<BLOCK>\n \n When evaluated C<BLOCK> will be passed one argument, which will be the\n-error being processed.\n+error being processed. The error will also be available in C<$@>.\n \n Only one otherwise block may be specified per try block\n \n@@ -625,12 +739,25 @@ Only one finally block may be specified per try block\n \n =back\n \n+=head1 COMPATIBILITY\n+\n+L<Moose> exports a keyword called C<with> which clashes with Error's. This\n+example returns a prototype mismatch error:\n+\n+    package MyTest;\n+\n+    use warnings;\n+    use Moose;\n+    use Error qw(:try);\n+\n+(Thanks to C<maik.hentsche@amd.com> for the report.).\n+\n =head1 CLASS INTERFACE\n \n =head2 CONSTRUCTORS\n \n The C<Error> object is implemented as a HASH. This HASH is initialized\n-with the arguments that are passed to its constructor. The elements\n+with the arguments that are passed to it's constructor. The elements\n that are used by, or are retrievable by the C<Error> class are listed\n below, other classes may add to these.\n \n@@ -655,6 +782,10 @@ an object blessed into that package as the C<-object> argument.\n \n =over 4\n \n+=item Error->new()\n+\n+See the Error::Simple documentation.\n+\n =item throw ( [ ARGS ] )\n \n Create a new C<Error> object and throw an error, which will be caught\n@@ -730,6 +861,13 @@ The line where the constructor of this error was called from\n \n The text of the error\n \n+=item $err->associate($obj)\n+\n+Associates an error with an object to allow error propagation. I.e:\n+\n+    $ber->encode(...) or\n+        return Error->prior($ber)->associate($ldap);\n+\n =back\n \n =head2 OVERLOAD METHODS\n@@ -759,11 +897,9 @@ to the constructor.\n \n =head1 PRE-DEFINED ERROR CLASSES\n \n-=over 4\n-\n-=item Error::Simple\n+=head2 Error::Simple\n \n-This class can be used to hold simple error strings and values. Its\n+This class can be used to hold simple error strings and values. It's\n constructor takes two arguments. The first is a text value, the second\n is a numeric value. These values are what will be returned by the\n overload methods.\n@@ -775,7 +911,6 @@ of the error object.\n This class is used internally if an eval'd block die's with an error\n that is a plain string. (Unless C<$Error::ObjectifyCallback> is modified)\n \n-=back\n \n =head1 $Error::ObjectifyCallback\n \n@@ -804,6 +939,76 @@ class MyError::Bar by default:\n         # Error handling here.\n     }\n \n+=cut\n+\n+=head1 MESSAGE HANDLERS\n+\n+C<Error> also provides handlers to extend the output of the C<warn()> perl\n+function, and to handle the printing of a thrown C<Error> that is not caught\n+or otherwise handled. These are not installed by default, but are requested\n+using the C<:warndie> tag in the C<use> line.\n+\n+ use Error qw( :warndie );\n+\n+These new error handlers are installed in C<$SIG{__WARN__}> and\n+C<$SIG{__DIE__}>. If these handlers are already defined when the tag is\n+imported, the old values are stored, and used during the new code. Thus, to\n+arrange for custom handling of warnings and errors, you will need to perform\n+something like the following:\n+\n+ BEGIN {\n+   $SIG{__WARN__} = sub {\n+     print STDERR \"My special warning handler: $_[0]\"\n+   };\n+ }\n+\n+ use Error qw( :warndie );\n+\n+Note that setting C<$SIG{__WARN__}> after the C<:warndie> tag has been\n+imported will overwrite the handler that C<Error> provides. If this cannot be\n+avoided, then the tag can be explicitly C<import>ed later\n+\n+ use Error;\n+\n+ $SIG{__WARN__} = ...;\n+\n+ import Error qw( :warndie );\n+\n+=head2 EXAMPLE\n+\n+The C<__DIE__> handler turns messages such as\n+\n+ Can't call method \"foo\" on an undefined value at examples/warndie.pl line 16.\n+\n+into\n+\n+ Unhandled perl error caught at toplevel:\n+\n+   Can't call method \"foo\" on an undefined value\n+\n+ Thrown from: examples/warndie.pl:16\n+\n+ Full stack trace:\n+\n+         main::inner('undef') called at examples/warndie.pl line 20\n+         main::outer('undef') called at examples/warndie.pl line 23\n+\n+=cut\n+\n+=head1 SEE ALSO\n+\n+See L<Exception::Class> for a different module providing Object-Oriented\n+exception handling, along with a convenient syntax for declaring hierarchies\n+for them. It doesn't provide Error's syntactic sugar of C<try { ... }>,\n+C<catch { ... }>, etc. which may be a good thing or a bad thing based\n+on what you want. (Because Error's syntactic sugar tends to break.)\n+\n+L<Error::Exception> aims to combine L<Error> and L<Exception::Class>\n+\"with correct stringification\".\n+\n+L<TryCatch> and L<Try::Tiny> are similar in concept to Error.pm only providing\n+a syntax that hopefully breaks less.\n+\n =head1 KNOWN BUGS\n \n None, but that does not mean there are not any.\n@@ -816,12 +1021,21 @@ The code that inspired me to write this was originally written by\n Peter Seibel <peter@weblogic.com> and adapted by Jesse Glick\n <jglick@sig.bsh.com>.\n \n+C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>\n+\n =head1 MAINTAINER\n \n-Shlomi Fish <shlomif@iglu.org.il>\n+Shlomi Fish, L<http://www.shlomifish.org/> .\n \n =head1 PAST MAINTAINERS\n \n Arun Kumar U <u_arunkumar@yahoo.com>\n \n+=head1 COPYRIGHT\n+\n+Copyright (c) 1997-8  Graham Barr. All rights reserved.\n+This program is free software; you can redistribute it and/or modify it\n+under the same terms as Perl itself.\n+\n =cut\n+\n-- \n2.15.1.424.g9478a66081\n\n"},{"id":"341052","messageId":"xmqq7eqq9wj2.fsf@gitster-ct.c.googlers.com","threadId":"47849","inReplyTo":"20180303153817.20270-1-avarab@gmail.com","subject":"Re: [PATCH v3 00/13] various perl fixes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-05T19:01:37Z","receivedAt":"2018-03-05T19:01:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Same as v2 except rebased on master & a couple of commit message\n> fixes, thanks to Eric Sunshine (thanks!). tbdiff with v2:\n\nNoting that the series was rebased is a good thing to do, but a\nstatement of the fact alone without justification makes readers\nwonder if there was a valid reason why it was rebased, or it was\njust because the 'master' saw more commits that do not have any\nimpact on what the series does.  For the former, saying something\nlike \"A recently graduated $name topic added another instance of the\nsame kind of glitch this series addresses, so the series has been\nrebased to cover that codepath as well.\" would make it very helpful.\n\nThanks.  Will queue.  After scanning it again, I think this is ready\nfor \"next\".\n\n"}]}