lib/Net/API/CPAN/Cover.pm

filter: Statementstmt 97.3% 37 / 38 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.8% 13 / 14 Podpod 100% 7 / 7 totaltotal 88.7% 63 / 71 CC 7 SCAR 12.3
CC
7
Cov
86%
init
7.8
object
2.0
BEGIN
1.0
CRAP 3.4
« lib/Net/API/CPAN/Release/Suggest.pm ↑ Summary lib/Net/API/CPAN/Changes/Release.pm »
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/26
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 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use parent qw( Net::API::CPAN::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶ our $VERSION = 'v0.1.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 };
25  
26 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 sub init
30 {
31 1 ▶ my $self = shift( @_ );
Subroutine init: called CC=7 SCAR=20.5
Pod documented
32 1 ▶ $self->{criteria} = undef unless( CORE::exists( $self->{criteria} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"criteria"} 1 0 1
33 1 ▶ $self->{distribution} = undef unless( CORE::exists( $self->{distribution} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"distribution"} 1 0 1
34 1 $self->{object} = 'cover';
35 1 ▶ $self->{release} = undef unless( CORE::exists( $self->{release} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"release"} 1 0 1
36 1 ▶ $self->{url} = undef unless( CORE::exists( $self->{url} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"url"} 1 0 1
37 1 ▶ $self->{version} = '' unless( CORE::exists( $self->{version} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"version"} 1 0 1
38 1 $self->{_init_strict_use_sub} = 1;
39 1 $self->{_exception_class} = 'Net::API::CPAN::Exception';
40 1 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 1 1
41 1 $self->{fields} = [qw( criteria distribution release url version )];
42 1 return( $self );
43 }
44  
45 2 ▶sub criteria { return( shift->_set_get_class( 'criteria', {
Subroutine criteria: called CC=1 SCAR=0.0
Pod documented
46 branch => "float",
47 condition => "float",
48 statement => "float",
49 subroutine => "float",
50 total => "float",
51 }, @_ ) ); }
52  
53 2 ▶sub distribution { return( shift->_set_get_scalar_as_object( 'distribution', @_ ) ); }
Subroutine distribution: called CC=1 SCAR=0.0
Pod documented
54  
55 0 ▶sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
Subroutine object: not called CC=1 SCAR=6.9
Pod documented
56  
57 2 ▶sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); }
Subroutine release: called CC=1 SCAR=0.0
Pod documented
58  
59 2 ▶sub url { return( shift->_set_get_uri( 'url', @_ ) ); }
Subroutine url: called CC=1 SCAR=0.0
Pod documented
60  
61 2 ▶sub version { return( shift->_set_get_version( { class => "Changes::Version", field => "version" }, @_ ) ); }
Subroutine version: called CC=1 SCAR=0.0
Pod documented
62  
63 2 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  
« lib/Net/API/CPAN/Release/Suggest.pm ↑ Summary lib/Net/API/CPAN/Changes/Release.pm »