Skip to content

Document a way to perform use Module VERSION LIST on the command-line #19002

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

Closed
wants to merge 1 commit into from

Conversation

book
Copy link
Contributor

@book book commented Jul 25, 2021

The split(/,/,q{foo,bar}) seems to still happen.

This is the currently documented case:

$ perl -MO=Deparse '-MList::Util=any,all' -e1
use List::Util (split(/,/, 'any,all', 0));
'???';
-e syntax OK

And these work too (and the split on comma also happens somehow):

$ perl -MO=Deparse '-MList::Util any,all' -e1
use List::Util ('any', 'all');
'???';
-e syntax OK

$ perl -MO=Deparse '-MList::Util 1.5' -e1
use List::Util 1.5;
'???';
-e syntax OK

$ perl -MO=Deparse '-MList::Util 1.5 any,all' -e1
use List::Util 1.5 ('any', 'all');
'???';
-e syntax OK

The `split(/,/,q{foo,bar})` seems to still happen.

This is the currently documented case:

    $ perl -MO=Deparse '-MList::Util=any,all' -e1
    use List::Util (split(/,/, 'any,all', 0));
    '???';
    -e syntax OK

And these work too (and the split on comma also happens somehow):

    $ perl -MO=Deparse '-MList::Util any,all' -e1
    use List::Util ('any', 'all');
    '???';
    -e syntax OK

    $ perl -MO=Deparse '-MList::Util 1.5' -e1
    use List::Util 1.5;
    '???';
    -e syntax OK

    $ perl -MO=Deparse '-MList::Util 1.5 any,all' -e1
    use List::Util 1.5 ('any', 'all');
    '???';
    -e syntax OK
@Grinnz
Copy link
Contributor

Grinnz commented Jul 25, 2021

The split actually doesn't happen, this only works because strict is not active.

@Grinnz
Copy link
Contributor

Grinnz commented Jul 25, 2021

-M is a very naive filter, it literally sticks the argument verbatim into a use statement. Only when the = is provided are the arguments split into a list of strings.

@Grinnz
Copy link
Contributor

Grinnz commented Jul 25, 2021

I would not approve of the current wording of this because it is B::Deparse that generates that syntax, not -M.

@book
Copy link
Contributor Author

book commented Jul 25, 2021

I would not approve of the current wording of this because it is B::Deparse that generates that syntax, not -M.

Agreed. I was confused by the difference in the B::Deparse output. Thanks for the explanation.

If I understand your comment correctly, it's the log message I should rework, not the actual documentation patch, right?

@Grinnz
Copy link
Contributor

Grinnz commented Jul 25, 2021

I think mentioning that the quoted form without = can be used to insert a version check and quoted argument list would be useful. But it should be quoted in that case because the = argument splitting doesn't occur.

@book
Copy link
Contributor Author

book commented Jul 26, 2021

Re-reading your comments after a day, I now fully understand all of your comments:

  • " this only works because strict is not active": no strict 'subs' enables poetry mode, so barewords are treated as strings
  • " it is B::Deparse that generates that syntax, not -M": B::Deparse produces the string syntax from the barewords-interpreted-as-strings above
  • "it should be quoted in that case because the = argument splitting doesn't occur": with strict, the quotes are indeed required; and without =, no splitting is done

I'll rewrite the patch and the message to be more accurate, and force push on my branch again.

@khwilliamson
Copy link
Contributor

@book pinging you about this

@book
Copy link
Contributor Author

book commented Jan 13, 2022

@khwilliamson sorry, didn't find time to rewrite this in a satisfactory way yet.

@jkeenan
Copy link
Contributor

jkeenan commented Jul 3, 2022

@khwilliamson sorry, didn't find time to rewrite this in a satisfactory way yet.

@book, can you provide us with an update on the status of this p.r.?

Thank you very much.
Jim Keenan

@jkeenan
Copy link
Contributor

jkeenan commented Sep 16, 2022

@khwilliamson sorry, didn't find time to rewrite this in a satisfactory way yet.

@book, can you provide us with an update on the status of this p.r.?

Thank you very much. Jim Keenan

@book, any progress on this? Or should we close the ticket?

@jkeenan jkeenan added the Closable? We might be able to close this ticket, but we need to check with the reporter label Sep 16, 2022
@book
Copy link
Contributor Author

book commented Sep 26, 2022

I'll get back to it, after I'm done with #20337.

@jkeenan jkeenan removed the Closable? We might be able to close this ticket, but we need to check with the reporter label Jan 21, 2023
@demerphq
Copy link
Collaborator

demerphq commented Feb 8, 2023

@book maybe do this first? Its just a doc patch, so it should be easy to get it right and merged.

@jkeenan
Copy link
Contributor

jkeenan commented Jul 13, 2024

I'll get back to it, after I'm done with #20337.

@book, should we continue to keep this pull request open?

@book book closed this by deleting the head repository Mar 12, 2025
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.

5 participants