File: CheckConflicts.pm

package info (click to toggle)
libtext-markdown-perl 1.000031-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,920 kB
  • ctags: 151
  • sloc: perl: 2,159; makefile: 12
file content (67 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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