1CPAN::Meta::Prereqs(3)User Contributed Perl DocumentationCPAN::Meta::Prereqs(3)
2
3
4
6 CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and
7 type
8
10 version 2.120921
11
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
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 with_merged_prereqs
55 my $new_prereqs = $prereqs->with_merged_prereqs( $other_prereqs );
56
57 my $new_prereqs = $prereqs->with_merged_prereqs( \@other_prereqs );
58
59 This method returns a new CPAN::Meta::Prereqs objects in which all the
60 other prerequisites given are merged into the current set. This is
61 primarily provided for combining a distribution's core prereqs with the
62 prereqs of one of its optional features.
63
64 The new prereqs object has no ties to the originals, and altering it
65 further will not alter them.
66
67 as_string_hash
68 This method returns a hashref containing structures suitable for
69 dumping into a distmeta data structure. It is made up of hashes and
70 strings, only; there will be no Prereqs, CPAN::Meta::Requirements, or
71 "version" objects inside it.
72
73 is_finalized
74 This method returns true if the set of prereqs has been marked
75 "finalized," and cannot be altered.
76
77 finalize
78 Calling "finalize" on a Prereqs object will close it for further
79 modification. Attempting to make any changes that would actually alter
80 the prereqs will result in an exception being thrown.
81
82 clone
83 my $cloned_prereqs = $prereqs->clone;
84
85 This method returns a Prereqs object that is identical to the original
86 object, but can be altered without affecting the original object.
87 Finalization does not survive cloning, meaning that you may clone a
88 finalized set of prereqs and then modify the clone.
89
91 Please report any bugs or feature using the CPAN Request Tracker. Bugs
92 can be submitted through the web interface at
93 <http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta>
94
95 When submitting a bug or request, please include a test-file or a patch
96 to an existing test-file that illustrates the bug or desired feature.
97
99 · David Golden <dagolden@cpan.org>
100
101 · Ricardo Signes <rjbs@cpan.org>
102
104 This software is copyright (c) 2010 by David Golden and Ricardo Signes.
105
106 This is free software; you can redistribute it and/or modify it under
107 the same terms as the Perl 5 programming language system itself.
108
109
110
111perl v5.16.3 2012-04-01 CPAN::Meta::Prereqs(3)