line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Meta CPAN API - ~/lib/Net/API/CPAN/Rating.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::Rating; |
17
|
|
|
|
|
|
|
BEGIN |
18
|
|
|
|
|
|
|
{ |
19
|
2
|
|
|
2
|
|
227801
|
use strict; |
|
2
|
|
|
|
|
50
|
|
|
2
|
|
|
|
|
71
|
|
20
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
64
|
|
21
|
2
|
|
|
2
|
|
12
|
use parent qw( Net::API::CPAN::Generic ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
22
|
2
|
|
|
2
|
|
120
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
23
|
2
|
|
|
2
|
|
35
|
our $VERSION = 'v0.1.0'; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
38
|
|
27
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
783
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub init |
30
|
|
|
|
|
|
|
{ |
31
|
1
|
|
|
1
|
1
|
9519
|
my $self = shift( @_ ); |
32
|
1
|
50
|
|
|
|
65
|
$self->{author} = undef unless( CORE::exists( $self->{author} ) ); |
33
|
1
|
50
|
|
|
|
4
|
$self->{date} = undef unless( CORE::exists( $self->{date} ) ); |
34
|
1
|
50
|
|
|
|
3
|
$self->{details} = undef unless( CORE::exists( $self->{details} ) ); |
35
|
1
|
50
|
|
|
|
4
|
$self->{distribution} = undef unless( CORE::exists( $self->{distribution} ) ); |
36
|
1
|
50
|
|
|
|
3
|
$self->{helpful} = [] unless( CORE::exists( $self->{helpful} ) ); |
37
|
1
|
|
|
|
|
3
|
$self->{object} = 'rating'; |
38
|
1
|
50
|
|
|
|
4
|
$self->{rating} = undef unless( CORE::exists( $self->{rating} ) ); |
39
|
1
|
50
|
|
|
|
5
|
$self->{release} = undef unless( CORE::exists( $self->{release} ) ); |
40
|
1
|
50
|
|
|
|
3
|
$self->{user} = undef unless( CORE::exists( $self->{user} ) ); |
41
|
1
|
|
|
|
|
2
|
$self->{_init_strict_use_sub} = 1; |
42
|
1
|
|
|
|
|
1
|
$self->{_exception_class} = 'Net::API::CPAN::Exception'; |
43
|
1
|
50
|
|
|
|
6
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
44
|
1
|
|
|
|
|
7
|
$self->{fields} = [qw( |
45
|
|
|
|
|
|
|
author date details distribution helpful rating release user |
46
|
|
|
|
|
|
|
)]; |
47
|
1
|
|
|
|
|
3
|
return( $self ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
2
|
1
|
4403
|
sub author { return( shift->_set_get_scalar_as_object( 'author', @_ ) ); } |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
2
|
1
|
2209
|
sub date { return( shift->_set_get_datetime( 'date', @_ ) ); } |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
1
|
2288
|
sub details { return( shift->_set_get_class( 'details', { |
55
|
|
|
|
|
|
|
description => { type => "scalar" }, |
56
|
|
|
|
|
|
|
}, @_ ) ); } |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
2
|
1
|
2626443
|
sub distribution { return( shift->_set_get_scalar_as_object( 'distribution', @_ ) ); } |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
1
|
1
|
1293
|
sub helpful { return( shift->_set_get_class_array_object( 'helpful', { user => "scalar_as_object", value => "boolean" }, @_ ) ); } |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
1
|
0
|
sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); } |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
2
|
1
|
59423
|
sub rating { return( shift->_set_get_number( 'rating', @_ ) ); } |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
2
|
1
|
2970
|
sub release { return( shift->_set_get_scalar_as_object( 'release', @_ ) ); } |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
2
|
1
|
205868
|
sub user { return( shift->_set_get_scalar_as_object( 'user', @_ ) ); } |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
# NOTE: POD |
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding utf-8 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Net::API::CPAN::Rating - Meta CPAN API Rating Class |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SYNOPSIS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use Net::API::CPAN::Rating; |
83
|
|
|
|
|
|
|
my $obj = Net::API::CPAN::Rating->new( { |
84
|
|
|
|
|
|
|
author => "PLACEHOLDER", |
85
|
|
|
|
|
|
|
date => "2018-05-31T09:20:07", |
86
|
|
|
|
|
|
|
distribution => "Japan-Folklore", |
87
|
|
|
|
|
|
|
rating => "5.0", |
88
|
|
|
|
|
|
|
release => "PLACEHOLDER", |
89
|
|
|
|
|
|
|
user => "CPANRatings", |
90
|
|
|
|
|
|
|
} ) || die( Net::API::CPAN::Rating->error ); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my $string = $obj->author; |
93
|
|
|
|
|
|
|
my $date = $obj->date; |
94
|
|
|
|
|
|
|
my $this = $obj->details; |
95
|
|
|
|
|
|
|
my $description_obj = $obj->details->description; |
96
|
|
|
|
|
|
|
my $string = $obj->distribution; |
97
|
|
|
|
|
|
|
my $array = $obj->helpful; |
98
|
|
|
|
|
|
|
foreach my $this ( @$array ) |
99
|
|
|
|
|
|
|
{ |
100
|
|
|
|
|
|
|
my $scalar = $this->user; |
101
|
|
|
|
|
|
|
my $boolean = $this->value; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
my $str = $obj->object; |
104
|
|
|
|
|
|
|
my $num = $obj->rating; |
105
|
|
|
|
|
|
|
my $string = $obj->release; |
106
|
|
|
|
|
|
|
my $string = $obj->user; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 VERSION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
v0.1.0 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 DESCRIPTION |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This class serves to retrieve and manipulate ratings. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
It inherits from L<Net::API::CPAN::Generic> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 new |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Rating> object. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The parameters that can be provided bear the same name and supports the same values as the methods below. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 METHODS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 author |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$obj->author( "PLACEHOLDER" ); |
131
|
|
|
|
|
|
|
my $string = $obj->author; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 date |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$obj->date( "2018-05-31T09:20:07" ); |
138
|
|
|
|
|
|
|
my $datetime_obj = $obj->date; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
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. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 details |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Sets or gets a dynamic class object with class name C<Net::API::CPAN::Rating::Details> and having the folowing properties also accessible as methods, and returns an object from such class, or C<undef> if no value was provided. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * C<description> string (L<scalar object|Module::Generic::Scalar>) |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 distribution |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
$obj->distribution( "Japan-Folklore" ); |
155
|
|
|
|
|
|
|
my $string = $obj->distribution; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 helpful |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Rating::Helpful> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
A C<Net::API::CPAN::Rating::Helpful> object will be instantiated with each value from the array provided and replace said value. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * C<user> scalar_as_object |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * C<value> boolean (L<boolean object|Module::Generic::Boolean>) |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=back |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 object |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Returns the object type for this class, which is C<rating> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 rating |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
$obj->rating("5.0"); |
180
|
|
|
|
|
|
|
my $number = $obj->rating; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Sets or gets a float value, and returns a L<number object|Module::Generic::Number> or C<undef> if no value is set. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 release |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
$obj->release( "PLACEHOLDER" ); |
187
|
|
|
|
|
|
|
my $string = $obj->release; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 user |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$obj->user( "CPANRatings" ); |
194
|
|
|
|
|
|
|
my $string = $obj->user; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 API SAMPLE |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
{ |
201
|
|
|
|
|
|
|
"rating" : "5.0", |
202
|
|
|
|
|
|
|
"user" : "CPANRatings", |
203
|
|
|
|
|
|
|
"distribution" : "Japan-Folklore", |
204
|
|
|
|
|
|
|
"release" : "PLACEHOLDER", |
205
|
|
|
|
|
|
|
"date" : "2018-05-31T09:20:07", |
206
|
|
|
|
|
|
|
"author" : "PLACEHOLDER" |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 AUTHOR |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 SEE ALSO |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
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> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
L<MetaCPAN::API>, L<MetaCPAN::Client> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md> |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Copyright(c) 2023 DEGUEST Pte. Ltd. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
All rights reserved |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
230
|
|
|
|
|
|
|
|