Skip to content

Remove ~~ from autodoc.pl #20343

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

Merged
merged 1 commit into from
Sep 23, 2022
Merged

Conversation

book
Copy link
Contributor

@book book commented Sep 23, 2022

Following up on #20337, I've looked for and only found one use of ~~ in the core scripts and modules.

This patch replaces the ~~ with equivalent code.

Copy link
Contributor

@leonerd leonerd left a comment

Choose a reason for hiding this comment

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

Needs a = 0

@book book force-pushed the book/remove-smartmatch-from-core-code branch 2 times, most recently from 26bff98 to f189e9e Compare September 23, 2022 13:36
@book
Copy link
Contributor Author

book commented Sep 23, 2022

It seems I can't use List::Util, because autodoc.pl is run via miniperl.

./miniperl -Ilib autodoc.pl
Can't locate List/Util.pm in @INC (you may need to install the List::Util module) ...

@leonerd
Copy link
Contributor

leonerd commented Sep 23, 2022

Turns out I can't use List::Util, because autodoc.pl is run via miniperl.

Ah; yeah that is unfortunate. You could inline a little helper version commented:

# Can't use List::Util because this runs via miniperl
sub any(&@) {
  my $code = shift;
  $code->($_) or return 0 for @_;
  return 1;
}

Or failing that, write the test in some other way. For a one-off it might be shorter to inline some other logic, such as your counting code from before.

@book book force-pushed the book/remove-smartmatch-from-core-code branch from f189e9e to d5cb8c9 Compare September 23, 2022 13:52
@book book requested a review from leonerd September 23, 2022 13:55
@book book force-pushed the book/remove-smartmatch-from-core-code branch from d5cb8c9 to 63a4908 Compare September 23, 2022 13:56
Copy link
Contributor

@leonerd leonerd left a comment

Choose a reason for hiding this comment

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

LGTM

@book book merged commit 56c95a7 into Perl:blead Sep 23, 2022
@book book deleted the book/remove-smartmatch-from-core-code branch September 23, 2022 18:58
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