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