Skip to content

Commit

Permalink
Fix version range so that Module::Install can understand.
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Apr 12, 2012
1 parent b6173ae commit 4fde485
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Module/Install/CPANfile.pm
Expand Up @@ -17,13 +17,24 @@ sub cpanfile {
while (my($type, $requirement) = each %$requirements) {
if (my $command = $self->command_for($phase, $type)) {
while (my($mod, $ver) = each %$requirement) {
$self->$command($mod, $ver);
$self->$command($mod, $self->_fix_version($ver));
}
}
}
}
}

sub _fix_version {
my($self, $ver) = @_;

return $ver unless $ver;

$ver =~ /(?:^|>=?)\s*([\d\.\_]+)/
and return $1;

$ver;
}

sub command_for {
my($self, $phase, $type) = @_;

Expand Down

0 comments on commit 4fde485

Please sign in to comment.