From 6f7007715efcfe9f021d50795eaf2bcabdb73fe4 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Fri, 19 Mar 2021 20:32:11 +0100 Subject: [PATCH 1/6] Add warnings to XSLoader.t --- dist/XSLoader/t/XSLoader.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/XSLoader/t/XSLoader.t b/dist/XSLoader/t/XSLoader.t index d3538b849cbb..c0bf9a7c8052 100644 --- a/dist/XSLoader/t/XSLoader.t +++ b/dist/XSLoader/t/XSLoader.t @@ -1,6 +1,8 @@ #!perl -T use strict; +use warnings; + use Config; my $db_file; From 8680d1665c0867d238fbf65241839e6d3904ae19 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Fri, 19 Mar 2021 20:32:32 +0100 Subject: [PATCH 2/6] Add strict to XSLoader_pm.PL --- dist/XSLoader/XSLoader_pm.PL | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL index 66e4c2d63156..27dd04cf9b61 100644 --- a/dist/XSLoader/XSLoader_pm.PL +++ b/dist/XSLoader/XSLoader_pm.PL @@ -1,4 +1,6 @@ use strict; +use warnings; + use Config; # We require DynaLoader to make sure that mod2fname is loaded eval { require DynaLoader }; @@ -9,11 +11,12 @@ print OUT <<'EOT'; # Generated from XSLoader_pm.PL (resolved %Config::Config value) # This file is unique for every OS -package XSLoader; +use strict; +no strict 'refs'; -$VERSION = "0.30"; # remember to update version in POD! +package XSLoader; -#use strict; +our $VERSION = "0.31"; # remember to update version in POD! package DynaLoader; @@ -252,7 +255,7 @@ XSLoader - Dynamically load C libraries into Perl code =head1 VERSION -Version 0.30 +Version 0.31 =head1 SYNOPSIS From f633b4644cf347c925b3b5881c1a491618de7f44 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Fri, 19 Mar 2021 20:32:52 +0100 Subject: [PATCH 3/6] Add warnings to DynaLoader.t --- ext/DynaLoader/t/DynaLoader.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/DynaLoader/t/DynaLoader.t b/ext/DynaLoader/t/DynaLoader.t index f077088f352b..11b37b5c4e69 100644 --- a/ext/DynaLoader/t/DynaLoader.t +++ b/ext/DynaLoader/t/DynaLoader.t @@ -1,6 +1,8 @@ #!/usr/bin/perl -wT use strict; +use warnings; + use Config; push @INC, '.'; if (-f 't/test.pl') { From ac2bfa405206f0c35d100580a859a00a726bfae6 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Fri, 19 Mar 2021 20:33:14 +0100 Subject: [PATCH 4/6] Add warnings to DynaLoader/Makefile/PL --- ext/DynaLoader/Makefile.PL | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/DynaLoader/Makefile.PL b/ext/DynaLoader/Makefile.PL index 864af3ed8e2a..5579bc612084 100644 --- a/ext/DynaLoader/Makefile.PL +++ b/ext/DynaLoader/Makefile.PL @@ -1,4 +1,6 @@ use strict; +use warnings; + use ExtUtils::MakeMaker; my $is_mswin = $^O eq 'MSWin32'; From b40c65bec1a0ff651e7e86903192115cea04efff Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Sat, 20 Mar 2021 01:20:15 +0100 Subject: [PATCH 5/6] Make DynaLoader strict-safe --- ext/DynaLoader/DynaLoader_pm.PL | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index 002569f98c74..021551fd9d6d 100644 --- a/ext/DynaLoader/DynaLoader_pm.PL +++ b/ext/DynaLoader/DynaLoader_pm.PL @@ -73,6 +73,8 @@ print OUT <<'EOT'; # Generated from DynaLoader_pm.PL, this file is unique for every OS +use strict; + package DynaLoader; # And Gandalf said: 'Many folk like to know beforehand what is to @@ -88,9 +90,17 @@ package DynaLoader; # Tim.Bunce@ig.co.uk, August 1994 BEGIN { - $VERSION = '1.50'; + our $VERSION = '1.51'; } +# Note: in almost any other piece of code "our" would have been a better +# option than "use vars", but DynaLoader's bootstrap files need the +# side effect of the variable being declared in any scope whose current +# package is DynaLoader, not just the current lexical one. +use vars qw(@dl_library_path @dl_resolve_using @dl_require_symbols + $dl_debug @dl_librefs @dl_modules @dl_shared_objects + $dl_dlext $dl_so $dlsrc @args $module @dirs $file); + EOT if (!$ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) { @@ -141,7 +151,7 @@ print OUT expand_os_specific(<<'EOT'); # inefficient to define on systems that don't need it. $Is_VMS = $^O eq 'VMS'; <> -$do_expand = <<$^O-eq-VMS>>1<<|$^O-eq-VMS>>0<>; +my $do_expand = <<$^O-eq-VMS>>1<<|$^O-eq-VMS>>0<>; @dl_require_symbols = (); # names of symbols we need<<$^O-eq-freemint>> @dl_resolve_using = (); # names of files to link with<><<$^O-eq-hpux>> @@ -292,6 +302,8 @@ sub croak { require Carp; Carp::croak(@_) } sub bootstrap_inherit { my $module = $_[0]; + + no strict qw/refs vars/; local *isa = *{"$module\::ISA"}; local @isa = (@isa, 'DynaLoader'); # Cannot goto due to delocalization. Will report errors on a wrong line? From 9484cdf48215de91203fa60fb27e9a0546d00c7d Mon Sep 17 00:00:00 2001 From: Todd Rinaldo Date: Wed, 7 Oct 2020 23:33:57 -0500 Subject: [PATCH 6/6] Drop support for XSLoader below 5.6 Now we're using our, there's no value to attempting to support versions below 5.6. --- dist/XSLoader/Makefile.PL | 8 +++--- dist/XSLoader/XSLoader_pm.PL | 48 ------------------------------------ dist/XSLoader/t/XSLoader.t | 2 -- 3 files changed, 3 insertions(+), 55 deletions(-) diff --git a/dist/XSLoader/Makefile.PL b/dist/XSLoader/Makefile.PL index c7cdbec77078..6f5aae349dea 100644 --- a/dist/XSLoader/Makefile.PL +++ b/dist/XSLoader/Makefile.PL @@ -8,6 +8,8 @@ use strict; use warnings; +use v5.6; + use ExtUtils::MakeMaker; use ExtUtils::MM_Unix; @@ -101,11 +103,7 @@ WriteMakefile( my @perls = ($orig_perl); push @perls, qw(bleadperl perl5.6.1 - perl5.6.0 - perl5.005_03 - perl5.004_05 - perl5.004_04 - perl5.004) + perl5.6.0) if $ENV{PERL_TEST_ALL}; my $out; diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL index 27dd04cf9b61..af5586aafaca 100644 --- a/dist/XSLoader/XSLoader_pm.PL +++ b/dist/XSLoader/XSLoader_pm.PL @@ -20,29 +20,6 @@ our $VERSION = "0.31"; # remember to update version in POD! package DynaLoader; -EOT - -# dlutils.c before 5.006 has this: -# -# #ifdef DEBUGGING -# dl_debug = SvIV( perl_get_sv("DynaLoader::dl_debug", 0x04) ); -# #endif -# -# where 0x04 is GV_ADDWARN, which causes a warning to be issued by the call -# into XS below, if DynaLoader.pm hasn't been loaded. -# It was changed to 0 in the commit(s) that added XSLoader to the core -# (9cf41c4d23a47c8b and its parent 9426adcd48655815) -# Hence to backport XSLoader to work silently with earlier DynaLoaders we need -# to ensure that the variable exists: - -print OUT <<'EOT' if $] < 5.006; - -# enable debug/trace messages from DynaLoader perl code -$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; - -EOT - -print OUT <<'EOT'; # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && @@ -211,42 +188,17 @@ print OUT <<'EOT'; push(@DynaLoader::dl_shared_objects, $file); # record files loaded return &$xs(@_); } -EOT # Can't test with DynaLoader->can('bootstrap_inherit') when building in the # core, as XSLoader gets built before DynaLoader. -if ($] >= 5.006) { - print OUT <<'EOT'; - sub bootstrap_inherit { require DynaLoader; goto \&DynaLoader::bootstrap_inherit; } -EOT -} else { - print OUT <<'EOT'; - -sub bootstrap_inherit { - # Versions of DynaLoader prior to 5.6.0 don't have bootstrap_inherit. - package DynaLoader; - - my $module = $_[0]; - local *DynaLoader::isa = *{"$module\::ISA"}; - local @DynaLoader::isa = (@DynaLoader::isa, 'DynaLoader'); - # Cannot goto due to delocalization. Will report errors on a wrong line? - require DynaLoader; - DynaLoader::bootstrap(@_); -} - -EOT -} - -print OUT <<'EOT'; 1; - __END__ =head1 NAME diff --git a/dist/XSLoader/t/XSLoader.t b/dist/XSLoader/t/XSLoader.t index c0bf9a7c8052..5b7ce7cb5619 100644 --- a/dist/XSLoader/t/XSLoader.t +++ b/dist/XSLoader/t/XSLoader.t @@ -12,8 +12,6 @@ BEGIN { die "Test::More not available\n"; } - plan(skip_all => "these tests needs Perl 5.5+") if $] < 5.005; - use Config; foreach (qw/SDBM_File GDBM_File ODBM_File NDBM_File DB_File/) { if ($Config{extensions} =~ /\b$_\b/) {