Baseline - Launch of backpan.org
[catagits/BackPAN-Web.git] / lib / BackPAN / Index / Dist.pm
CommitLineData
b67ffc2e 1package BackPAN::Index::Dist;
2
3use strict;
4use warnings;
5
6use CLASS;
7use BackPAN::Index::Role::AsHash;
8
9use overload
10 q[""] => sub { $_[0]->name },
11 fallback => 1;
12
13sub data_methods {
14 return qw(
15 name num_releases
16 first_release first_date first_author
17 latest_release latest_date latest_author
18 );
19}
20
21sub authors {
22 my $self = shift;
23
24 return $self->releases->search(undef, { distinct => 1 })->get_column("cpanid")->all;
25}
26
271;
28
29__END__
30
31=head1 NAME
32
33BackPAN::Index::Dist - Representing a distribution on BackPAN
34
35=head1 SYNOPSIS
36
37Use through BackPAN::Index.
38
39=head1 DESCRIPTION
40
41An object representing a distribution on BackPAN. A distribution is
42made up of releases.
43
44=head2 releases
45
46 my $releases = $dist->releases;
47
48A ResultSet of this distribution's releases.
49
50=head2 name
51
52 my $dist_name = $dist->name;
53
54Name of the distribution.
55
56=head2 authors
57
58 my @authors = $dist->authors;
59
60Return the CPANIDs which made releases of this $dist, in no particular order.
61
62=head2 num_releases
63
64 my $num_releases = $dist->num_releases;
65
66Returns the number of releases this distribution has.
67
68=head2 first_release
69
70=head2 latest_release
71
72 my $release = $dist->first_release;
73
74Returns the first or latest release of this distribution as a BackPAN::Index::Release.
75
76=head2 first_date
77
78=head2 latest_date
79
80 my $release = $dist->first_date;
81
82Returns the date of the first or latest release of this distribution.
83
84=head2 first_author
85
86=head2 latest_author
87
88 my $cpanid = $dist->first_author;
89
90Returns the CPANID of the author of the first or latest release.
91
92=head2 as_hash
93
94 my $data = $dist->as_hash;
95
96Returns a hash ref containing the data inside C<$dist>.
97
98
99=head1 SEE ALSO
100
101L<BackPAN::Index>
102
103=cut
104
1051;