CPAN/Distribution.pm

filter: Statementstmt 81.8% 45 / 55 Branchbran 50.0% 11 / 22 Conditioncond 13.0% 3 / 23 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 76.4% 13 / 17 Podpod 100% 9 / 9 totaltotal 59.5% 81 / 136 CC 20 SCAR 31.6
CC
20
Cov
59%
__ANON__
54.4
init
9.7
metacpan_url
6.0
CRAP 23.6
« CPAN/Release.pm ↑ Summary CPAN/Mirror.pm »
1 ##----------------------------------------------------------------------------
2 ## Meta CPAN API - ~/lib/Net/API/CPAN/Distribution.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::Distribution;
17 BEGIN
18 2 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use parent qw( Net::API::CPAN::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 our $VERSION = 'v0.1.0';
24 };
25  
26 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 sub init
30 1 ▶{
Subroutine init: called CC=6 SCAR=22.8
Pod documented
31 1 my $self = shift( @_ );
32 1 ▶ $self->{bugs} = undef unless( CORE::exists( $self->{bugs} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"bugs"} 1 0 1
33 1 ▶ $self->{external_package} = undef unless( CORE::exists( $self->{external_package} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"external_package"} 1 0 1
34 1 ▶ $self->{name} = undef unless( CORE::exists( $self->{name} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"name"} 1 0 1
35 1 $self->{object} = 'distribution';
36 1 ▶ $self->{river} = undef unless( CORE::exists( $self->{river} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"river"} 1 0 1
37 $self->{_init_preprocess} = sub
38 1 ▶ {
Subroutine __ANON__: called CC=14 SCAR=40.0
39 1 my $this = shift( @_ );
40 1 ▶ if( $self->_is_array( $this ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_array($this)) { } 1 0 1
elsif ($self->_is_hash($this)) { } 0 0 0
41 {
42 1 ▶ for( my $i = 0; $i < scalar( @$this ); $i += 2 )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @$this) 5 1 6
43 {
44 5 ▶ if( $this->[$i] eq 'bugs' )
Branch: 1 branch
BranchTrueFalseTotal
if ($this->[$i] eq "bugs") 1 4 5
45 {
46 1 my $ref = $this->[$i + 1];
47 1 ▶ if( ref( $ref ) eq 'HASH' &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ref eq "HASH" and exists $ref->{"rt"} and ref $ref->{"rt"} eq "HASH" and exists $ref->{"rt"}{"new"}) 1 0 1
Condition33%3/9
ref $ref eq "HASH" and exists $ref->{"rt"} and ref $ref->{"rt"} eq "HASH" and exists $ref->{"rt"}{"new"}
!ll&&!rl&&r
001
ref $ref eq "HASH" and exists $ref->{"rt"} and ref $ref->{"rt"} eq "HASH"
!ll&&!rl&&r
001
ref $ref eq "HASH" and exists $ref->{"rt"}
!ll&&!rl&&r
001
MC/DC0%0/4
ref $ref eq "HASH" and exists $ref->{"rt"} and ref $ref->{"rt"} eq "HASH" and exists $ref->{"rt"}{"new"}
ref $ref eq "HASH" exists $ref->{"rt"} ref $ref->{"rt"} eq "HASH" exists $ref->{"rt"}{"new"}
Truth table20%1/5
A and B and C and D
A= ref $ref eq "HASH"B= exists $ref->{"rt"}C= ref $ref->{"rt"} eq "HASH"D= exists $ref->{"rt"}{"new"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
48 exists( $ref->{rt} ) &&
49 ref( $ref->{rt} ) eq 'HASH' &&
50 exists( $ref->{rt}->{new} ) )
51 {
52 1 $ref->{rt}->{recent} = CORE::delete( $ref->{rt}->{new} );
53 1 $this->[$i + 1] = $ref;
54 }
55 }
56 }
57 }
58 elsif( $self->_is_hash( $this ) )
59 {
60 0 ▶ if( exists( $this->{bugs} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH" and exists $this->{"bugs"}{"rt"} and ref $this->{"bugs"}{"rt"} eq "HASH" and exists $this->{"bugs"}{"rt"}{"new"}) 0 0 0
Condition0%0/12
exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH" and exists $this->{"bugs"}{"rt"} and ref $this->{"bugs"}{"rt"} eq "HASH" and exists $this->{"bugs"}{"rt"}{"new"}
!ll&&!rl&&r
000
exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH" and exists $this->{"bugs"}{"rt"} and ref $this->{"bugs"}{"rt"} eq "HASH"
!ll&&!rl&&r
000
exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH" and exists $this->{"bugs"}{"rt"}
!ll&&!rl&&r
000
exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/5
exists $this->{"bugs"} and ref $this->{"bugs"} eq "HASH" and exists $this->{"bugs"}{"rt"} and ref $this->{"bugs"}{"rt"} eq "HASH" and exists $this->{"bugs"}{"rt"}{"new"}
exists $this->{"bugs"} ref $this->{"bugs"} eq "HASH" exists $this->{"bugs"}{"rt"} ref $this->{"bugs"}{"rt"} eq "HASH" exists $this->{"bugs"}{"rt"}{"new"}
Truth table0%0/6
A and B and C and D and E
A= exists $this->{"bugs"}B= ref $this->{"bugs"} eq "HASH"C= exists $this->{"bugs"}{"rt"}D= ref $this->{"bugs"}{"rt"} eq "HASH"E= exists $this->{"bugs"}{"rt"}{"new"}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
61 ref( $this->{bugs} ) eq 'HASH' &&
62 exists( $this->{bugs}->{rt} ) &&
63 ref( $this->{bugs}->{rt} ) eq 'HASH' &&
64 exists( $this->{bugs}->{rt}->{new} ) )
65 {
66 0 $this->{bugs}->{rt}->{recent} = CORE::delete( $this->{bugs}->{rt}->{new} );
67 }
68 }
69 1 return( $this );
70 1 };
71 1 $self->{_init_strict_use_sub} = 1;
72 1 $self->{_exception_class} = 'Net::API::CPAN::Exception';
73 1 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 1 0 1
74 1 $self->{fields} = [qw( bugs external_package name river )];
75 1 return( $self );
76 }
77  
78 2 ▶sub bugs { return( shift->_set_get_class( 'bugs', {
Subroutine bugs: called CC=1 SCAR=0.0
Pod documented
79 github => {
80 def => {
81 active => "integer",
82 closed => "integer",
83 open => "integer",
84 source => "uri",
85 },
86 type => "class",
87 },
88 rt => {
89 def => {
90 active => "integer",
91 closed => "integer",
92 open => "integer",
93 patched => "integer",
94 recent => "integer",
95 rejected => "integer",
96 resolved => "integer",
97 source => "uri",
98 stalled => "integer",
99 },
100 type => "class",
101 },
102 }, @_ ) ); }
103  
104 2 ▶sub external_package { return( shift->_set_get_class( 'external_package', {
Subroutine external_package: called CC=1 SCAR=0.0
Pod documented
105 cygwin => "scalar_as_object",
106 debian => "scalar_as_object",
107 fedora => "scalar_as_object",
108 }, @_ ) ); }
109  
110 0 ▶sub github { return( shift->bugs->github ); }
Subroutine github: not called CC=1 SCAR=6.9
Pod documented
111  
112 sub metacpan_url
113 0 ▶{
Subroutine metacpan_url: not called CC=2 SCAR=17.9
Pod documented
114 0 my $self = shift( @_ );
115 0 ▶ my $name = $self->name ||
Condition0%0/2
$self->name || (return $self->error('No distribution name is set to return a Meta CPAN URL for this distribution.'))
l!l
00
MC/DC0%0/1
$self->name || (return $self->error('No distribution name is set to return a Meta CPAN URL for this distribution.'))
$self->name
Truth table0%0/2
A
A= $self->name
Aresult
11
00
116 return( $self->error( "No distribution name is set to return a Meta CPAN URL for this distribution." ) );
117 0 my $api_uri = $self->api->api_uri->clone;
118 0 $api_uri->path( "/release/$name" );
119 0 return( $api_uri );
120 }
121  
122 2 ▶sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
123  
124 0 ▶sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); }
Subroutine object: not called CC=1 SCAR=6.9
Pod documented
125  
126 2 ▶sub river { return( shift->_set_get_class( 'river', {
Subroutine river: called CC=1 SCAR=0.0
Pod documented
127 bucket => "integer",
128 bus_factor => "integer",
129 immediate => "integer",
130 total => "integer",
131 }, @_ ) ); }
132  
133 0 ▶sub rt { return( shift->bugs->rt ); }
Subroutine rt: not called CC=1 SCAR=6.9
Pod documented
134  
135 2 1;
136 # NOTE: POD
137 __END__
« CPAN/Release.pm ↑ Summary CPAN/Mirror.pm »