Subject: | modulemaker '-b' switch's documentation is misleading |
Date: | Thu, 3 May 2018 15:49:37 -0400 |
To: | bug-ExtUtils-ModuleMaker [...] rt.cpan.org |
From: | James E Keenan <jkeenan [...] pobox.com> |
The 'modulemaker' help message currently suggests that the '-b'
command-line switch takes an argument, which would presumably be
something like 'ExtUtils::ModuleMaker' or 'Module::Build'.
However, if you provide the former as an argument -- indeed, if you
provide *any* argument -- you end up with a generated Build.PL:
#####
$ modulemaker -Ic -n Alpha::Beta -a "Test -b option" -b
ExtUtils::ModuleMaker
-------------------
Module files generated. Good bye.
$ tree Alpha-Beta/
`--
`--scripts
`--Changes
`--LICENSE
`--Todo
`--MANIFEST
`--README
`--t
| `--001_load.t
`--lib
| `--Alpha
| | `--Beta.pm
`--Build.PL
#####
#####
$ modulemaker -Ic -n Gamma::Delta -a "Test implausible value for -b
option" -b Foo::Bar
-------------------
Module files generated. Good bye.
$ tree Gamma-Delta/
`--
`--scripts
`--Changes
`--LICENSE
`--Todo
`--MANIFEST
`--README
`--t
| `--001_load.t
`--lib
| `--Gamma
| | `--Delta.pm
`--Build.PL
#####
[modulemaker] 513 $ modulemaker -Ic -n Epsilon::Zeta -a "Test -b option
with no value" -b
-------------------
Module files generated. Good bye.
[modulemaker] 514 $ tree Epsilon-Zeta/
`--
`--scripts
`--Changes
`--LICENSE
`--Todo
`--MANIFEST
`--README
`--t
| `--001_load.t
`--lib
| `--Epsilon
| | `--Zeta.pm
`--Build.PL
#####
If you provide the '-b' switch with no value, you get a Build.PL:
#####
$ modulemaker -Ic -n Epsilon::Zeta -a "Test -b option with no value" -b
-------------------
Module files generated. Good bye.
[modulemaker] 527 $ tree Epsilon-Zeta
Epsilon-Zeta
`--scripts
`--Changes
`--LICENSE
`--Todo
`--MANIFEST
`--README
`--t
| `--001_load.t
`--lib
| `--Epsilon
| | `--Zeta.pm
`--Build.PL
#####
So the help message is misleading.
Internally (package ExtUtils::ModuleMaker::Opts), the options are
processed by Getopt::Std::getopts():
#####
my %opts;
getopts( "bhqsCIPVcn:a:v:l:u:p:o:w:e:t:r:d:", \%opts );
#####
So '-b' is a simple switch. Some, presumably non-default action should
occur when it is provided; the default action should take place
otherwise. In this case, the non-default action invoked by '-b' is to
generate a Build.PL rather than a Makefile.PL. That's sensible
behavior. So, once that's confirmed, the help message (and any other
relevant documentation) should be adjusted to document the actual behavior.