summaryrefslogtreecommitdiff
path: root/inc/Module/Install/CheckConflicts.pm
diff options
context:
space:
mode:
authorbeatrice <beatrice@dangofactory.net>2026-11-22 20:01:35 +0900
committerbeatrice <beatrice@dangofactory.net>2026-11-22 20:01:35 +0900
commit6e93939f2b885f1f53836fa3e19b398a5ebbdf40 (patch)
tree5fde91edefd5452acabd3e09426a5a47f232a64c /inc/Module/Install/CheckConflicts.pm
downloadText-Markdown-master.tar.gz
Text-Markdown-master.zip
Import Text-Markdown-1.000031.tar.gzHEADlocal/Text-Markdownmaster
Diffstat (limited to 'inc/Module/Install/CheckConflicts.pm')
-rw-r--r--inc/Module/Install/CheckConflicts.pm67
1 files changed, 67 insertions, 0 deletions
diff --git a/inc/Module/Install/CheckConflicts.pm b/inc/Module/Install/CheckConflicts.pm
new file mode 100644
index 0000000..53e993b
--- /dev/null
+++ b/inc/Module/Install/CheckConflicts.pm
@@ -0,0 +1,67 @@
+#line 1
+use strict;
+use warnings;
+
+package Module::Install::CheckConflicts;
+
+use base 'Module::Install::Base';
+
+BEGIN {
+ our $VERSION = '0.02';
+ our $ISCORE = 1;
+}
+
+sub check_conflicts {
+ my $self = shift;
+ # Deal with the fact that prompt_script calls us with just the script
+ # name by totally ignoring it. HACK!
+ my %conflicts = @_ unless scalar(@_) == 1;
+ my %conflicts_found;
+ for my $mod (sort keys %conflicts) {
+ next unless $self->can_use($mod);
+
+ my $installed = $mod->VERSION;
+ next unless $installed le $conflicts{$mod};
+
+ $conflicts_found{$mod} = $installed;
+ }
+
+ return unless scalar keys %conflicts_found;
+
+ my $dist = $self->name;
+
+ print <<"EOM";
+
+***
+ WARNING:
+
+ This version of ${dist} conflicts with
+ the version of some modules you have installed.
+
+ You will need to upgrade these modules after
+ installing this version of ${dist}.
+
+ List of the conflicting modules and their installed
+ versions:
+
+EOM
+
+ for my $mod (sort keys %conflicts_found) {
+ print sprintf(" %s : %s (<= %s)\n",
+ $mod, $conflicts_found{$mod}, $conflicts{$mod},
+ );
+ }
+
+ print "\n***\n";
+
+ return if $ENV{PERL_MM_USE_DEFAULT};
+ return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
+
+ sleep 4;
+}
+
+1;
+
+__END__
+
+#line 124