Skip Menu |

This queue is for tickets about the ExtUtils-ModuleMaker CPAN distribution.

Report information
The Basics
Id: 125267
Status: resolved
Priority: 0/
Queue: ExtUtils-ModuleMaker

People
Owner: Nobody in particular
Requestors: jkeenan [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.58



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.
On Thu May 03 15:49:55 2018, jkeenan@pobox.com wrote: Show quoted text
> 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.
Addressed by commit 9f3f963b24bd9ad1846a63e76937388ec3f4440d ##### Author: James E Keenan <jkeenan@cpan.org> Date: Fri May 4 11:00:22 2018 -0400 RTC 125267: Correct ambiguity in -b switch. The 'modulemaker' help message heretofore suggested that the '-b' command-line switch would take a string argument -- presumably something like 'ExtUtils::ModuleMaker' or 'Module::Build'. However, if you provided *any* argument, you ended up with a generated Build.PL. The problem was that inside ExtUtils::ModuleMaker::Opts's invocation of 'getopts', '-b' was defined as a flag rather than as an option which would take an argument. That meant that providing the '-b' flag would, in ExtUtils::ModuleMaker::Interactive set BUILD_SYSTEM to 'Module::Build' regardless of what you (mistakenly) provided as a value for '-b'. Here we correct the help message to prevent the user from thinking that '-b' takes a value and instruct the user that it directly selects Module::Build as the build system. This is probably what a sophisticated user of the 'modulemaker' utility would want. We change code in Interactive.pm and Opts.pm to implement this change. If the user does not suppress the INTERACTIVE mode, the user can still call up the Build Menu and change to any of the other build system options provided there. #####