NAME

Net::API::CPAN::Distribution - Meta CPAN API Distribution Class

SYNOPSIS

use Net::API::CPAN::Distribution;
my $obj = Net::API::CPAN::Distribution->new( {
  bugs => {
    github => {
      active => 5,
      closed => 10,
      open => 3,
      source => "https://github.com/momotaro/Folkore-Japan",
    },
    rt => {
      active => 2,
      closed => 18,
      new => 0,
      open => 2,
      patched => 0,
      rejected => 0,
      resolved => 18,
      source => "https://rt.cpan.org/Public/Dist/Display.html?Name=Folkore-Japan",
      stalled => 0,
    },
  },
  external_package => {
    cygwin => "perl-Folkore-Japan",
    debian => "folklore-japan-perl",
    fedora => "perl-Folkore-Japan",
  },
  name => "Folklore-Japan",
  river => {
    bucket => 2,
    bus_factor => 1,
    immediate => 15,
    total => 19,
  },
} ) || die( Net::API::CPAN::Distribution->error );

my $this = $obj->bugs;
my $github_obj = $obj->bugs->github;
my $rt_obj = $obj->bugs->rt;
my $this = $obj->external_package;
my $scalar = $obj->external_package->cygwin;
my $scalar = $obj->external_package->debian;
my $scalar = $obj->external_package->fedora;
my $this = $obj->github;
my $uri = $obj->metacpan_url;
my $string = $obj->name;
my $str = $obj->object;
my $this = $obj->river;
my $integer = $obj->river->bucket;
my $integer = $obj->river->bus_factor;
my $integer = $obj->river->immediate;
my $integer = $obj->river->total;
my $this = $obj->rt;

VERSION

v0.1.0

DESCRIPTION

This class serves to retrieve and manipulate distributions.

It inherits from Net::API::CPAN::Generic

CONSTRUCTOR

new

Provided with an hash or hash reference of parameters, and this instantiates a new Net::API::CPAN::Distribution object.

The parameters that can be provided bear the same name and supports the same values as the methods below.

METHODS

bugs

$obj->bugs( {
  github => {
    active => 5,
    closed => 10,
    open => 3,
    source => "https://github.com/momotaro/Folkore-Japan",
  },
  rt => {
    active => 2,
    closed => 18,
    new => 0,
    open => 2,
    patched => 0,
    rejected => 0,
    resolved => 18,
    source => "https://rt.cpan.org/Public/Dist/Display.html?Name=Folkore-Japan",
    stalled => 0,
  },
} );
my $this = $obj->bugs;
$obj->bugs->github( {
  active => 5,
  closed => 10,
  open => 3,
  source => "https://github.com/momotaro/Folkore-Japan",
} );
my $github_obj = $obj->bugs->github;
$obj->bugs->rt( {
  active => 2,
  closed => 18,
  new => 0,
  open => 2,
  patched => 0,
  rejected => 0,
  resolved => 18,
  source => "https://rt.cpan.org/Public/Dist/Display.html?Name=Folkore-Japan",
  stalled => 0,
} );
my $rt_obj = $obj->bugs->rt;

Sets or gets a dynamic class object with class name Net::API::CPAN::Distribution::Bugs and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

external_package

$obj->external_package( {
  cygwin => "perl-Folkore-Japan",
  debian => "folklore-japan-perl",
  fedora => "perl-Folkore-Japan",
} );
my $this = $obj->external_package;
$obj->external_package->cygwin( "perl-Folkore-Japan" );
my $scalar = $obj->external_package->cygwin;
$obj->external_package->debian( "folklore-japan-perl" );
my $scalar = $obj->external_package->debian;
$obj->external_package->fedora( "perl-Folkore-Japan" );
my $scalar = $obj->external_package->fedora;

Sets or gets a dynamic class object with class name Net::API::CPAN::Distribution::ExternalPackage and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

  • cygwin scalar_as_object

  • debian scalar_as_object

  • fedora scalar_as_object

github

Returns the object for the dynamic class Net::API::CPAN::Bugs::Github, which provides access to a few methods.

See "bugs" for more information.

It returns undef if no value is set.

metacpan_url

Returns a link, as an URI object, to the distribution's page on MetaCPAN, or undef if no distribution name is currently set.

name

$obj->name( "Folklore-Japan" );
my $string = $obj->name;

Sets or gets a string and returns a scalar object, even if there is no value.

object

Returns the object type for this class, which is distribution

river

$obj->river( {
  bucket => 2,
  bus_factor => 1,
  immediate => 15,
  total => 19,
} );
my $this = $obj->river;
$obj->river->bucket( 2 );
my $integer = $obj->river->bucket;
$obj->river->bus_factor( 1 );
my $integer = $obj->river->bus_factor;
$obj->river->immediate( 15 );
my $integer = $obj->river->immediate;
$obj->river->total( 19 );
my $integer = $obj->river->total;

Sets or gets a dynamic class object with class name Net::API::CPAN::Distribution::River and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

rt

Returns the object for the dynamic class Net::API::CPAN::Bugs::Rt, which provides access to a few methods.

See "bugs" for more information.

It returns undef if no value is set.

API SAMPLE

{
   "bugs" : {
      "github" : {
         "active" : 5,
         "closed" : 10,
         "open" : 3,
         "source" : "https://github.com/momotaro/Folkore-Japan"
      },
      "rt" : {
         "active" : "2",
         "closed" : "18",
         "new" : 0,
         "open" : 2,
         "patched" : 0,
         "rejected" : 0,
         "resolved" : 18,
         "source" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Folkore-Japan",
         "stalled" : 0
      }
   },
   "external_package" : {
      "cygwin" : "perl-Folkore-Japan",
      "debian" : "folklore-japan-perl",
      "fedora" : "perl-Folkore-Japan"
   },
   "name" : "Folklore-Japan",
   "river" : {
      "bucket" : 2,
      "bus_factor" : 1,
      "immediate" : 15,
      "total" : 19
   }
}

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Net::API::CPAN, Net::API::CPAN::Activity, 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

MetaCPAN::API, MetaCPAN::Client

https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md

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.