Merge branch 'hotfix_myinfo'
[catagits/BackPAN-Web.git] / lib / BackPAN / Index / Release.pm
1 package BackPAN::Index::Release;
2
3 use strict;
4 use warnings;
5
6 use overload
7   q[""]         => sub { $_[0]->distvname },
8   fallback      => 1;
9
10 use BackPAN::Index::Role::AsHash;
11
12 sub data_methods {
13     return qw(dist version cpanid date path maturity);
14 }
15
16 sub filename {
17     my $self = shift;
18     return $self->path->filename;
19 }
20
21 # Compatibility with PBP
22 sub prefix {
23     my $self = shift;
24     return $self->path;
25 }
26
27 1;
28
29 __END__
30
31 =head1 NAME
32
33 BackPAN::Index::Release - A single release of a distribution
34
35 =head1 SYNOPSIS
36
37   my $b = BackPAN::Index->new();
38
39   # Find version 1.2.3 of Acme-Colour
40   my $release = $b->release("Acme-Colour", '1.2.3');
41
42   print "   CPANID: " . $release->cpanid . "\n";
43   print "     Date: " . $release->date . "\n";
44   print "     Dist: " . $release->dist . "\n";
45   print "Distvname: " . $release->distvname . "\n";
46   print " Filename: " . $release->filename . "\n";
47   print " Maturity: " . $release->maturity . "\n";
48   print "     Path: " . $release->path . "\n";
49   print "  Version: " . $release->version . "\n";
50
51 =head1 DESCRIPTION
52
53 BackPAN::Index::Release objects represent releases,
54 individual tarballs/zip files, of a distribution on BackPAN.
55
56 For example, Acme-Pony-1.2.3.tar.gz is a release of the Acme-Pony
57 distribution.
58
59 =head1 METHODS
60
61 =head2 cpanid
62
63     my $cpanid = $release->cpanid;
64
65 Returns the PAUSE ID of the author of the release.
66
67 =head2 date
68
69     my $date = $release->date;
70
71 Returns the date of the release, in UNIX epoch seconds.
72
73 =head2 dist
74
75     my $dist_name = $release->dist;
76
77 Returns the name of the distribution this release belongs to.
78
79 =head2 distvname
80
81     my $distvname = $release->distvname;
82
83 Returns the name of the distribution, hyphen, and version.
84
85 =head2 filename
86
87     my $filename = $release->filename;
88
89 Returns the filename of the release, just the file part.
90
91 =head2 maturity
92
93     my $maturity = $release->maturity;
94
95 Returns the maturity of the release.
96
97 =head2 path
98
99     my $path = $release->path;
100
101 Returns the full path on CPAN to the release.  This is a
102 L<BackPAN::File> object.
103
104 =head2 version
105
106     my $version = $release->version;
107
108 Returns the version of the release:
109
110 =head2 as_hash
111
112     my $data = $release->as_hash;
113
114 Returns a hash ref containing the data inside C<$release>.
115
116
117 =head1 AUTHOR
118
119 Leon Brocard <acme@astray.com> and Michael G Schwern <schwern@pobox.com>
120
121 =head1 COPYRIGHT
122
123 Copyright (C) 2005-2009, Leon Brocard
124
125 This module is free software; you can redistribute it or modify it under
126 the same terms as Perl itself.
127
128 =head1 SEE ALSO
129
130 L<BackPAN::Index>, L<BackPAN::Index::Dist>, L<BackPAN::Index::File>
131