| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "CPAN::Meta::Prereqs 3perl" |
| 58 |
.TH CPAN::Meta::Prereqs 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
CPAN::Meta::Prereqs \- a set of distribution prerequisites by phase and type |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
version 2.150010 |
| 68 |
.SH DESCRIPTION |
| 69 |
.IX Header "DESCRIPTION" |
| 70 |
A CPAN::Meta::Prereqs object represents the prerequisites for a CPAN |
| 71 |
distribution or one of its optional features. Each set of prereqs is |
| 72 |
organized by phase and type, as described in CPAN::Meta::Prereqs. |
| 73 |
.SH METHODS |
| 74 |
.IX Header "METHODS" |
| 75 |
.SS new |
| 76 |
.IX Subsection "new" |
| 77 |
.Vb 1 |
| 78 |
\& my $prereq = CPAN::Meta::Prereqs\->new( \e%prereq_spec ); |
| 79 |
.Ve |
| 80 |
.PP |
| 81 |
This method returns a new set of Prereqs. The input should look like the |
| 82 |
contents of the \f(CW\*(C`prereqs\*(C'\fR field described in CPAN::Meta::Spec, meaning |
| 83 |
something more or less like this: |
| 84 |
.PP |
| 85 |
.Vb 10 |
| 86 |
\& my $prereq = CPAN::Meta::Prereqs\->new({ |
| 87 |
\& runtime => { |
| 88 |
\& requires => { |
| 89 |
\& \*(AqSome::Module\*(Aq => \*(Aq1.234\*(Aq, |
| 90 |
\& ..., |
| 91 |
\& }, |
| 92 |
\& ..., |
| 93 |
\& }, |
| 94 |
\& ..., |
| 95 |
\& }); |
| 96 |
.Ve |
| 97 |
.PP |
| 98 |
You can also construct an empty set of prereqs with: |
| 99 |
.PP |
| 100 |
.Vb 1 |
| 101 |
\& my $prereqs = CPAN::Meta::Prereqs\->new; |
| 102 |
.Ve |
| 103 |
.PP |
| 104 |
This empty set of prereqs is useful for accumulating new prereqs before finally |
| 105 |
dumping the whole set into a structure or string. |
| 106 |
.SS requirements_for |
| 107 |
.IX Subsection "requirements_for" |
| 108 |
.Vb 1 |
| 109 |
\& my $requirements = $prereqs\->requirements_for( $phase, $type ); |
| 110 |
.Ve |
| 111 |
.PP |
| 112 |
This method returns a CPAN::Meta::Requirements object for the given |
| 113 |
phase/type combination. If no prerequisites are registered for that |
| 114 |
combination, a new CPAN::Meta::Requirements object will be returned, and it may |
| 115 |
be added to as needed. |
| 116 |
.PP |
| 117 |
If \f(CW$phase\fR or \f(CW$type\fR are undefined or otherwise invalid, an exception will |
| 118 |
be raised. |
| 119 |
.SS phases |
| 120 |
.IX Subsection "phases" |
| 121 |
.Vb 1 |
| 122 |
\& my @phases = $prereqs\->phases; |
| 123 |
.Ve |
| 124 |
.PP |
| 125 |
This method returns the list of all phases currently populated in the prereqs |
| 126 |
object, suitable for iterating. |
| 127 |
.SS types_in |
| 128 |
.IX Subsection "types_in" |
| 129 |
.Vb 1 |
| 130 |
\& my @runtime_types = $prereqs\->types_in(\*(Aqruntime\*(Aq); |
| 131 |
.Ve |
| 132 |
.PP |
| 133 |
This method returns the list of all types currently populated in the prereqs |
| 134 |
object for the provided phase, suitable for iterating. |
| 135 |
.SS with_merged_prereqs |
| 136 |
.IX Subsection "with_merged_prereqs" |
| 137 |
.Vb 1 |
| 138 |
\& my $new_prereqs = $prereqs\->with_merged_prereqs( $other_prereqs ); |
| 139 |
\& |
| 140 |
\& my $new_prereqs = $prereqs\->with_merged_prereqs( \e@other_prereqs ); |
| 141 |
.Ve |
| 142 |
.PP |
| 143 |
This method returns a new CPAN::Meta::Prereqs objects in which all the |
| 144 |
other prerequisites given are merged into the current set. This is primarily |
| 145 |
provided for combining a distribution's core prereqs with the prereqs of one of |
| 146 |
its optional features. |
| 147 |
.PP |
| 148 |
The new prereqs object has no ties to the originals, and altering it further |
| 149 |
will not alter them. |
| 150 |
.SS merged_requirements |
| 151 |
.IX Subsection "merged_requirements" |
| 152 |
.Vb 3 |
| 153 |
\& my $new_reqs = $prereqs\->merged_requirements( \e@phases, \e@types ); |
| 154 |
\& my $new_reqs = $prereqs\->merged_requirements( \e@phases ); |
| 155 |
\& my $new_reqs = $prereqs\->merged_requirements(); |
| 156 |
.Ve |
| 157 |
.PP |
| 158 |
This method joins together all requirements across a number of phases |
| 159 |
and types into a new CPAN::Meta::Requirements object. If arguments |
| 160 |
are omitted, it defaults to "runtime", "build" and "test" for phases |
| 161 |
and "requires" and "recommends" for types. |
| 162 |
.SS as_string_hash |
| 163 |
.IX Subsection "as_string_hash" |
| 164 |
This method returns a hashref containing structures suitable for dumping into a |
| 165 |
distmeta data structure. It is made up of hashes and strings, only; there will |
| 166 |
be no Prereqs, CPAN::Meta::Requirements, or \f(CW\*(C`version\*(C'\fR objects inside it. |
| 167 |
.SS is_finalized |
| 168 |
.IX Subsection "is_finalized" |
| 169 |
This method returns true if the set of prereqs has been marked "finalized," and |
| 170 |
cannot be altered. |
| 171 |
.SS finalize |
| 172 |
.IX Subsection "finalize" |
| 173 |
Calling \f(CW\*(C`finalize\*(C'\fR on a Prereqs object will close it for further modification. |
| 174 |
Attempting to make any changes that would actually alter the prereqs will |
| 175 |
result in an exception being thrown. |
| 176 |
.SS clone |
| 177 |
.IX Subsection "clone" |
| 178 |
.Vb 1 |
| 179 |
\& my $cloned_prereqs = $prereqs\->clone; |
| 180 |
.Ve |
| 181 |
.PP |
| 182 |
This method returns a Prereqs object that is identical to the original object, |
| 183 |
but can be altered without affecting the original object. Finalization does |
| 184 |
not survive cloning, meaning that you may clone a finalized set of prereqs and |
| 185 |
then modify the clone. |
| 186 |
.SH BUGS |
| 187 |
.IX Header "BUGS" |
| 188 |
Please report any bugs or feature using the CPAN Request Tracker. |
| 189 |
Bugs can be submitted through the web interface at |
| 190 |
<http://rt.cpan.org/Dist/Display.html?Queue=CPAN\-Meta> |
| 191 |
.PP |
| 192 |
When submitting a bug or request, please include a test-file or a patch to an |
| 193 |
existing test-file that illustrates the bug or desired feature. |
| 194 |
.SH AUTHORS |
| 195 |
.IX Header "AUTHORS" |
| 196 |
.IP \(bu 4 |
| 197 |
David Golden <[email protected]> |
| 198 |
.IP \(bu 4 |
| 199 |
Ricardo Signes <[email protected]> |
| 200 |
.IP \(bu 4 |
| 201 |
Adam Kennedy <[email protected]> |
| 202 |
.SH "COPYRIGHT AND LICENSE" |
| 203 |
.IX Header "COPYRIGHT AND LICENSE" |
| 204 |
This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors. |
| 205 |
.PP |
| 206 |
This is free software; you can redistribute it and/or modify it under |
| 207 |
the same terms as the Perl 5 programming language system itself. |