| 1 | package WWW::PGXN::Tag; | ||
| 2 | |||
| 3 | 9 | ▶ | use 5.8.1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 9 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 9 | our $VERSION = v0.12.4; | |
| 7 | |||
| 8 | sub new { | ||
| 9 | 1 | ▶ | my ($class, $data) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 10 | 1 | bless $data, $class; | |
| 11 | } | ||
| 12 | |||
| 13 | 1 | ▶ | sub name { shift->{tag} } |
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | |||
| 15 | sub releases { | ||
| 16 | 1 | ▶ | +{ %{ shift->{releases} } } |
|
Subroutine
releases: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | } | ||
| 18 | |||
| 19 | __END__ | ||
| 20 | |||
| 21 | =head1 Name | ||
| 22 | |||
| 23 | WWW::PGXN::Tag - Tag metadata fetched from PGXN | ||
| 24 | |||
| 25 | =head1 Synopsis | ||
| 26 | |||
| 27 | my $pgxn = WWW::PGXN->new( url => 'http://api.pgxn.org/' ); | ||
| 28 | my $tag = $pgxn->get_tag('unit testing'); | ||
| 29 | say $tag->name; | ||
| 30 | |||
| 31 | =head1 Description | ||
| 32 | |||
| 33 | This module represents PGXN tag metadata fetched from PGXN>. It is not | ||
| 34 | intended to be constructed directly, but via the L<WWW::PGXN/get_tag> method | ||
| 35 | of L<WWW::PGXN>. | ||
| 36 | |||
| 37 | =head1 Interface | ||
| 38 | |||
| 39 | =begin private | ||
| 40 | |||
| 41 | =head2 Constructor | ||
| 42 | |||
| 43 | =head3 C<new> | ||
| 44 | |||
| 45 | my $tag = WWW::PGXN::Tag->new($data); | ||
| 46 | |||
| 47 | Construct a new WWW::PGXN::Tag object. The argument must be the data fetched. | ||
| 48 | |||
| 49 | =end private | ||
| 50 | |||
| 51 | =head2 Instance Accessors | ||
| 52 | |||
| 53 | =head3 C<name> | ||
| 54 | |||
| 55 | my $name = $tag->name; | ||
| 56 | $tag->name($name); | ||
| 57 | |||
| 58 | The name of the tag. | ||
| 59 | |||
| 60 | =head3 C<releases> | ||
| 61 | |||
| 62 | my $releases = $tag->releases; | ||
| 63 | |||
| 64 | Returns a hash reference describing all of the distributions ever released | ||
| 65 | with the tag. The keys of are distribution names and the values are hash | ||
| 66 | references that may contain the following keys: | ||
| 67 | |||
| 68 | =over | ||
| 69 | |||
| 70 | =item C<stable> | ||
| 71 | |||
| 72 | =item C<testing> | ||
| 73 | |||
| 74 | =item C<unstable> | ||
| 75 | |||
| 76 | An array reference containing hashes of versions and release dates of all | ||
| 77 | releases of the distribution with the named release status, ordered from most | ||
| 78 | to least recent. | ||
| 79 | |||
| 80 | =item C<abstract> | ||
| 81 | |||
| 82 | A brief description of the distribution. Available only from the PGXN API, not | ||
| 83 | mirrors. | ||
| 84 | |||
| 85 | =back | ||
| 86 | |||
| 87 | Here's an example of the C<releases> data structure: | ||
| 88 | |||
| 89 | { | ||
| 90 | explanation => { | ||
| 91 | abstract => 'Turn an explain plan into a proximity tree', | ||
| 92 | stable => [ | ||
| 93 | { version => '0.2.0', date => '2011-02-21T20:14:56Z' } | ||
| 94 | ] | ||
| 95 | }, | ||
| 96 | pair => { | ||
| 97 | abstract => 'A key/value pair data type', | ||
| 98 | stable => [ | ||
| 99 | { version => '0.1.1', date => '2010-10-22T16:32:52Z' }, | ||
| 100 | { version => '0.1.0', date => '2010-10-19T03:59:54Z' } | ||
| 101 | ], | ||
| 102 | testing => [ | ||
| 103 | { version => '0.0.1', date => '2010-09-23T14:23:52Z' } | ||
| 104 | ] | ||
| 105 | }, | ||
| 106 | } | ||
| 107 | |||
| 108 | =head1 See Also | ||
| 109 | |||
| 110 | =over | ||
| 111 | |||
| 112 | =item * L<WWW::PGXN> | ||
| 113 | |||
| 114 | The main class to communicate with a PGXN mirror or API server. | ||
| 115 | |||
| 116 | =back | ||
| 117 | |||
| 118 | =head1 Support | ||
| 119 | |||
| 120 | This module is stored in an open L<GitHub | ||
| 121 | repository|http://github.com/theory/www-pgxn/>. Feel free to fork and | ||
| 122 | contribute! | ||
| 123 | |||
| 124 | Please file bug reports via L<GitHub | ||
| 125 | Issues|http://github.com/theory/www-pgxn/issues/> or by sending mail to | ||
| 126 | L<bug-WWW-PGXN@rt.cpan.org|mailto:bug-WWW-PGXN@rt.cpan.org>. | ||
| 127 | |||
| 128 | =head1 Author | ||
| 129 | |||
| 130 | David E. Wheeler <david@justatheory.com> | ||
| 131 | |||
| 132 | =head1 Copyright and License | ||
| 133 | |||
| 134 | Copyright (c) 2011 David E. Wheeler. Some Rights Reserved. | ||
| 135 | |||
| 136 | This module is free software; you can redistribute it and/or modify it under | ||
| 137 | the same terms as Perl itself. | ||
| 138 | |||
| 139 | =cut | ||