1Dist::CheckConflicts(3)User Contributed Perl DocumentatioDnist::CheckConflicts(3)
2
3
4
6 Dist::CheckConflicts - declare version conflicts for your dist
7
9 version 0.11
10
12 use Dist::CheckConflicts
13 -dist => 'Class-MOP',
14 -conflicts => {
15 'Moose' => '1.14',
16 'namespace::autoclean' => '0.08',
17 },
18 -also => [
19 'Package::Stash::Conflicts',
20 ];
21
22 __PACKAGE__->check_conflicts;
23
25 One shortcoming of the CPAN clients that currently exist is that they
26 have no way of specifying conflicting downstream dependencies of
27 modules. This module attempts to work around this issue by allowing you
28 to specify conflicting versions of modules separately, and deal with
29 them after the module is done installing.
30
31 For instance, say you have a module "Foo", and some other module "Bar"
32 uses "Foo". If "Foo" were to change its API in a non-backwards-
33 compatible way, this would cause "Bar" to break until it is updated to
34 use the new API. "Foo" can't just depend on the fixed version of "Bar",
35 because this will cause a circular dependency (because "Bar" is already
36 depending on "Foo"), and this doesn't express intent properly anyway -
37 "Foo" doesn't use "Bar" at all. The ideal solution would be for there
38 to be a way to specify conflicting versions of modules in a way that
39 would let CPAN clients update conflicting modules automatically after
40 an existing module is upgraded, but until that happens, this module
41 will allow users to do this manually.
42
43 This module accepts a hash of options passed to its "use" statement,
44 with these keys being valid:
45
46 -conflicts
47 A hashref of conflict specifications, where keys are module names,
48 and values are the last broken version - any version greater than
49 the specified version should work.
50
51 -also
52 Additional modules to get conflicts from (potentially recursively).
53 This should generally be a list of modules which use
54 Dist::CheckConflicts, which correspond to the dists that your dist
55 depends on. (In an ideal world, this would be intuited directly
56 from your dependency list, but the dependency list isn't available
57 outside of build time).
58
59 -dist
60 The name of the distribution, to make the error message from
61 check_conflicts more user-friendly.
62
63 The methods listed below are exported by this module into the module
64 that uses it, so you should call these methods on your module, not
65 Dist::CheckConflicts.
66
67 As an example, this command line can be used to update your modules,
68 after installing the "Foo" dist (assuming that "Foo::Conflicts" is the
69 module in the "Foo" dist which uses Dist::CheckConflicts):
70
71 perl -MFoo::Conflicts -e'print "$_\n"
72 for map { $_->{package} } Foo::Conflicts->calculate_conflicts' | cpanm
73
74 As an added bonus, loading your conflicts module will provide warnings
75 at runtime if conflicting modules are detected (regardless of whether
76 they are loaded before or afterwards).
77
79 conflicts
80 Returns the conflict specification (the "-conflicts" parameter to
81 "import()"), as a hash.
82
83 dist
84 Returns the dist name (either as specified by the "-dist" parameter to
85 "import()", or the package name which "use"d this module).
86
87 check_conflicts
88 Examine the modules that are currently installed, and throw an
89 exception with useful information if any modules are at versions which
90 conflict with the dist.
91
92 calculate_conflicts
93 Examine the modules that are currently installed, and return a list of
94 modules which conflict with the dist. The modules will be returned as a
95 list of hashrefs, each containing "package", "installed", and
96 "required" keys.
97
99 No known bugs.
100
101 Please report any bugs to GitHub Issues at
102 <https://github.com/doy/dist-checkconflicts/issues>.
103
105 Module::Install::CheckConflicts
106
107 Dist::Zilla::Plugin::Conflicts
108
110 You can find this documentation for this module with the perldoc
111 command.
112
113 perldoc Dist::CheckConflicts
114
115 You can also look for information at:
116
117 • MetaCPAN
118
119 <https://metacpan.org/release/Dist-CheckConflicts>
120
121 • Github
122
123 <https://github.com/doy/dist-checkconflicts>
124
125 • RT: CPAN's request tracker
126
127 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-CheckConflicts>
128
129 • CPAN Ratings
130
131 <http://cpanratings.perl.org/d/Dist-CheckConflicts>
132
134 Jesse Luehrs <doy@tozt.net>
135
137 This software is copyright (c) 2014 by Jesse Luehrs.
138
139 This is free software; you can redistribute it and/or modify it under
140 the same terms as the Perl 5 programming language system itself.
141
142
143
144perl v5.34.0 2021-07-22 Dist::CheckConflicts(3)