blib/lib/Net/API/CPAN/Mirrors.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 61 CC 4 SCAR 19.2
CC
4
Cov
0%
init
20.0
BEGIN
2.0
mirrors
2.0
CRAP 6.8
1 ##----------------------------------------------------------------------------
2 ## Meta CPAN API - ~/lib/Net/API/CPAN/Mirrors.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::Mirrors;
17 BEGIN
18 {
19 use strict;
20 use warnings;
21 use parent qw( Net::API::CPAN::Generic );
22 use vars qw( $VERSION );
23 our $VERSION = 'v0.1.0';
24 };
25  
26 use strict;
27 use warnings;
28  
29 sub init
30 {
31 my $self = shift( @_ );
32 $self->{mirrors} = [] unless( CORE::exists( $self->{mirrors} ) );
33 $self->{object} = 'mirrors';
34 $self->{took} = undef unless( CORE::exists( $self->{took} ) );
35 $self->{total} = undef unless( CORE::exists( $self->{total} ) );
36 $self->{_init_strict_use_sub} = 1;
37 $self->{_exception_class} = 'Net::API::CPAN::Exception';
38 $self->SUPER::init( @_ ) || return( $self->pass_error );
39 $self->{fields} = [qw( mirrors took total )];
40 return( $self );
41 }
42  
43 sub mirrors { return( shift->_set_get_object_array_object( 'mirrors', 'Net::API::CPAN::Mirror', @_ ) ); }
44  
45 sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
46  
47 sub took { return( shift->_set_get_number( 'took', @_ ) ); }
48  
49 sub total { return( shift->_set_get_number( 'total', @_ ) ); }
50  
51 1;
52 # NOTE: POD
53 __END__
54  
55 =encoding utf-8
56  
57 =head1 NAME
58  
59 Net::API::CPAN::Mirrors - Meta CPAN API Mirrors Class
60  
61 =head1 SYNOPSIS
62  
63 use Net::API::CPAN::Mirrors;
64 my $obj = Net::API::CPAN::Mirrors->new( {
65 mirrors => [
66 {
67 ccode => "zz",
68 city => "Everywhere",
69 contact => [
70 {
71 contact_site => "perl.org",
72 contact_user => "cpan",
73 },
74 ],
75 continent => "Global",
76 country => "Global",
77 distance => undef,
78 dnsrr => "N",
79 freq => "instant",
80 http => "http://www.cpan.org/",
81 inceptdate => "2021-04-09T00:00:00",
82 location => [
83 0,
84 0,
85 ],
86 name => "www.cpan.org",
87 org => "Global CPAN CDN",
88 src => "rsync://cpan-rsync.perl.org/CPAN/",
89 tz => 0,
90 },
91 ],
92 took => 2,
93 total => 1,
94 } ) || die( Net::API::CPAN::Mirrors->error );
95
96 my $array = $obj->mirrors;
97 my $str = $obj->object;
98 my $num = $obj->took;
99 my $num = $obj->total;
100  
101 =head1 VERSION
102  
103 v0.1.0
104  
105 =head1 DESCRIPTION
106  
107 This class serves to retrieve and manipulate mirrors.
108  
109 It inherits from L<Net::API::CPAN::Generic>
110  
111 =head1 CONSTRUCTOR
112  
113 =head2 new
114  
115 Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Mirrors> object.
116  
117 The parameters that can be provided bear the same name and supports the same values as the methods below.
118  
119 =head1 METHODS
120  
121 =head2 mirrors
122  
123 $obj->mirrors( [
124 {
125 ccode => "zz",
126 city => "Everywhere",
127 contact => [
128 {
129 contact_site => "perl.org",
130 contact_user => "cpan",
131 },
132 ],
133 continent => "Global",
134 country => "Global",
135 distance => undef,
136 dnsrr => "N",
137 freq => "instant",
138 http => "http://www.cpan.org/",
139 inceptdate => "2021-04-09T00:00:00",
140 location => [
141 0,
142 0,
143 ],
144 name => "www.cpan.org",
145 org => "Global CPAN CDN",
146 src => "rsync://cpan-rsync.perl.org/CPAN/",
147 tz => 0,
148 },
149 ] );
150 my $array = $obj->mirrors;
151  
152 Sets or gets an array of L<Net::API::CPAN::Mirror> objects, or creates an L<Net::API::CPAN::Mirror> instance for each mirrors provided in the array, and returns an L<array object|Module::Generic::Array>, even if no value was provided.
153  
154 =head2 object
155  
156 Returns the object type for this class, which is C<mirrors>
157  
158 =head2 took
159  
160 $obj->took(2);
161 my $number = $obj->took;
162  
163 Sets or gets an integer value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set.
164  
165 =head2 total
166  
167 $obj->total(1);
168 my $number = $obj->total;
169  
170 Sets or gets an integer value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set.
171  
172 =head1 API SAMPLE
173  
174 {
175 "mirrors" : [
176 {
177 "ccode" : "zz",
178 "city" : "Everywhere",
179 "contact" : [
180 {
181 "contact_site" : "perl.org",
182 "contact_user" : "cpan"
183 }
184 ],
185 "continent" : "Global",
186 "country" : "Global",
187 "distance" : null,
188 "dnsrr" : "N",
189 "freq" : "instant",
190 "http" : "http://www.cpan.org/",
191 "inceptdate" : "2021-04-09T00:00:00",
192 "location" : [
193 0,
194 0
195 ],
196 "name" : "www.cpan.org",
197 "org" : "Global CPAN CDN",
198 "src" : "rsync://cpan-rsync.perl.org/CPAN/",
199 "tz" : "0"
200 }
201 ],
202 "took" : 2,
203 "total" : 1
204 }
205  
206 =head1 AUTHOR
207  
208 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
209  
210 =head1 SEE ALSO
211  
212 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>
213  
214 L<MetaCPAN::API>, L<MetaCPAN::Client>
215  
216 L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
217  
218 =head1 COPYRIGHT & LICENSE
219  
220 Copyright(c) 2023 DEGUEST Pte. Ltd.
221  
222 All rights reserved
223  
224 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
225  
226 =cut
227