File Coverage

lib/Net/API/CPAN/Changes.pm
Criterion Covered Total %
statement 55 56 98.2
branch 29 58 50.0
condition n/a
subroutine 9 10 90.0
pod 3 3 100.0
total 96 127 75.5


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Meta CPAN API - ~/lib/Net/API/CPAN/Changes.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::Changes;
17             BEGIN
18             {
19 2     2   230976 use strict;
  2         10  
  2         55  
20 2     2   8 use warnings;
  2         4  
  2         63  
21 2     2   10 use parent qw( Net::API::CPAN::File );
  2         5  
  2         15  
22 2     2   91 use vars qw( $VERSION );
  2         3  
  2         79  
23 2     2   28 our $VERSION = 'v0.1.0';
24             };
25              
26 2     2   8 use strict;
  2         4  
  2         32  
27 2     2   7 use warnings;
  2         4  
  2         838  
28              
29             sub init
30             {
31 1     1 1 9800 my $self = shift( @_ );
32 1 50       81 $self->{author} = undef unless( CORE::exists( $self->{author} ) );
33 1 50       5 $self->{authorized} = undef unless( CORE::exists( $self->{authorized} ) );
34 1 50       3 $self->{binary} = undef unless( CORE::exists( $self->{binary} ) );
35 1 50       5 $self->{category} = undef unless( CORE::exists( $self->{category} ) );
36 1 50       3 $self->{content} = undef unless( CORE::exists( $self->{content} ) );
37 1 50       3 $self->{date} = undef unless( CORE::exists( $self->{date} ) );
38 1 50       6 $self->{deprecated} = undef unless( CORE::exists( $self->{deprecated} ) );
39 1 50       15 $self->{directory} = undef unless( CORE::exists( $self->{directory} ) );
40 1 50       3 $self->{dist_fav_count} = undef unless( CORE::exists( $self->{dist_fav_count} ) );
41 1 50       4 $self->{distribution} = undef unless( CORE::exists( $self->{distribution} ) );
42 1 50       4 $self->{download_url} = undef unless( CORE::exists( $self->{download_url} ) );
43 1 50       4 $self->{id} = undef unless( CORE::exists( $self->{id} ) );
44 1 50       3 $self->{indexed} = undef unless( CORE::exists( $self->{indexed} ) );
45 1 50       3 $self->{level} = undef unless( CORE::exists( $self->{level} ) );
46 1 50       3 $self->{maturity} = undef unless( CORE::exists( $self->{maturity} ) );
47 1 50       3 $self->{mime} = undef unless( CORE::exists( $self->{mime} ) );
48 1 50       5 $self->{module} = [] unless( CORE::exists( $self->{module} ) );
49 1 50       3 $self->{name} = undef unless( CORE::exists( $self->{name} ) );
50 1         2 $self->{object} = 'changes';
51 1 50       6 $self->{path} = undef unless( CORE::exists( $self->{path} ) );
52 1 50       4 $self->{pod} = undef unless( CORE::exists( $self->{pod} ) );
53 1 50       3 $self->{pod_lines} = [] unless( CORE::exists( $self->{pod_lines} ) );
54 1 50       4 $self->{release} = undef unless( CORE::exists( $self->{release} ) );
55 1 50       4 $self->{sloc} = undef unless( CORE::exists( $self->{sloc} ) );
56 1 50       4 $self->{slop} = undef unless( CORE::exists( $self->{slop} ) );
57 1 50       3 $self->{stat} = undef unless( CORE::exists( $self->{stat} ) );
58 1 50       4 $self->{status} = undef unless( CORE::exists( $self->{status} ) );
59 1 50       4 $self->{version} = '' unless( CORE::exists( $self->{version} ) );
60 1 50       3 $self->{version_numified} = undef unless( CORE::exists( $self->{version_numified} ) );
61 1         2 $self->{_init_strict_use_sub} = 1;
62 1         2 $self->{_exception_class} = 'Net::API::CPAN::Exception';
63 1 50       7 $self->SUPER::init( @_ ) || return( $self->pass_error );
64 1         11 $self->{fields} = [qw(
65             author authorized binary category content date deprecated directory dist_fav_count
66             distribution download_url id indexed level maturity mime module name path pod
67             pod_lines release sloc slop stat status version version_numified
68             )];
69 1         3 return( $self );
70             }
71              
72             # NOTE: sub author is inherited from Net::API::CPAN::File
73              
74             # NOTE: sub authorized is inherited from Net::API::CPAN::File
75              
76             # NOTE: sub binary is inherited from Net::API::CPAN::File
77              
78             # NOTE: sub category is inherited from Net::API::CPAN::File
79              
80 2     2 1 11013 sub content { return( shift->_set_get_scalar_as_object( 'content', @_ ) ); }
81              
82             # NOTE: sub date is inherited from Net::API::CPAN::File
83              
84             # NOTE: sub deprecated is inherited from Net::API::CPAN::File
85              
86             # NOTE: sub directory is inherited from Net::API::CPAN::File
87              
88             # NOTE: sub dist_fav_count is inherited from Net::API::CPAN::File
89              
90             # NOTE: sub distribution is inherited from Net::API::CPAN::File
91              
92             # NOTE: sub download_url is inherited from Net::API::CPAN::File
93              
94             # NOTE: sub id is inherited from Net::API::CPAN::File
95              
96             # NOTE: sub indexed is inherited from Net::API::CPAN::File
97              
98             # NOTE: sub level is inherited from Net::API::CPAN::File
99              
100             # NOTE: sub maturity is inherited from Net::API::CPAN::File
101              
102             # NOTE: sub mime is inherited from Net::API::CPAN::File
103              
104             # NOTE: sub module is inherited from Net::API::CPAN::File
105              
106             # NOTE: sub name is inherited from Net::API::CPAN::File
107              
108 0     0 1   sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
109              
110             # NOTE: sub path is inherited from Net::API::CPAN::File
111              
112             # NOTE: sub pod is inherited from Net::API::CPAN::File
113              
114             # NOTE: sub pod_lines is inherited from Net::API::CPAN::File
115              
116             # NOTE: sub release is inherited from Net::API::CPAN::File
117              
118             # NOTE: sub sloc is inherited from Net::API::CPAN::File
119              
120             # NOTE: sub slop is inherited from Net::API::CPAN::File
121              
122             # NOTE: sub stat is inherited from Net::API::CPAN::File
123              
124             # NOTE: sub status is inherited from Net::API::CPAN::File
125              
126             # NOTE: sub version is inherited from Net::API::CPAN::File
127              
128             # NOTE: sub version_numified is inherited from Net::API::CPAN::File
129              
130             1;
131             # NOTE: POD
132             __END__
133              
134             =encoding utf-8
135              
136             =head1 NAME
137              
138             Net::API::CPAN::Changes - Meta CPAN API Changes Class
139              
140             =head1 SYNOPSIS
141              
142             use Net::API::CPAN::Changes;
143             my $obj = Net::API::CPAN::Changes->new( {
144             author => "MOMOTARO",
145             authorized => \1,
146             binary => \0,
147             category => "changelog",
148             content => "Revision history for Perl module Folklore::Japan\n\nv1.2.3 2023-07-29T09:12:10+0900\n - Initial release\n",
149             date => "2023-07-29T23:14:52",
150             deprecated => \0
151             ,
152             directory => \0
153             ,
154             distribution => "Folklore-Japan",
155             download_url => "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz",
156             id => "Jp_IsS0oC00l_CoM3OveR",
157             indexed => \0
158             ,
159             level => 0,
160             maturity => "released",
161             mime => "",
162             module => [],
163             name => "CHANGES",
164             path => "CHANGES",
165             pod => "",
166             pod_lines => [],
167             release => "Folklore-Japan-v1.2.3",
168             sloc => 487,
169             slop => 0,
170             stat => {
171             mode => 33188,
172             mtime => 1690618397,
173             size => 108,
174             },
175             status => "latest",
176             version => "v1.2.3",
177             version_numified => "1.002003",
178             } ) || die( Net::API::CPAN::Changes->error );
179            
180             my $string = $obj->author;
181             my $bool = $obj->authorized;
182             my $bool = $obj->binary;
183             my $string = $obj->category;
184             my $string = $obj->content;
185             my $date = $obj->date;
186             my $bool = $obj->deprecated;
187             my $bool = $obj->directory;
188             my $num = $obj->dist_fav_count;
189             my $string = $obj->distribution;
190             my $uri = $obj->download_url;
191             my $string = $obj->id;
192             my $bool = $obj->indexed;
193             my $num = $obj->level;
194             my $string = $obj->maturity;
195             my $string = $obj->mime;
196             my $array = $obj->module;
197             foreach my $this ( @$array )
198             {
199             my $scalar = $this->associated_pod;
200             my $boolean = $this->authorized;
201             my $boolean = $this->indexed;
202             my $scalar = $this->name;
203             my $scalar = $this->version;
204             my $number = $this->version_numified;
205             }
206             my $string = $obj->name;
207             my $str = $obj->object;
208             my $string = $obj->path;
209             my $string = $obj->pod;
210             my $array = $obj->pod_lines;
211             my $string = $obj->release;
212             my $string = $obj->sloc;
213             my $string = $obj->slop;
214             my $this = $obj->stat;
215             my $integer = $obj->stat->gid;
216             my $integer = $obj->stat->mode;
217             my $datetime = $obj->stat->mtime;
218             my $integer = $obj->stat->size;
219             my $integer = $obj->stat->uid;
220             my $string = $obj->status;
221             my $vers = $obj->version;
222             my $num = $obj->version_numified;
223              
224             =head1 VERSION
225              
226             v0.1.0
227              
228             =head1 DESCRIPTION
229              
230             This class serves to retrieve and manipulate changes.
231              
232             It inherits from L<Net::API::CPAN::Generic>
233              
234             =head1 CONSTRUCTOR
235              
236             =head2 new
237              
238             Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Changes> object.
239              
240             The parameters that can be provided bear the same name and supports the same values as the methods below.
241              
242             =head1 METHODS
243              
244             =head2 author
245              
246             $obj->author( "MOMOTARO" );
247             my $string = $obj->author;
248              
249             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
250              
251             =head2 authorized
252              
253             $obj->authorized(1);
254             my $bool = $obj->authorized;
255              
256             Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set.
257              
258             =head2 binary
259              
260             $obj->binary(1);
261             my $bool = $obj->binary;
262              
263             Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set.
264              
265             =head2 category
266              
267             $obj->category( "changelog" );
268             my $string = $obj->category;
269              
270             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
271              
272             =head2 content
273              
274             $obj->content( "Revision history for Perl module Folklore::Japan\n\nv1.2.3 2023-07-29T09:12:10+0900\n - Initial release\n" );
275             my $string = $obj->content;
276              
277             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
278              
279             =head2 date
280              
281             $obj->date( "2023-07-29T23:14:52" );
282             my $datetime_obj = $obj->date;
283              
284             Sets or gets a datetime value, and returns a L<DateTime object|DateTime> that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or C<undef> if no value is set.
285              
286             =head2 deprecated
287              
288             $obj->deprecated(1);
289             my $bool = $obj->deprecated;
290              
291             Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set.
292              
293             =head2 directory
294              
295             $obj->directory(1);
296             my $bool = $obj->directory;
297              
298             Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set.
299              
300             =head2 dist_fav_count
301              
302             Sets or gets an integer value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set.
303              
304             =head2 distribution
305              
306             $obj->distribution( "Folklore-Japan" );
307             my $string = $obj->distribution;
308              
309             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
310              
311             =head2 download_url
312              
313             $obj->download_url( "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz" );
314             my $uri = $obj->download_url;
315              
316             Sets or gets an L<URI>, and returns an L<URI object|URI> or C<undef> if no value is set.
317              
318             =head2 id
319              
320             $obj->id( "Jp_IsS0oC00l_CoM3OveR" );
321             my $string = $obj->id;
322              
323             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
324              
325             =head2 indexed
326              
327             $obj->indexed(1);
328             my $bool = $obj->indexed;
329              
330             Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set.
331              
332             =head2 level
333              
334             $obj->level(0);
335             my $number = $obj->level;
336              
337             Sets or gets an integer value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set.
338              
339             =head2 maturity
340              
341             $obj->maturity( "released" );
342             my $string = $obj->maturity;
343              
344             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
345              
346             =head2 mime
347              
348             $obj->mime( "" );
349             my $string = $obj->mime;
350              
351             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
352              
353             =head2 module
354              
355             $obj->module( [] );
356             my $array = $obj->module;
357             foreach my $this ( @$array )
358             {
359             my $scalar = $this->associated_pod;
360             my $boolean = $this->authorized;
361             my $boolean = $this->indexed;
362             my $scalar = $this->name;
363             my $scalar = $this->version;
364             my $number = $this->version_numified;
365             }
366              
367             Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Changes::Module> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value.
368              
369             A C<Net::API::CPAN::Changes::Module> object will be instantiated with each value from the array provided and replace said value.
370              
371             =over 4
372              
373             =item * C<associated_pod> scalar_as_object
374              
375             =item * C<authorized> boolean (L<boolean object|Module::Generic::Boolean>)
376              
377             =item * C<indexed> boolean (L<boolean object|Module::Generic::Boolean>)
378              
379             =item * C<name> scalar_as_object
380              
381             =item * C<version> scalar_as_object
382              
383             =item * C<version_numified> number
384              
385             =back
386              
387             =head2 name
388              
389             $obj->name( "CHANGES" );
390             my $string = $obj->name;
391              
392             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
393              
394             =head2 object
395              
396             Returns the object type for this class, which is C<changes>
397              
398             =head2 path
399              
400             $obj->path( "CHANGES" );
401             my $string = $obj->path;
402              
403             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
404              
405             =head2 pod
406              
407             $obj->pod( "" );
408             my $string = $obj->pod;
409              
410             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
411              
412             =head2 pod_lines
413              
414             $obj->pod_lines( [] );
415             my $array = $obj->pod_lines;
416              
417             Sets or gets an array of pod_lines and returns an L<array object|Module::Generic::Array>, even if there is no value.
418              
419             =head2 release
420              
421             $obj->release( "Folklore-Japan-v1.2.3" );
422             my $string = $obj->release;
423              
424             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
425              
426             =head2 sloc
427              
428             $obj->sloc( 487 );
429             my $string = $obj->sloc;
430              
431             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
432              
433             =head2 slop
434              
435             $obj->slop( 0 );
436             my $string = $obj->slop;
437              
438             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
439              
440             =head2 stat
441              
442             $obj->stat( {
443             mode => 33188,
444             mtime => 1690618397,
445             size => 108,
446             } );
447             my $this = $obj->stat;
448             my $integer = $obj->stat->gid;
449             $obj->stat->mode( 33188 );
450             my $integer = $obj->stat->mode;
451             $obj->stat->mtime( 1690618397 );
452             my $datetime = $obj->stat->mtime;
453             $obj->stat->size( 108 );
454             my $integer = $obj->stat->size;
455             my $integer = $obj->stat->uid;
456              
457             Sets or gets a dynamic class object with class name C<Net::API::CPAN::Changes::Stat> and having the folowing properties also accessible as methods, and returns an object from such class, or C<undef> if no value was provided.
458              
459             =over 4
460              
461             =item * C<gid> integer (L<number object|Module::Generic::Number>)
462              
463             =item * C<mode> integer (L<number object|Module::Generic::Number>)
464              
465             =item * C<mtime> datetime
466              
467             =item * C<size> integer (L<number object|Module::Generic::Number>)
468              
469             =item * C<uid> integer (L<number object|Module::Generic::Number>)
470              
471             =back
472              
473             =head2 status
474              
475             $obj->status( "latest" );
476             my $string = $obj->status;
477              
478             Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value.
479              
480             =head2 version
481              
482             $obj->version( "v1.2.3" );
483             my $version = $obj->version;
484              
485             Sets or gets a version value and returns a version object using L<Changes::Version>.
486              
487             =head2 version_numified
488              
489             $obj->version_numified("1.002003");
490             my $number = $obj->version_numified;
491              
492             Sets or gets a float value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set.
493              
494             =head1 API SAMPLE
495              
496             {
497             "author" : "MOMOTARO",
498             "authorized" : true,
499             "binary" : false,
500             "category" : "changelog",
501             "content" : "Revision history for Perl module Folklore::Japan\n\nv1.2.3 2023-07-29T09:12:10+0900\n - Initial release\n",
502             "date" : "2023-07-29T23:14:52",
503             "deprecated" : false,
504             "directory" : false,
505             "distribution" : "Folklore-Japan",
506             "download_url" : "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO/Folklore-Japan-v1.2.3.tar.gz",
507             "id" : "Jp_IsS0oC00l_CoM3OveR",
508             "indexed" : false,
509             "level" : 0,
510             "maturity" : "released",
511             "mime" : "",
512             "module" : [],
513             "name" : "CHANGES",
514             "path" : "CHANGES",
515             "pod" : "",
516             "pod_lines" : [],
517             "release" : "Folklore-Japan-v1.2.3",
518             "sloc" : 487,
519             "slop" : 0,
520             "stat" : {
521             "mode" : 33188,
522             "mtime" : 1690618397,
523             "size" : 108
524             },
525             "status" : "latest",
526             "version" : "v1.2.3",
527             "version_numified" : 1.002003
528             }
529              
530             =head1 AUTHOR
531              
532             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
533              
534             =head1 SEE ALSO
535              
536             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>
537              
538             L<MetaCPAN::API>, L<MetaCPAN::Client>
539              
540             L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
541              
542             =head1 COPYRIGHT & LICENSE
543              
544             Copyright(c) 2023 DEGUEST Pte. Ltd.
545              
546             All rights reserved
547              
548             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
549              
550             =cut
551