This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade CPAN-Meta from version 2.133380 to 2.140630
[perl5.git] / cpan / CPAN-Meta / lib / CPAN / Meta / Feature.pm
1 use 5.006;
2 use strict;
3 use warnings;
4 package CPAN::Meta::Feature;
5 our $VERSION = '2.140630'; # VERSION
6
7 use CPAN::Meta::Prereqs;
8
9 # =head1 DESCRIPTION
10 #
11 # A CPAN::Meta::Feature object describes an optional feature offered by a CPAN
12 # distribution and specified in the distribution's F<META.json> (or F<META.yml>)
13 # file.
14 #
15 # For the most part, this class will only be used when operating on the result of
16 # the C<feature> or C<features> methods on a L<CPAN::Meta> object.
17 #
18 # =method new
19 #
20 #   my $feature = CPAN::Meta::Feature->new( $identifier => \%spec );
21 #
22 # This returns a new Feature object.  The C<%spec> argument to the constructor
23 # should be the same as the value of the C<optional_feature> entry in the
24 # distmeta.  It must contain entries for C<description> and C<prereqs>.
25 #
26 # =cut
27
28 sub new {
29   my ($class, $identifier, $spec) = @_;
30
31   my %guts = (
32     identifier  => $identifier,
33     description => $spec->{description},
34     prereqs     => CPAN::Meta::Prereqs->new($spec->{prereqs}),
35   );
36
37   bless \%guts => $class;
38 }
39
40 # =method identifier
41 #
42 # This method returns the feature's identifier.
43 #
44 # =cut
45
46 sub identifier  { $_[0]{identifier}  }
47
48 # =method description
49 #
50 # This method returns the feature's long description.
51 #
52 # =cut
53
54 sub description { $_[0]{description} }
55
56 # =method prereqs
57 #
58 # This method returns the feature's prerequisites as a L<CPAN::Meta::Prereqs>
59 # object.
60 #
61 # =cut
62
63 sub prereqs     { $_[0]{prereqs} }
64
65 1;
66
67 # ABSTRACT: an optional feature provided by a CPAN distribution
68
69 __END__
70
71 =pod
72
73 =encoding UTF-8
74
75 =head1 NAME
76
77 CPAN::Meta::Feature - an optional feature provided by a CPAN distribution
78
79 =head1 VERSION
80
81 version 2.140630
82
83 =head1 DESCRIPTION
84
85 A CPAN::Meta::Feature object describes an optional feature offered by a CPAN
86 distribution and specified in the distribution's F<META.json> (or F<META.yml>)
87 file.
88
89 For the most part, this class will only be used when operating on the result of
90 the C<feature> or C<features> methods on a L<CPAN::Meta> object.
91
92 =head1 METHODS
93
94 =head2 new
95
96   my $feature = CPAN::Meta::Feature->new( $identifier => \%spec );
97
98 This returns a new Feature object.  The C<%spec> argument to the constructor
99 should be the same as the value of the C<optional_feature> entry in the
100 distmeta.  It must contain entries for C<description> and C<prereqs>.
101
102 =head2 identifier
103
104 This method returns the feature's identifier.
105
106 =head2 description
107
108 This method returns the feature's long description.
109
110 =head2 prereqs
111
112 This method returns the feature's prerequisites as a L<CPAN::Meta::Prereqs>
113 object.
114
115 =head1 BUGS
116
117 Please report any bugs or feature using the CPAN Request Tracker.
118 Bugs can be submitted through the web interface at
119 L<http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta>
120
121 When submitting a bug or request, please include a test-file or a patch to an
122 existing test-file that illustrates the bug or desired feature.
123
124 =head1 AUTHORS
125
126 =over 4
127
128 =item *
129
130 David Golden <dagolden@cpan.org>
131
132 =item *
133
134 Ricardo Signes <rjbs@cpan.org>
135
136 =back
137
138 =head1 COPYRIGHT AND LICENSE
139
140 This software is copyright (c) 2010 by David Golden and Ricardo Signes.
141
142 This is free software; you can redistribute it and/or modify it under
143 the same terms as the Perl 5 programming language system itself.
144
145 =cut