1CPAN::Meta::Prereqs(3)User Contributed Perl DocumentationCPAN::Meta::Prereqs(3)
2
3
4

NAME

6       CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and
7       type
8

VERSION

10       version 2.150010
11

DESCRIPTION

13       A CPAN::Meta::Prereqs object represents the prerequisites for a CPAN
14       distribution or one of its optional features.  Each set of prereqs is
15       organized by phase and type, as described in CPAN::Meta::Prereqs.
16

METHODS

18   new
19         my $prereq = CPAN::Meta::Prereqs->new( \%prereq_spec );
20
21       This method returns a new set of Prereqs.  The input should look like
22       the contents of the "prereqs" field described in CPAN::Meta::Spec,
23       meaning something more or less like this:
24
25         my $prereq = CPAN::Meta::Prereqs->new({
26           runtime => {
27             requires => {
28               'Some::Module' => '1.234',
29               ...,
30             },
31             ...,
32           },
33           ...,
34         });
35
36       You can also construct an empty set of prereqs with:
37
38         my $prereqs = CPAN::Meta::Prereqs->new;
39
40       This empty set of prereqs is useful for accumulating new prereqs before
41       finally dumping the whole set into a structure or string.
42
43   requirements_for
44         my $requirements = $prereqs->requirements_for( $phase, $type );
45
46       This method returns a CPAN::Meta::Requirements object for the given
47       phase/type combination.  If no prerequisites are registered for that
48       combination, a new CPAN::Meta::Requirements object will be returned,
49       and it may be added to as needed.
50
51       If $phase or $type are undefined or otherwise invalid, an exception
52       will be raised.
53
54   phases
55         my @phases = $prereqs->phases;
56
57       This method returns the list of all phases currently populated in the
58       prereqs object, suitable for iterating.
59
60   types_in
61         my @runtime_types = $prereqs->types_in('runtime');
62
63       This method returns the list of all types currently populated in the
64       prereqs object for the provided phase, suitable for iterating.
65
66   with_merged_prereqs
67         my $new_prereqs = $prereqs->with_merged_prereqs( $other_prereqs );
68
69         my $new_prereqs = $prereqs->with_merged_prereqs( \@other_prereqs );
70
71       This method returns a new CPAN::Meta::Prereqs objects in which all the
72       other prerequisites given are merged into the current set.  This is
73       primarily provided for combining a distribution's core prereqs with the
74       prereqs of one of its optional features.
75
76       The new prereqs object has no ties to the originals, and altering it
77       further will not alter them.
78
79   merged_requirements
80           my $new_reqs = $prereqs->merged_requirements( \@phases, \@types );
81           my $new_reqs = $prereqs->merged_requirements( \@phases );
82           my $new_reqs = $prereqs->merged_requirements();
83
84       This method joins together all requirements across a number of phases
85       and types into a new CPAN::Meta::Requirements object.  If arguments are
86       omitted, it defaults to "runtime", "build" and "test" for phases and
87       "requires" and "recommends" for types.
88
89   as_string_hash
90       This method returns a hashref containing structures suitable for
91       dumping into a distmeta data structure.  It is made up of hashes and
92       strings, only; there will be no Prereqs, CPAN::Meta::Requirements, or
93       "version" objects inside it.
94
95   is_finalized
96       This method returns true if the set of prereqs has been marked
97       "finalized," and cannot be altered.
98
99   finalize
100       Calling "finalize" on a Prereqs object will close it for further
101       modification.  Attempting to make any changes that would actually alter
102       the prereqs will result in an exception being thrown.
103
104   clone
105         my $cloned_prereqs = $prereqs->clone;
106
107       This method returns a Prereqs object that is identical to the original
108       object, but can be altered without affecting the original object.
109       Finalization does not survive cloning, meaning that you may clone a
110       finalized set of prereqs and then modify the clone.
111

BUGS

113       Please report any bugs or feature using the CPAN Request Tracker.  Bugs
114       can be submitted through the web interface at
115       <http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta>
116
117       When submitting a bug or request, please include a test-file or a patch
118       to an existing test-file that illustrates the bug or desired feature.
119

AUTHORS

121       •   David Golden <dagolden@cpan.org>
122
123       •   Ricardo Signes <rjbs@cpan.org>
124
125       •   Adam Kennedy <adamk@cpan.org>
126
128       This software is copyright (c) 2010 by David Golden, Ricardo Signes,
129       Adam Kennedy and Contributors.
130
131       This is free software; you can redistribute it and/or modify it under
132       the same terms as the Perl 5 programming language system itself.
133
134
135
136perl v5.36.0                      2023-01-20            CPAN::Meta::Prereqs(3)
Impressum