Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix protex to enable it to work with Perl 5.30. #356

Merged
merged 2 commits into from
Feb 20, 2025
Merged

Fix protex to enable it to work with Perl 5.30. #356

merged 2 commits into from
Feb 20, 2025

Conversation

oehmke
Copy link
Contributor

@oehmke oehmke commented Feb 19, 2025

Remove some outdated code that is no longer supported in recent versions of Perl.

@billsacks billsacks self-requested a review February 19, 2025 23:18
@billsacks
Copy link
Member

I'm looking at this....

@oehmke
Copy link
Contributor Author

oehmke commented Feb 19, 2025 via email

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, @oehmke ! I have forgotten most of the Perl I once knew, but I think I've gotten my head back into it enough to give this a decent (albeit not rock-solid, particularly given the obscurity of the $[ feature) review. I pushed a commit with some additional changes. It would be great if you gave this commit a quick look to make sure I didn't change anything that you deliberately were keeping as is or think shouldn't be changed:

97b1aef

See my inline comments below on two of these changes. Some of the changes are in comments, but I figured they should be changed, too, in case someone uncomments them. I also replaced uses of $[ with 0, since now $[ will be 0 and that seems more clear and standard Perl. In addition, I found a few places that seemed like they should have been changed similarly to your other changes but weren't; I'd especially welcome your look at these to make sure they weren't things that you intentionally left as is.

I was least sure about the changes to the string-related things, but from a little test program, the changes to substr seem correct; and it looks like the uses of index here are okay; and based on a search for $[ in https://perldoc.perl.org/5.12.4/perlfunc, I don't see mention of this impacting any other functions.

@@ -92,7 +92,7 @@

# Keep this if you don't know what it does...
# -------------------------------------------
$[ = 1; # set array base to 1
# $[ = 1; # set array base to 1 (Removed to maintain compatability with Perl 5.30)
Copy link
Member

Choose a reason for hiding this comment

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

I feel like it would be more clear just to remove this line, so I have done that.

if ($Fld[1] eq '!QUOTE:') {
for ($i = 2; $i <= $#Fld; $i++) {
if ($Fld[0] eq '!QUOTE:') {
for ($i = 1; $i <= $#Fld - 1; $i++) {
Copy link
Member

Choose a reason for hiding this comment

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

I am removing the change you had here (subtracting 1 from $#Fld): $#Fld gives the index of the last element, and I think the correct thing to do is still to loop until i is equal to the index of the last element. (I did a little test and $#Fld changes with $[, which I think makes it correct to not subtract 1 here.)

@danrosen25
Copy link
Member

@billsacks
Thanks for cleaning this up ⭐

@oehmke
Copy link
Contributor Author

oehmke commented Feb 20, 2025 via email

@oehmke
Copy link
Contributor Author

oehmke commented Feb 20, 2025

@danrosen25 are you ok with me merging this? It sounds like you are, but it doesn't look like you officially approved them, so I wanted to double check.

@danrosen25
Copy link
Member

I'm good with this change.

@oehmke oehmke merged commit af3db71 into develop Feb 20, 2025
6 checks passed
@oehmke oehmke deleted the fix_protex branch February 20, 2025 18:29
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.

3 participants