Skip to content

remove dead backwards compatibility code - #83

Open
mauke wants to merge 6 commits into
pmqs:masterfrom
mauke:remove-dead-compat-code
Open

remove dead backwards compatibility code#83
mauke wants to merge 6 commits into
pmqs:masterfrom
mauke:remove-dead-compat-code

Conversation

@mauke

@mauke mauke commented Aug 12, 2026

Copy link
Copy Markdown

Most of this patch is dead code removal. If a file uses use warnings, which is a compile-time error on perls before v5.6.0, any subsequent runtime tests such as if ($] < 5.006) or require 5.006 are redundant: A perl that would fail these checks wouldn't have made it this far into the file anyway.

Plus a few bug fixes:

  • use numeric comparison operators for comparing version numbers, not string operators (because 10.0 lt 5.99)
  • use double quotes to interpolate $] in skip message; don't print it literally
  • $] < 5.6 should have been $] < 5.006

Comment thread Makefile.PL
unless $ENV{PERL_CORE};

(my $mm_version = ExtUtils::MakeMaker->VERSION) =~ tr/_//d;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a short comment explaining what it is doing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread lib/IO/Compress/Base/Common.pm
Comment thread t/compress/generic.pl
Comment thread t/compress/oneshot.pl
Comment thread Makefile.PL
Comment thread Makefile.PL
Comment thread t/compress/encode.pl

package IO::Uncompress::Gunzip ;

require 5.006 ;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably needs to be requite 5.008 here and in all other files.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to raise the minimum supported perl version to 5.8.0, that's fine with me, but I don't think it should be part of this pull request.

mauke added 6 commits August 15, 2026 14:49
`ExtUtils::MakeMaker->VERSION() gt '6.30'` is a string comparison. It
will return wrong results if ExtUtils::MakeMaker reaches version 10.

Use a numeric comparison instead (but explicitly strip out "_" because
old ExtUtils::MakeMaker versions include a literal "_" in their version
"numbers").
We don't need any fancy tests involving $^O, $], or eval() because both
branches of the conditional return 1. So just set $needBinmode to 1.
`$] < 5.6` has always been true because a `$]` number of 5.6 represents
perl v5.600.0, which is not expected to be released within the next
hundred years.

These tests probably intended to check for `$] < 5.006`, but that's
pointless because they also `use warnings`, which is a compile-time
error on perls before v5.6.0.
It makes more sense to print the perl version instead of a literal `$]`.
The file starts with `require 5.006`, so `$]` cannot be less than 5.006
at this point.
All of these files `use warnings`, which is a compile-time error on
perls before v5.6.0. Subsequent runtime tests such as `if ($] < 5.006)`
or `require 5.006` are thus redundant.
@mauke
mauke force-pushed the remove-dead-compat-code branch from bdf999f to 97d8c31 Compare August 15, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants