Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 53050
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: tim [...] tim-landscheidt.de
Cc:
AdminCc:

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



Subject: --install_path will silently swallow non-\w parameter name start
I've been playing around with using App::Build for installing a small web application (ATM I use a tiny traditional Makefile). In the process I stumbled upon what I think may be a bug in Module::Build: Given a Build.PL à la: | [...] | extra_dirs => [ "cgi-bin", "htdocs" ], | [...] it is not possible to specify the installation path for the cgi-bin subdirectory with "./Build install --install_path cgi-bin=~/public/cgi- This seems to be due to /usr/lib/perl5/5.10.0/Module/Build/Base.pm's (of Fedora's perl-Module-Build-0.3200-82.fc11.i586; 0.36 uses the same code): | sub read_args { | [...] | # Hashify these parameters | for ($self->hash_properties, 'config') { | next unless exists $args{$_}; | my %hash; | $args{$_} ||= []; | $args{$_} = [ $args{$_} ] unless ref $args{$_}; | foreach my $arg ( @{$args{$_}} ) { | $arg =~ /(\w+)=(.*)/ ^^^^^^^^^^ | or die "Malformed '$_' argument: '$arg' should be something like 'foo=bar'"; | $hash{$1} = $2; | } | $args{$_} = \%hash; | } | [...] that will accept "cgi-bin=bar" but read it as "bin=bar" (the hyphen is not part of the \w class). To bring the algorithm in line with the error message I would replace the expression above with: | [...] | $arg =~ /^(\w+)=(.*)$/ | [...] Obviously, it would be nice not to have to name the directory "cgi_bin" or similar. Therefore the parameter name's expression should be enhanced at least by "-" but I am hesitant as I cannot estimate what consequences wait further down the line.
Thank you for the bug report. I'm not sure what the right validation regex should be, but 'cgi-bin' is a great example of why the current one is too restrictive.
Patched repo to use the same regex [\w-]+ as is used for top-level options.
Now that there has been a stable Module::Build release, I'm marking this "patched" issue as "resolved".