NAME
Net::API::CPAN::Activity - Meta CPAN API
SYNOPSIS
use Net::API::CPAN::Activity;
my $obj = Net::API::CPAN::Activity->new(
activity => [8, 6, 6, 8, 9, 3, 7, 15, 4, 7, 4, 7, 13, 3, 1, 1, 4, 1, 1, 2, 4, 3, 4, 1]
) || die( Net::API::CPAN::Activity->error, "\n" );
VERSION
v0.1.0
DESCRIPTION
This class represent a release activity.
CONSTRUCTOR
new
This instantiates a new Net::API::CPAN::Activity
object and returns it. It takes the following arguments:
activity
An array reference of 24 integer.
Upon providing those data, this will create an hash of 24 DateTime objects representing each of the month from 23 months ago until the current month. This hash can be accessed with activities
METHODS
activity
$obj->activity( [8, 6, 6, 8, 9, 3, 7, 15, 4, 7, 4, 7, 13, 3, 1, 1, 4, 1, 1, 2, 4, 3, 4, 1] ) ||
die( $obj->error );
my $array = $obj->activity;
As a mutator, this takes an array reference of 24 integers, each representing the aggregate number of release for the interval that was specified when making the API query.
Upon setting those data, this will create an hash of 24 DateTime objects representing each of the month from 23 months ago until the current month. This hash can be accessed with activities
It returns an array object of hash references having the keys dt
for the DateTime object and value
for the integer representing the aggregate value.
my $array = $obj->activity;
foreach my $hash ( @$array )
{
say "Date: ", $hash->{dt}, ", value: ", $hash->{value};
}
activities
Sets or get the hash or key-value pairs of DateTime object to aggregate value.
You could do then something like:
my $ref = $obj->activities;
foreach my $dt ( sort( keys( %$ref ) ) )
{
say $dt, ": ", $ref->{ $dt };
}
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Net::API::CPAN, Net::API::CPAN::Author, Net::API::CPAN::Changes, Net::API::CPAN::Changes::Release, Net::API::CPAN::Contributor, Net::API::CPAN::Cover, Net::API::CPAN::Diff, Net::API::CPAN::Distribution, Net::API::CPAN::DownloadUrl, Net::API::CPAN::Favorite, Net::API::CPAN::File, Net::API::CPAN::Module, Net::API::CPAN::Package, Net::API::CPAN::Permission, Net::API::CPAN::Rating, Net::API::CPAN::Release
COPYRIGHT & LICENSE
Copyright(c) 2023 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.