Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix is_core_module logic

  • Loading branch information...
commit f97b1611be594b90f314e3c1ce6799731e89bc90 1 parent ad9feb9
@xaicron authored
Showing with 11 additions and 8 deletions.
  1. +11 −8 lib/App/pmuninstall.pm
View
19 lib/App/pmuninstall.pm
@@ -9,7 +9,6 @@ use Config;
use ExtUtils::MakeMaker;
use YAML;
use CPAN::DistnameInfo;
-use Module::CoreList;
use version;
use HTTP::Tiny;
use Term::ANSIColor qw(colored);
@@ -70,24 +69,26 @@ sub uninstall {
for my $module (@modules) {
$self->puts("--> Working on $module") unless $self->{quiet};
my ($packlist, $dist, $vname) = $self->find_packlist($module);
+
+ $packlist = File::Spec->catfile($packlist);
+ if ($self->is_core_module($module, $packlist)) {
+ $self->puts(colored ['red'], "! $module is Core Module!! Can't be uninstall.");
+ $self->puts unless $self->{quiet};
+ next;
+ }
+
unless ($dist) {
$self->puts(colored ['red'], "! $module is not found.");
$self->puts unless $self->{quiet};
next;
}
+
unless ($packlist) {
$self->puts(colored ['red'], "! $module is not installed.");
$self->puts unless $self->{quiet};
next;
}
- $packlist = File::Spec->catfile($packlist);
- if ($self->is_core_module($module, $packlist)) {
- $self->puts(colored ['red'], "! $module is Core Module!! Can't be uninstall.");
- $self->puts unless $self->{quiet};
- next;
- }
-
if ($self->ask_permission($module, $dist, $vname, $packlist)) {
if ($self->uninstall_from_packlist($packlist)) {
$self->puts(colored ['green'], "Successfully uninstalled $module");
@@ -191,7 +192,9 @@ sub locate_pack {
sub is_core_module {
my ($self, $dist, $packlist) = @_;
+ require Module::CoreList;
return unless exists $Module::CoreList::version{$perl_version}{$dist};
+ return 1 unless $packlist;
my $is_core = 0;
for my $dir (@core_modules_dir) {
Please sign in to comment.
Something went wrong with that request. Please try again.