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.