Perl-Toolchain-Gang/module-build-tiny

Doesn't honour options passed without leading dashes

robn opened this issue · 2 comments

robn commented

I'm building a Debian package for AnyEvent::Handle::UDP using dh-make-perl. dh_auto_install calls:

perl Build install destdir=/root/AnyEvent-Handle-UDP-0.043/debian/libanyevent-handle-udp-perl create_packlist=0

Build does not appear to honour destdir (or any other options), resulting in the module being installed under /usr, and so never making it into the Debian package.

The problem actually comes from using Getopt::Long for parsing the options, which doesn't recognise anything not starting with -- or - (or + in legacy modes) as an option:

$ perl -MGetopt::Long=GetOptionsFromArray -MData::Dumper -E 'GetOptionsFromArray(["destdir=foo"], \%opt, qw(destdir=s)); say for %opt'

vs

$ perl -MGetopt::Long=GetOptionsFromArray -MData::Dumper -E 'GetOptionsFromArray(["--destdir=foo"], \%opt, qw(destdir=s)); say for %opt'
destdir
foo

It seems like this is needed for proper Module::Build compat?

This has been reported a number of times, the most relevant ticket to you being #85006. You need to upgrade your dh-make-perl for this to work.

When we wrote the Build.PL spec, we chose to specify a (sane) subset of behaviors. Module::Build takes argument handling to a TIMTWOTDI limit (there are 7 ways to set verbosity), supporting that all would unnecessarily complicate the spec and other implementations.

We realized this causes some pain, but it's the only way out of the mess we're currently in.

robn commented

Yep, that's reasonable, and every part of me except the "why isn't this working" bit agrees completely. Good to have the answer now, thanks :)