The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::CPAN::Mirror - Meta CPAN API Mirror Class

SYNOPSIS

    use Net::API::CPAN::Mirror;
    my $obj = Net::API::CPAN::Mirror->new( {
      ccode => "zz",
      city => "Everywhere",
      contact => [
        {
          contact_site => "perl.org",
          contact_user => "cpan",
        },
      ],
      continent => "Global",
      country => "Global",
      distance => undef,
      dnsrr => "N",
      freq => "instant",
      http => "http://www.cpan.org/",
      inceptdate => "2021-04-09T00:00:00",
      location => [
        0,
        0,
      ],
      name => "www.cpan.org",
      org => "Global CPAN CDN",
      src => "rsync://cpan-rsync.perl.org/CPAN/",
      tz => 0,
    } ) || die( Net::API::CPAN::Mirror->error );
    
    my $string = $obj->A_or_CNAME;
    my $string = $obj->aka_name;
    my $string = $obj->ccode;
    my $string = $obj->city;
    my $array = $obj->contact;
    foreach my $this ( @$array )
    {
        my $scalar = $this->contact_site;
        my $scalar = $this->contact_user;
    }
    my $string = $obj->continent;
    my $string = $obj->country;
    my $string = $obj->distance;
    my $string = $obj->dnsrr;
    my $string = $obj->freq;
    my $uri = $obj->ftp;
    my $uri = $obj->http;
    my $date = $obj->inceptdate;
    my $array = $obj->location;
    my $string = $obj->name;
    my $string = $obj->note;
    my $str = $obj->object;
    my $string = $obj->org;
    my $string = $obj->region;
    my $date = $obj->reitredate;
    my $uri = $obj->rsync;
    my $uri = $obj->src;
    my $string = $obj->tz;

VERSION

    v0.1.0

DESCRIPTION

This class serves to retrieve and manipulate mirrors.

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::Mirror object.

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

METHODS

A_or_CNAME

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

aka_name

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

ccode

    $obj->ccode( "zz" );
    my $string = $obj->ccode;

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

city

    $obj->city( "Everywhere" );
    my $string = $obj->city;

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

contact

    $obj->contact( [
      {
        contact_site => "perl.org",
        contact_user => "cpan",
      },
    ] );
    my $array = $obj->contact;
    foreach my $this ( @$array )
    {
        $this->contact_site( "perl.org" );
        my $scalar = $this->contact_site;
        $this->contact_user( "cpan" );
        my $scalar = $this->contact_user;
    }

Sets or gets an array of dynamic class objects with class name Net::API::CPAN::Mirror::Contact and having the folowing properties also accessible as methods, and returns an array object even if there is no value.

A Net::API::CPAN::Mirror::Contact object will be instantiated with each value from the array provided and replace said value.

  • contact_site scalar_as_object

  • contact_user scalar_as_object

continent

    $obj->continent( "Global" );
    my $string = $obj->continent;

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

country

    $obj->country( "Global" );
    my $string = $obj->country;

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

distance

    $obj->distance( undef );
    my $string = $obj->distance;

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

dnsrr

    $obj->dnsrr( "N" );
    my $string = $obj->dnsrr;

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

freq

    $obj->freq( "instant" );
    my $string = $obj->freq;

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

ftp

Sets or gets an URI, and returns an URI object or undef if no value is set.

http

    $obj->http( "http://www.cpan.org/" );
    my $uri = $obj->http;

Sets or gets an URI, and returns an URI object or undef if no value is set.

inceptdate

    $obj->inceptdate( "2021-04-09T00:00:00" );
    my $datetime_obj = $obj->inceptdate;

Sets or gets a datetime value, and returns a DateTime object that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or undef if no value is set.

location

    $obj->location( [
      0,
      0,
    ] );
    my $array = $obj->location;

Sets or gets an array of locations and returns an array object, even if there is no value.

name

    $obj->name( "www.cpan.org" );
    my $string = $obj->name;

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

note

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 mirror

org

    $obj->org( "Global CPAN CDN" );
    my $string = $obj->org;

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

region

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

reitredate

Sets or gets a datetime value, and returns a DateTime object that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or undef if no value is set.

rsync

Sets or gets an URI, and returns an URI object or undef if no value is set.

src

    $obj->src( "rsync://cpan-rsync.perl.org/CPAN/" );
    my $uri = $obj->src;

Sets or gets an URI, and returns an URI object or undef if no value is set.

tz

    $obj->tz( 0 );
    my $string = $obj->tz;

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

API SAMPLE

    {
       "ccode" : "zz",
       "city" : "Everywhere",
       "contact" : [
          {
             "contact_site" : "perl.org",
             "contact_user" : "cpan"
          }
       ],
       "continent" : "Global",
       "country" : "Global",
       "distance" : null,
       "dnsrr" : "N",
       "freq" : "instant",
       "http" : "http://www.cpan.org/",
       "inceptdate" : "2021-04-09T00:00:00",
       "location" : [
          0,
          0
       ],
       "name" : "www.cpan.org",
       "org" : "Global CPAN CDN",
       "src" : "rsync://cpan-rsync.perl.org/CPAN/",
       "tz" : "0"
    }

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.