| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | ## Meta CPAN API - ~/lib/Net/API/CPAN/Author.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/11/24 | ||||||||||||||||||||||||||||
| 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::Author; | ||||||||||||||||||||||||||||
| 17 | BEGIN | ||||||||||||||||||||||||||||
| 18 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use parent qw( Net::API::CPAN::Generic ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 3 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 3 | our $VERSION = 'v0.1.0'; | |||||||||||||||||||||||||||
| 24 | }; | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub init | ||||||||||||||||||||||||||||
| 30 | 11 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=21 SCAR=37.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 11 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 32 | 11 | ▶ | $self->{asciiname} = undef unless( CORE::exists( $self->{asciiname} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 11 | ▶ | $self->{blog} = [] unless( CORE::exists( $self->{blog} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 11 | ▶ | $self->{city} = undef unless( CORE::exists( $self->{city} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 11 | ▶ | $self->{country} = undef unless( CORE::exists( $self->{country} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 11 | ▶ | $self->{donation} = [] unless( CORE::exists( $self->{donation} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 11 | ▶ | $self->{email} = [] unless( CORE::exists( $self->{email} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 11 | ▶ | $self->{gravatar_url} = undef unless( CORE::exists( $self->{gravatar_url} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 11 | ▶ | $self->{is_pause_custodial_account} = undef unless( CORE::exists( $self->{is_pause_custodial_account} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 11 | ▶ | $self->{links} = undef unless( CORE::exists( $self->{links} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 11 | ▶ | $self->{location} = [] unless( CORE::exists( $self->{location} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 11 | ▶ | $self->{name} = undef unless( CORE::exists( $self->{name} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 11 | $self->{object} = 'author'; | |||||||||||||||||||||||||||
| 44 | 11 | ▶ | $self->{pauseid} = undef unless( CORE::exists( $self->{pauseid} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 11 | ▶ | $self->{perlmongers} = [] unless( CORE::exists( $self->{perlmongers} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 11 | ▶ | $self->{profile} = [] unless( CORE::exists( $self->{profile} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 11 | ▶ | $self->{region} = undef unless( CORE::exists( $self->{region} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 11 | ▶ | $self->{release_count} = undef unless( CORE::exists( $self->{release_count} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 11 | ▶ | $self->{updated} = undef unless( CORE::exists( $self->{updated} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 11 | ▶ | $self->{user} = undef unless( CORE::exists( $self->{user} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 11 | ▶ | $self->{website} = [] unless( CORE::exists( $self->{website} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | $self->{_init_preprocess} = sub | ||||||||||||||||||||||||||||
| 53 | 11 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=21.7
| |||||||||||||||||||||||||||||
| 54 | 11 | my $this = shift( @_ ); | |||||||||||||||||||||||||||
| 55 | 11 | ▶ | if( $self->_is_hash( $this ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if( exists( $this->{perlmongers} ) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $this->{"perlmongers"} and ref $this->{"perlmongers"} eq "HASH"
MC/DC0%0/2
exists $this->{"perlmongers"} and ref $this->{"perlmongers"} eq "HASH"
exists $this->{"perlmongers"}
ref $this->{"perlmongers"} eq "HASH"
Truth table0%0/3
A and B
A= exists $this->{"perlmongers"}B= ref $this->{"perlmongers"} eq "HASH"
| |||||||||||||||||||||||||||||
| 58 | ref( $this->{perlmongers} ) eq 'HASH' ) | ||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||
| 60 | 0 | $this->{perlmongers} = [$this->{perlmongers}]; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | 11 | return( $this ); | |||||||||||||||||||||||||||
| 64 | 11 | }; | |||||||||||||||||||||||||||
| 65 | 11 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||
| 66 | 11 | $self->{_exception_class} = 'Net::API::CPAN::Exception'; | |||||||||||||||||||||||||||
| 67 | 11 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 11 | $self->{fields} = [qw( | |||||||||||||||||||||||||||
| 69 | asciiname blog city country donation email gravatar_url is_pause_custodial_account | ||||||||||||||||||||||||||||
| 70 | links location name pauseid perlmongers profile region release_count updated user | ||||||||||||||||||||||||||||
| 71 | website | ||||||||||||||||||||||||||||
| 72 | )]; | ||||||||||||||||||||||||||||
| 73 | 11 | return( $self ); | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 12 | ▶ | sub asciiname { return( shift->_set_get_scalar_as_object( 'asciiname', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
asciiname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 2 | ▶ | sub blog { return( shift->_set_get_class_array_object( 'blog', { feed => "scalar_as_object", url => "uri" }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
blog: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 12 | ▶ | sub city { return( shift->_set_get_scalar_as_object( 'city', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
city: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 12 | ▶ | sub country { return( shift->_set_get_scalar_as_object( 'country', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
country: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub dir { return( shift->links->cpan_directory( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
dir: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 2 | ▶ | sub donation { return( shift->_set_get_class_array_object( 'donation', { id => "scalar_as_object", name => "scalar_as_object" }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
donation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 12 | ▶ | sub email { return( shift->_set_get_object_array_object( { | ||||||||||||||||||||||||||
|
Subroutine
email: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | field => 'email', | ||||||||||||||||||||||||||||
| 90 | callback => sub | ||||||||||||||||||||||||||||
| 91 | 11 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 92 | 11 | my( $class, $args ) = @_; | |||||||||||||||||||||||||||
| 93 | 11 | return( $class->parse_bare_address( $args->[0] ) ); | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | 12 | }, 'Email::Address::XS', @_ ) ); } | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 12 | ▶ | sub gravatar_url { return( shift->_set_get_uri( 'gravatar_url', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
gravatar_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 11 | ▶ | sub is_pause_custodial_account { return( shift->_set_get_boolean( 'is_pause_custodial_account', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
is_pause_custodial_account: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 2 | ▶ | sub links { return( shift->_set_get_class( 'links', { | ||||||||||||||||||||||||||
|
Subroutine
links: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 102 | backpan_directory => "uri", | ||||||||||||||||||||||||||||
| 103 | cpan_directory => "uri", | ||||||||||||||||||||||||||||
| 104 | cpantesters_matrix => "uri", | ||||||||||||||||||||||||||||
| 105 | cpantesters_reports => "uri", | ||||||||||||||||||||||||||||
| 106 | cpants => "uri", | ||||||||||||||||||||||||||||
| 107 | metacpan_explorer => "uri", | ||||||||||||||||||||||||||||
| 108 | repology => "uri", | ||||||||||||||||||||||||||||
| 109 | }, @_ ) ); } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 2 | ▶ | sub location { return( shift->_set_get_array_as_object( 'location', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
location: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | sub metacpan_url | ||||||||||||||||||||||||||||
| 114 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
metacpan_url: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 115 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | my $pauseid = $self->pauseid || | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->pauseid || (return $self->error('No pause ID is set to return a Meta CPAN URL for this author.'))
MC/DC0%0/1
$self->pauseid || (return $self->error('No pause ID is set to return a Meta CPAN URL for this author.'))
$self->pauseid
Truth table0%0/2
A
A= $self->pauseid
| |||||||||||||||||||||||||||||
| 117 | return( $self->error( "No pause ID is set to return a Meta CPAN URL for this author." ) ); | ||||||||||||||||||||||||||||
| 118 | 0 | my $api_uri = $self->api->api_uri->clone; | |||||||||||||||||||||||||||
| 119 | 0 | $api_uri->path( "/author/$pauseid" ); | |||||||||||||||||||||||||||
| 120 | 0 | return( $api_uri ); | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 12 | ▶ | sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 15 | ▶ | sub pauseid { return( shift->_set_get_scalar_as_object( 'pauseid', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
pauseid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 2 | ▶ | sub perlmongers { return( shift->_set_get_class_array_object( 'perlmongers', { name => "scalar_as_object", url => "uri" }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
perlmongers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 12 | ▶ | sub profile { return( shift->_set_get_class_array_object( 'profile', { id => "scalar_as_object", name => "scalar_as_object" }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
profile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 2 | ▶ | sub region { return( shift->_set_get_scalar_as_object( 'region', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
region: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 2 | ▶ | sub release_count { return( shift->_set_get_class( 'release_count', { backpan_only => "integer", cpan => "integer", latest => "integer" }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
release_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | # Taken from MetaCPAN::Client::Author for compatibility | ||||||||||||||||||||||||||||
| 138 | sub releases | ||||||||||||||||||||||||||||
| 139 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
releases: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 140 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 141 | 0 | my $id = $self->pauseid; | |||||||||||||||||||||||||||
| 142 | 0 | return( $self->api->release({ | |||||||||||||||||||||||||||
| 143 | all => [ | ||||||||||||||||||||||||||||
| 144 | { author => $id }, | ||||||||||||||||||||||||||||
| 145 | { status => 'latest' }, | ||||||||||||||||||||||||||||
| 146 | ] | ||||||||||||||||||||||||||||
| 147 | }) ); | ||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 12 | ▶ | sub updated { return( shift->_set_get_datetime( 'updated', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
updated: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 2 | ▶ | sub user { return( shift->_set_get_scalar_as_object( 'user', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
user: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 2 | ▶ | sub website { return( shift->_set_get_object_array_object( 'website', 'URI', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
website: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 3 | 1; | |||||||||||||||||||||||||||
| 157 | # NOTE: POD | ||||||||||||||||||||||||||||
| 158 | __END__ | ||||||||||||||||||||||||||||