Open abraxxa opened 6 months ago
cpanm does provide one example using quotes, suggesting that quotes are supported everywhere: cpanm Plack~">= 1.0000, < 2.0000"
Two actually: it also says: ...while @ pins the exact version, and is a shortcut for ~"== VERSION".
Does cpm support these two literal examples that cpanm references?
cpanm's example using quotes is a shell command, and the shell will remove the quotes as part of its parsing; they are in the example because they are required to pass it as a single shell argument.
Interesting, I would have thought that embedded quotes would be preserved by the shell, but indeed they aren't:
perl -MData::Dumper -wle'print "got args ", Dumper(\@ARGV)' cpanm Plack~">= 1.0000, < 2.0000"
got args $VAR1 = [
'cpanm',
'Plack~>= 1.0000, < 2.0000'
];
So, why isn't cpm also receiving the arguments with the quotes stripped? If the dzil output is piped to cpm just as it is to cpanm, everything should work fine. Is cpm being invoked differently?
As a point of comparison, in my installdeps command I must form the argument without quotes because it is then quoted as a shell argument, which would preserve the quotes when passed through the shell. https://github.com/Grinnz/Dist-Zilla-App-Command-installdeps/blob/master/lib/Dist/Zilla/App/Command/installdeps.pm#L103
So, why isn't cpm also receiving the arguments with the quotes stripped? If the dzil output is piped to cpm just as it is to cpanm, everything should work fine. Is cpm being invoked differently?
When it is piped to xargs the quotes are removed, when piped to cpm -
directly they seem to be kept. But in the later case no shell is involved...
This came up in https://github.com/skaji/cpm/issues/245. https://metacpan.org/pod/cpanm#COMMANDS documents the version without any quoting, https://metacpan.org/pod/CPAN::Meta::Spec neither. cpm fails if the version is surrounded by quotes as
dzil listdeps --cpanm-versions
returns.