Skip to content

Commit

Permalink
Added 'url' method for fetching MetaCPAN links of module, release &au…
Browse files Browse the repository at this point in the history
…thor
  • Loading branch information
mickeyn committed Mar 22, 2017
1 parent 1ad2930 commit 5660bfb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/MetaCPAN/Client/Author.pm
Expand Up @@ -66,6 +66,8 @@ sub releases {

sub dir { $_[0]->links->{cpan_directory} }

sub url { "https://metacpan.org/author/" . $_[0]->pauseid }

1;

__END__
Expand Down Expand Up @@ -255,3 +257,7 @@ by author.
This method returns a L<MetaCPAN::Client::ResultSet> of
L<MetaCPAN::Client::Release> objects. It includes all of the author's releases
with the C<latest> status.
=head2 url
Returns a link to the author's page on MetaCPAN.
8 changes: 8 additions & 0 deletions lib/MetaCPAN/Client/Module.pm
Expand Up @@ -6,6 +6,8 @@ package MetaCPAN::Client::Module;
use Moo;
extends 'MetaCPAN::Client::File';

sub url { "https://metacpan.org/pod/" . $_[0]->distribution }

1;

__END__
Expand All @@ -23,3 +25,9 @@ This is currently the exact same as L<MetaCPAN::Client::File>.
=head1 ATTRIBUTES
Whatever L<MetaCPAN::Client::File> has.
=head1 METHODS
=head2 url
Returns a link to the module page on MetaCPAN.
8 changes: 8 additions & 0 deletions lib/MetaCPAN/Client/Release.pm
Expand Up @@ -55,6 +55,8 @@ foreach my $field (@known_fields) {

sub _known_fields { return \%known_fields }

sub url { sprintf( "https://metacpan.org/release/%s/%s", $_[0]->author, $_[0]->name ) }

1;

__END__
Expand Down Expand Up @@ -199,3 +201,9 @@ The file's size in bytes.
Returns a hashref of information about CPAN testers results for this
release. The keys are C<pass>, C<fail>, C<unknown>, and C<na>. The values are
the count of that particular result on CPAN Testers for this release.
=head1 METHODS
=head2 url
Returns a link to the release page on MetaCPAN.

0 comments on commit 5660bfb

Please sign in to comment.