diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm index ffb86b1..058cc28 100644 --- a/lib/Carton/CLI.pm +++ b/lib/Carton/CLI.pm @@ -343,7 +343,8 @@ sub cmd_update { my $dist = $env->snapshot->find_or_core($module) or $self->error("Could not find module $module.\n"); next if $dist->is_core; - push @modules, "$module~" . $env->cpanfile->requirements_for_module($module); + my $reqs = $env->cpanfile->requirements_for_module($module); + push @modules, $reqs ? "$module~" . $reqs : $module; } return unless @modules; diff --git a/xt/cli/update.t b/xt/cli/update.t index 22745bd..ef307a8 100644 --- a/xt/cli/update.t +++ b/xt/cli/update.t @@ -74,5 +74,21 @@ EOF } }; +subtest 'update dependency distribution' => sub { + my $app = cli(); + + $app->write_cpanfile(<run("install"); + $app->run("list"); + like $app->stdout, qr/HTML-Parser-/m; + like $app->stdout, qr/HTML-Tagset-/m; + + $app->run("update", "HTML::Tagset"); + like $app->stdout, qr/HTML::Tagset is up to date/m; +}; + done_testing;