Skip to content

Fix single quotes escaped incorrectly#97

Open
ryoskzypu wants to merge 2 commits intoxsawyerx:masterfrom
ryoskzypu:fix-author-meta
Open

Fix single quotes escaped incorrectly#97
ryoskzypu wants to merge 2 commits intoxsawyerx:masterfrom
ryoskzypu:fix-author-meta

Conversation

@ryoskzypu
Copy link
Copy Markdown
Contributor

If the author string contains a single quote, perl will die with a bareword syntax error when processing the generated Makefile.PL and Build.PL files.

MI_Makefile_PL_guts() joins authors in a single string and duplicates authors in META.yml.

I added a test for it, but not sure if it's needed or if I did it right

use inc::Module::Install;

name '$self->{distro}';
author $author;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe the author command of Module::Install only accepts a single string. This would pass it a comma-separated list of strings. https://metacpan.org/pod/Module::Install#author

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My tests are generating a multi author string as single entry in META.yml for some reason. See https://github.com/Perl-Toolchain-Gang/Module-Install/blob/master/t/19_authors.t#L42

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Then I guess it does accept multiple strings, that's fine then (no one should be generating new M::I dists anyway)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also noticed that author command must be set before all_from, otherwise it pulls author from lib file and the metafile ends up with duplicated entries.


my $author = '[' .
join(',', map { (my $x = $_) =~ s/'/\'/g; "'$x'" } @{$self->{author}})
join(',', map { (my $x = $_) =~ s/'/\\'/g; "'$x'" } @{$self->{author}})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good catch!

@xsawyerx
Copy link
Copy Markdown
Owner

@Grinnz Assigned you to this, hope that's okay. Happy to do the release when resolved.

Comment thread t/test-author.t Outdated
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