File Coverage

blib/lib/CPAN/Local/Role/MetaCPAN/API.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of CPAN-Local-Role-MetaCPAN-API
3             #
4             # This software is Copyright (c) 2013 by White-Point Star, LLC <http://whitepointstarllc.com>.
5             #
6             # This is free software, licensed under:
7             #
8             # The GNU Lesser General Public License, Version 2.1, February 1999
9             #
10             package CPAN::Local::Role::MetaCPAN::API;
11             {
12             $CPAN::Local::Role::MetaCPAN::API::VERSION = '0.001';
13             }
14              
15             # ABSTRACT: A role for plugins needing to access or query MetaCPAN's API
16              
17 1     1   877456 use common::sense;
  1         10  
  1         6  
18              
19 1     1   62 use Moose::Role;
  1         2  
  1         10  
20 1     1   7603 use namespace::autoclean;
  1         1629  
  1         7  
21 1     1   1124 use MooseX::AttributeShortcuts;
  1         391171  
  1         8  
22 1     1   38008 use Moose::Util::TypeConstraints;
  1         5  
  1         12  
23              
24 1     1   8711 use MetaCPAN::API;
  1         193763  
  1         224  
25              
26             with 'MooseX::RelatedClasses' => {
27             name => 'MetaCPAN::API',
28             namespace => undef,
29             };
30              
31              
32             has metacpan => (
33             is => 'lazy',
34             isa => class_type('MetaCPAN::API'),
35             builder => sub {
36             my $self = shift @_;
37              
38             my $v = $self->VERSION // 'dev';
39             return $self->meta_cpan__api_class->new(
40             ua_args => [
41             agent => "CPAN::Local::Role::MetaCPAN::API-$v / ",
42             ],
43             );
44             },
45             );
46              
47             !!42;
48              
49             __END__
50              
51             =pod
52              
53             =encoding utf-8
54              
55             =for :stopwords Chris Weyl White-Point Star, LLC <http://whitepointstarllc.com> metacpan
56             MetaCPAN's
57              
58             =head1 NAME
59              
60             CPAN::Local::Role::MetaCPAN::API - A role for plugins needing to access or query MetaCPAN's API
61              
62             =head1 VERSION
63              
64             This document describes version 0.001 of CPAN::Local::Role::MetaCPAN::API - released April 15, 2013 as part of CPAN-Local-Role-MetaCPAN-API.
65              
66             =head1 SYNOPSIS
67              
68             # in your plugin
69             with 'CPAN::Local::Role::MetaCPAN::API';
70              
71             # and later somewhere...
72             my $foo = $self->metacpan->...
73              
74             =head1 DESCRIPTION
75              
76             This is a role for L<CPAN::Local> plugins that want to access the MetaCPAN
77             API, by providing a L</metacpan> attribute granting easy access to a
78             L<MetaCPAN::API> instance.
79              
80             =head1 ATTRIBUTES
81              
82             =head2 metacpan
83              
84             This attribute contains a read-only, lazily constructed L<MetaCPAN::API>
85             instance.
86              
87             =head1 METHODS
88              
89             =head2 metacpan
90              
91             Returns our L<MetaCPAN::API> instance.
92              
93             =head1 SEE ALSO
94              
95             Please see those modules/websites for more information related to this module.
96              
97             =over 4
98              
99             =item *
100              
101             L<MetaCPAN::API|MetaCPAN::API>
102              
103             =item *
104              
105             L<CPAN::Local|CPAN::Local>
106              
107             =back
108              
109             =head1 SOURCE
110              
111             The development version is on github at L<http://github.com/WhitePointStarLLC/cpan-local-role-metacpan-api>
112             and may be cloned from L<git://github.com/WhitePointStarLLC/cpan-local-role-metacpan-api.git>
113              
114             =head1 BUGS
115              
116             Please report any bugs or feature requests on the bugtracker website
117             https://github.com/WhitePointStarLLC/cpan-local-role-metacpan-api/issues
118              
119             When submitting a bug or request, please include a test-file or a
120             patch to an existing test-file that illustrates the bug or desired
121             feature.
122              
123             =head1 AUTHOR
124              
125             Chris Weyl <cweyl@alumni.drew.edu>
126              
127             =head1 COPYRIGHT AND LICENSE
128              
129             This software is Copyright (c) 2013 by White-Point Star, LLC <http://whitepointstarllc.com>.
130              
131             This is free software, licensed under:
132              
133             The GNU Lesser General Public License, Version 2.1, February 1999
134              
135             =cut