This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
restore compatibility with old versions of ExtUtils::ParseXS
authorGraham Knop <haarg@haarg.org>
Tue, 24 Nov 2020 20:27:43 +0000 (21:27 +0100)
committerKarl Williamson <khw@cpan.org>
Sun, 29 Nov 2020 16:02:56 +0000 (09:02 -0700)
ExtUtils::ParseXS used to include a function called "errors", which was
documented. In was renamed to report_error_count in version 3.01 (perl
5.15.1) although the documentation wasn't fixed until 3.21 (perl 5.19.2).
As a documented function, this is a backwards compatibility issue.

It is possible for this to lead to errors when installing modules from
CPAN. If you are using the version of ExtUtils::ParseXS that comes with
core, between running the Makefile.PL and make, fulfilling prereqs can
result in upgrading ExtUtils::ParseXS. When Makefile.PL is run, the
generated Makefile gets the full path to xsubpp saved in it. Then when
upgraded from CPAN, ExtUtils::ParseXS and xsubpp will be in a new
location (site_perl or a local::lib). Running make will run the old
xsubpp, but it will then try to use the new ExtUtils::ParseXS which has
broken compatibility.

Restore the errors function as a compatibility shim to fix this.

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

index 18ed08f..106883a 100644 (file)
@@ -42,6 +42,7 @@ use ExtUtils::ParseXS::Utilities qw(
 our @EXPORT_OK = qw(
   process_file
   report_error_count
+  errors
 );
 
 ##############################
@@ -1012,6 +1013,7 @@ sub report_error_count {
     return $Singleton->{errors}||0;
   }
 }
+*errors = \&report_error_count;
 
 # Input:  ($self, $_, @{ $self->{line} }) == unparsed input.
 # Output: ($_, @{ $self->{line} }) == (rest of line, following lines).