1use 5.006; 2use strict; 3use warnings; 4package CPAN::Meta::Feature; 5our $VERSION = '2.140640'; # VERSION 6 7use 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 28sub 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 46sub identifier { $_[0]{identifier} } 47 48# =method description 49# 50# This method returns the feature's long description. 51# 52# =cut 53 54sub 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 63sub prereqs { $_[0]{prereqs} } 64 651; 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 77CPAN::Meta::Feature - an optional feature provided by a CPAN distribution 78 79=head1 VERSION 80 81version 2.140640 82 83=head1 DESCRIPTION 84 85A CPAN::Meta::Feature object describes an optional feature offered by a CPAN 86distribution and specified in the distribution's F<META.json> (or F<META.yml>) 87file. 88 89For the most part, this class will only be used when operating on the result of 90the 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 98This returns a new Feature object. The C<%spec> argument to the constructor 99should be the same as the value of the C<optional_feature> entry in the 100distmeta. It must contain entries for C<description> and C<prereqs>. 101 102=head2 identifier 103 104This method returns the feature's identifier. 105 106=head2 description 107 108This method returns the feature's long description. 109 110=head2 prereqs 111 112This method returns the feature's prerequisites as a L<CPAN::Meta::Prereqs> 113object. 114 115=head1 BUGS 116 117Please report any bugs or feature using the CPAN Request Tracker. 118Bugs can be submitted through the web interface at 119L<http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta> 120 121When submitting a bug or request, please include a test-file or a patch to an 122existing test-file that illustrates the bug or desired feature. 123 124=head1 AUTHORS 125 126=over 4 127 128=item * 129 130David Golden <dagolden@cpan.org> 131 132=item * 133 134Ricardo Signes <rjbs@cpan.org> 135 136=back 137 138=head1 COPYRIGHT AND LICENSE 139 140This software is copyright (c) 2010 by David Golden and Ricardo Signes. 141 142This is free software; you can redistribute it and/or modify it under 143the same terms as the Perl 5 programming language system itself. 144 145=cut 146