/usr/share/perl5/Dist/Zilla/Plugin/Prereqs.pm is in libdist-zilla-perl 5.043-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | package Dist::Zilla::Plugin::Prereqs;
# ABSTRACT: list simple prerequisites
$Dist::Zilla::Plugin::Prereqs::VERSION = '5.043';
use Moose;
with 'Dist::Zilla::Role::PrereqSource';
use namespace::autoclean;
#pod =head1 SYNOPSIS
#pod
#pod In your F<dist.ini>:
#pod
#pod [Prereqs]
#pod Foo::Bar = 1.002
#pod MRO::Compat = 10
#pod Sub::Exporter = 0
#pod
#pod You can specify requirements for different phases and relationships with:
#pod
#pod [Prereqs]
#pod -phase = test
#pod -relationship = recommends
#pod
#pod Fitz::Fotz = 1.23
#pod Text::SoundEx = 3
#pod
#pod Remember that if you load two Prereqs plugins, each will needs its own name,
#pod added like this:
#pod
#pod [Prereqs / PluginName]
#pod -phase = test
#pod -relationship = recommends
#pod
#pod Fitz::Fotz = 1.23
#pod Text::SoundEx = 3
#pod
#pod If the name is the CamelCase concatenation of a phase and relationship
#pod (or just a relationship), it will set those parameters implicitly. If
#pod you use a custom name, but it does not specify the relationship, and
#pod you didn't specify either C<-phase> or C<-relationship>, it throws the
#pod error C<No -phase or -relationship specified>. This is to prevent a
#pod typo that makes the name meaningless from slipping by unnoticed.
#pod
#pod The example below is equivalent to the example above, except for the name of
#pod the resulting plugin:
#pod
#pod [Prereqs / TestRecommends]
#pod Fitz::Fotz = 1.23
#pod Text::SoundEx = 3
#pod
#pod =head1 DESCRIPTION
#pod
#pod This module adds "fixed" prerequisites to your distribution. These are prereqs
#pod with a known, fixed minimum version that doesn't change based on platform or
#pod other conditions.
#pod
#pod You can specify prerequisites for different phases and kinds of relationships.
#pod In C<RuntimeRequires>, the phase is Runtime and the relationship is Requires.
#pod These are described in more detail in the L<CPAN::Meta
#pod specification|CPAN::Meta::Spec/PREREQUISITES>.
#pod
#pod The phases are:
#pod
#pod =for :list
#pod * configure
#pod * build
#pod * test
#pod * runtime
#pod * develop
#pod
#pod The relationship types are:
#pod
#pod =for :list
#pod * requires
#pod * recommends
#pod * suggests
#pod * conflicts
#pod
#pod If the phase is omitted, it will default to I<runtime>; thus, specifying
#pod "Prereqs / Recommends" in your dist.ini is equivalent to I<RuntimeRecommends>.
#pod
#pod Not all of these phases are useful for all tools, especially tools that only
#pod understand version 1.x CPAN::Meta files.
#pod
#pod =cut
has prereq_phase => (
is => 'ro',
isa => 'Str',
lazy => 1,
init_arg => 'phase',
default => 'runtime',
);
has prereq_type => (
is => 'ro',
isa => 'Str',
lazy => 1,
init_arg => 'type',
default => 'requires',
);
around dump_config => sub {
my ($orig, $self) = @_;
my $config = $self->$orig;
my $this_config = {
type => $self->prereq_type,
phase => $self->prereq_phase,
};
$config->{'' . __PACKAGE__} = $this_config;
return $config;
};
has _prereq => (
is => 'ro',
isa => 'HashRef',
default => sub { {} },
);
sub mvp_aliases { return { -relationship => '-type' } }
around BUILDARGS => sub {
my $orig = shift;
my ($class, @arg) = @_;
my $args = $class->$orig(@arg);
my %copy = %{ $args };
my $zilla = delete $copy{zilla};
my $name = delete $copy{plugin_name};
my @dashed = grep { /^-/ } keys %copy;
my %other;
for my $dkey (@dashed) {
(my $key = $dkey) =~ s/^-//;
$other{ $key } = delete $copy{ $dkey };
}
confess "don't try to pass -_prereq as a build arg!" if $other{_prereq};
# Handle magic plugin names:
unless (($other{phase} and $other{type})
# plugin comes from a bundle
or $name =~ m! (?: \A | / ) Prereqs? \z !x) {
my ($phase, $type) = $name =~ /\A
(Build|Test|Runtime|Configure|Develop)?
(Requires|Recommends|Suggests|Conflicts)
\z/x;
if ($type) {
$other{phase} ||= lc $phase if defined $phase;
$other{type} ||= lc $type;
} else {
$zilla->chrome->logger->log_fatal({ prefix => "[$name] " },
"No -phase or -relationship specified")
unless $other{phase} or $other{type};
}
}
return {
zilla => $zilla,
plugin_name => $name,
_prereq => \%copy,
%other,
}
};
sub register_prereqs {
my ($self) = @_;
$self->zilla->register_prereqs(
{
type => $self->prereq_type,
phase => $self->prereq_phase,
},
%{ $self->_prereq },
);
}
__PACKAGE__->meta->make_immutable;
1;
#pod =head1 SEE ALSO
#pod
#pod =over 4
#pod
#pod =item *
#pod
#pod Core Dist::Zilla plugins:
#pod L<@Basic|Dist::Zilla::PluginBundle::Basic>,
#pod L<AutoPrereqs|Dist::Zilla::Plugin::AutoPrereqs>.
#pod
#pod =item *
#pod
#pod The CPAN Meta specification: L<CPAN::Meta/PREREQUISITES>.
#pod
#pod =back
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::Plugin::Prereqs - list simple prerequisites
=head1 VERSION
version 5.043
=head1 SYNOPSIS
In your F<dist.ini>:
[Prereqs]
Foo::Bar = 1.002
MRO::Compat = 10
Sub::Exporter = 0
You can specify requirements for different phases and relationships with:
[Prereqs]
-phase = test
-relationship = recommends
Fitz::Fotz = 1.23
Text::SoundEx = 3
Remember that if you load two Prereqs plugins, each will needs its own name,
added like this:
[Prereqs / PluginName]
-phase = test
-relationship = recommends
Fitz::Fotz = 1.23
Text::SoundEx = 3
If the name is the CamelCase concatenation of a phase and relationship
(or just a relationship), it will set those parameters implicitly. If
you use a custom name, but it does not specify the relationship, and
you didn't specify either C<-phase> or C<-relationship>, it throws the
error C<No -phase or -relationship specified>. This is to prevent a
typo that makes the name meaningless from slipping by unnoticed.
The example below is equivalent to the example above, except for the name of
the resulting plugin:
[Prereqs / TestRecommends]
Fitz::Fotz = 1.23
Text::SoundEx = 3
=head1 DESCRIPTION
This module adds "fixed" prerequisites to your distribution. These are prereqs
with a known, fixed minimum version that doesn't change based on platform or
other conditions.
You can specify prerequisites for different phases and kinds of relationships.
In C<RuntimeRequires>, the phase is Runtime and the relationship is Requires.
These are described in more detail in the L<CPAN::Meta
specification|CPAN::Meta::Spec/PREREQUISITES>.
The phases are:
=over 4
=item *
configure
=item *
build
=item *
test
=item *
runtime
=item *
develop
=back
The relationship types are:
=over 4
=item *
requires
=item *
recommends
=item *
suggests
=item *
conflicts
=back
If the phase is omitted, it will default to I<runtime>; thus, specifying
"Prereqs / Recommends" in your dist.ini is equivalent to I<RuntimeRecommends>.
Not all of these phases are useful for all tools, especially tools that only
understand version 1.x CPAN::Meta files.
=head1 SEE ALSO
=over 4
=item *
Core Dist::Zilla plugins:
L<@Basic|Dist::Zilla::PluginBundle::Basic>,
L<AutoPrereqs|Dist::Zilla::Plugin::AutoPrereqs>.
=item *
The CPAN Meta specification: L<CPAN::Meta/PREREQUISITES>.
=back
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|