From d52927ad6d754998f71cf36f8d07fa051233eed7 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Wed, 9 Oct 2024 00:00:40 +0100 Subject: [PATCH] ParseXS: 5.8.9 backcompat fixes A couple of fixes to make it build+test under 5.8.9. The grep expression exists $_->{in_out} && $_->{in_out} =~ /OUT$/ was wrong - it should have been defined rather than exists, as is done elsewhere. I'm not sure why an 'uninit var' warning only appeared on 5.8.9 but not blead - perhaps some minor autovivification difference? It was also warning $ExtUtils::ParseXS::DIE_ON_ERROR only used once $ExtUtils::ParseXS::AUTHOR_WARNINGS only used once in t/001-basic.t because that test file only loads ExtUtils::ParseXS at runtime. Again, I'm not sure why it didn't warn on blead too. But I made the var initialisations more robust against 'once' warnings anyway by using 'our'. --- dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 2 +- dist/ExtUtils-ParseXS/t/001-basic.t | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index cfcf53bfe572..12175666bcbf 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -1250,7 +1250,7 @@ EOF for my $param ( grep { - exists $_->{in_out} + defined $_->{in_out} && $_->{in_out} =~ /OUT$/ && !$self->{xsub_map_varname_to_seen_in_OUTPUT}{$_->{var}} } diff --git a/dist/ExtUtils-ParseXS/t/001-basic.t b/dist/ExtUtils-ParseXS/t/001-basic.t index 75792b4bc3a6..79a91ef4aed1 100644 --- a/dist/ExtUtils-ParseXS/t/001-basic.t +++ b/dist/ExtUtils-ParseXS/t/001-basic.t @@ -29,8 +29,10 @@ require_ok( 'ExtUtils::ParseXS' ); chdir('t') if -d 't'; push @INC, '.'; -$ExtUtils::ParseXS::DIE_ON_ERROR = 1; -$ExtUtils::ParseXS::AUTHOR_WARNINGS = 1; +package ExtUtils::ParseXS; +our $DIE_ON_ERROR = 1; +our $AUTHOR_WARNINGS = 1; +package main; use Carp; #$SIG{__WARN__} = \&Carp::cluck;