File Coverage

lib/Net/API/CPAN/Cover.pm
Criterion Covered Total %
statement 36 37 97.3
branch 6 12 50.0
condition n/a
subroutine 13 14 92.8
pod 7 7 100.0
total 62 70 88.5


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Meta CPAN API - ~/lib/Net/API/CPAN/Cover.pm
3             ## Version v0.1.0
4             ## Copyright(c) 2023 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2023/07/25
7             ## Modified 2023/09/25
8             ## All rights reserved
9             ##
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             # This module file has been automatically generated. Any change made here will be lost.
15             # Edit the script in ./build/build_modules.pl instead
16             package Net::API::CPAN::Cover;
17             BEGIN
18             {
19 2     2   234834 use strict;
  2         10  
  2         54  
20 2     2   21 use warnings;
  2         2  
  2         50  
21 2     2   7 use parent qw( Net::API::CPAN::Generic );
  2         4  
  2         14  
22 2     2   120 use vars qw( $VERSION );
  2         9  
  2         74  
23 2     2   32 our $VERSION = 'v0.1.0';
24             };
25              
26 2     2   9 use strict;
  2         3  
  2         36  
27 2     2   7 use warnings;
  2         4  
  2         575  
28              
29             sub init
30             {
31 1     1 1 9992 my $self = shift( @_ );
32 1 50       71 $self->{criteria} = undef unless( CORE::exists( $self->{criteria} ) );
33 1 50       6 $self->{distribution} = undef unless( CORE::exists( $self->{distribution} ) );
34 1         4 $self->{object} = 'cover';
35 1 50       4 $self->{release} = undef unless( CORE::exists( $self->{release} ) );
36 1 50       3 $self->{url} = undef unless( CORE::exists( $self->{url} ) );
37 1 50       3 $self->{version} = '' unless( CORE::exists( $self->{version} ) );
38 1         2 $self->{_init_strict_use_sub} = 1;
39 1         3 $self->{_exception_class} = 'Net::API::CPAN::Exception';
40 1 50       9 $self->SUPER::init( @_ ) || return( $self->pass_error );
41 1         5 $self->{fields} = [qw( criteria distribution release url version )];
42 1         3 return( $self );
43             }
44              
45 2     2 1 61553 sub criteria { return( shift->_set_get_class( 'criteria', {
46             branch => "float",
47             condition => "float",
48             statement => "float",
49             subroutine => "float",
50             total => "float",
51             }, @_ ) ); }
52              
53 2     2 1 907 sub distribution { return( shift->_set_get_scalar_as_object( 'distribution', @_ ) ); }
54              
55 0     0 1 0 sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
56              
57 2     2 1 356030 sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); }
58              
59 2     2 1 2185 sub url { return( shift->_set_get_uri( 'url', @_ ) ); }
60              
61 2     2 1 18757 sub version { return( shift->_set_get_version( { class => "Changes::Version", field => "version" }, @_ ) ); }
62              
63             1;
64             # NOTE: POD
65             __END__
66              
67             =encoding utf-8
68              
69             =head1 NAME
70              
71             Net::API::CPAN::Cover - Meta CPAN API Cover Class
72              
73             =head1 SYNOPSIS
74              
75             use Net::API::CPAN::Cover;
76             my $obj = Net::API::CPAN::Cover->new( {
77             criteria => {
78             branch => "54.68",
79             condition => "57.56",
80             statement => "78.14",
81             subroutine => "80.00",
82             total => "67.65",
83             },
84             distribution => "Folklore-Japan",
85             release => "Folklore-Japan-v1.2.3",
86             url => "http://cpancover.com/latest/Folklore-Japan-v1.2.3/index.html",
87             version => "v1.2.3",
88             } ) || die( Net::API::CPAN::Cover->error );
89            
90             my $this = $obj->criteria;
91             my $float = $obj->criteria->branch;
92             my $float = $obj->criteria->condition;
93             my $float = $obj->criteria->statement;
94             my $float = $obj->criteria->subroutine;
95             my $float = $obj->criteria->total;
96             my $string = $obj->distribution;
97             my $str = $obj->object;
98             my $string = $obj->release;
99             my $uri = $obj->url;
100             my $vers = $obj->version;
101              
102             =head1 VERSION
103              
104             v0.1.0
105              
106             =head1 DESCRIPTION
107              
108             This class serves to retrieve and manipulate covers.
109              
110             It inherits from L<Net::API::CPAN::Generic>
111              
112             =head1 CONSTRUCTOR
113              
114             =head2 new
115              
116             Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Cover> object.
117              
118             The parameters that can be provided bear the same name and supports the same values as the methods below.
119              
120             =head1 METHODS
121              
122             =head2 criteria
123              
124             $obj->criteria( {
125             branch => "54.68",
126             condition => "57.56",
127             statement => "78.14",
128             subroutine => "80.00",
129             total => "67.65",
130             } );
131             my $this = $obj->criteria;
132             $obj->criteria->branch( "54.68" );
133             my $float = $obj->criteria->branch;
134             $obj->criteria->condition( "57.56" );
135             my $float = $obj->criteria->condition;
136             $obj->criteria->statement( "78.14" );
137             my $float = $obj->criteria->statement;
138             $obj->criteria->subroutine( "80.00" );
139             my $float = $obj->criteria->subroutine;
140             $obj->criteria->total( "67.65" );
141             my $float = $obj->criteria->total;
142              
143             Sets or gets a dynamic class object with class name C<Net::API::CPAN::Cover::Criteria> and having the folowing properties also accessible as methods, and returns an object from such class, or C<undef> if no value was provided.
144              
145             =over 4
146              
147             =item * C<branch> integer (L<number object|Module::Generic::Number>)
148              
149             =item * C<condition> integer (L<number object|Module::Generic::Number>)
150              
151             =item * C<statement> integer (L<number object|Module::Generic::Number>)
152              
153             =item * C<subroutine> integer (L<number object|Module::Generic::Number>)
154              
155             =item * C<total> integer (L<number object|Module::Generic::Number>)
156              
157             =back
158              
159             =head2 distribution
160              
161             $obj->distribution( "Folklore-Japan" );
162             my $string = $obj->distribution;
163              
164             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
165              
166             =head2 object
167              
168             Returns the object type for this class, which is C<cover>
169              
170             =head2 release
171              
172             $obj->release( "Folklore-Japan-v1.2.3" );
173             my $string = $obj->release;
174              
175             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
176              
177             =head2 url
178              
179             $obj->url( "http://cpancover.com/latest/Folklore-Japan-v1.2.3/index.html" );
180             my $uri = $obj->url;
181              
182             Sets or gets an L<URI>, and returns an L<URI object|URI> or C<undef> if no value is set.
183              
184             =head2 version
185              
186             $obj->version( "v1.2.3" );
187             my $version = $obj->version;
188              
189             Sets or gets a version value and returns a version object using L<Changes::Version>.
190              
191             =head1 API SAMPLE
192              
193             {
194             "criteria" : {
195             "branch" : "54.68",
196             "total" : "67.65",
197             "condition" : "57.56",
198             "subroutine" : "80.00",
199             "statement" : "78.14"
200             },
201             "version" : "v1.2.3",
202             "distribution" : "Folklore-Japan",
203             "url" : "http://cpancover.com/latest/Folklore-Japan-v1.2.3/index.html",
204             "release" : "Folklore-Japan-v1.2.3"
205             }
206              
207             =head1 AUTHOR
208              
209             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
210              
211             =head1 SEE ALSO
212              
213             L<Net::API::CPAN>, L<Net::API::CPAN::Activity>, L<Net::API::CPAN::Author>, L<Net::API::CPAN::Changes>, L<Net::API::CPAN::Changes::Release>, L<Net::API::CPAN::Contributor>, L<Net::API::CPAN::Cover>, L<Net::API::CPAN::Diff>, L<Net::API::CPAN::Distribution>, L<Net::API::CPAN::DownloadUrl>, L<Net::API::CPAN::Favorite>, L<Net::API::CPAN::File>, L<Net::API::CPAN::Module>, L<Net::API::CPAN::Package>, L<Net::API::CPAN::Permission>, L<Net::API::CPAN::Rating>, L<Net::API::CPAN::Release>
214              
215             L<MetaCPAN::API>, L<MetaCPAN::Client>
216              
217             L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
218              
219             =head1 COPYRIGHT & LICENSE
220              
221             Copyright(c) 2023 DEGUEST Pte. Ltd.
222              
223             All rights reserved
224              
225             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
226              
227             =cut
228