| 1 | 63 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Pinto::Schema::Result::Distribution; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Created by DBIx::Class::Schema::Loader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # DO NOT MODIFY THE FIRST PART OF THIS FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 63 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 63 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 63 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 63 | ▶ | use MooseX::NonMoose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 63 | ▶ | use MooseX::MarkAsMethods autoclean => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 63 | extends 'DBIx::Class::Core'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 63 | __PACKAGE__->table("distribution"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 63 | __PACKAGE__->add_columns( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | "author", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | "archive", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | "source", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | "mtime", { data_type => "integer", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | "sha256", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | "md5", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | "metadata", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 63 | __PACKAGE__->set_primary_key("id"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 63 | __PACKAGE__->add_unique_constraint( "author_archive_unique", [ "author", "archive" ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 63 | __PACKAGE__->has_many( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | "packages", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | "Pinto::Schema::Result::Package", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | { "foreign.distribution" => "self.id" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | { cascade_copy => 0, cascade_delete => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 63 | __PACKAGE__->has_many( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | "prerequisites", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | "Pinto::Schema::Result::Prerequisite", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { "foreign.distribution" => "self.id" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | { cascade_copy => 0, cascade_delete => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 63 | __PACKAGE__->has_many( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | "registrations", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | "Pinto::Schema::Result::Registration", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | { "foreign.distribution" => "self.id" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | { cascade_copy => 0, cascade_delete => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 63 | with 'Pinto::Role::Schema::Result'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-26 11:05:47 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vQKIXXk8xddyMmBptwvpUg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # ABSTRACT: Represents a distribution archive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 63 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 63 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 63 | ▶ | use Path::Class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 63 | ▶ | use CPAN::DistnameInfo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 63 | ▶ | use String::Format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 63 | ▶ | use Pinto::Util qw(itis debug whine throw); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 63 | ▶ | use Pinto::Target::Distribution; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 63 | ▶ | use overload ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 63 | '""' => 'to_string', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 'cmp' => 'string_compare' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 63 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 63 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | __PACKAGE__->inflate_column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 'metadata' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | inflate => sub { CPAN::Meta->load_json_string( $_[0] ) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 59 | ▶ | deflate => sub { $_[0]->as_string( { version => "2" } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 63 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 83 | ▶ | sub FOREIGNBUILDARGS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FOREIGNBUILDARGS: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 83 | my ( $class, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 83 | ▶ | $args ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 83 | ▶ | $args->{source} ||= 'LOCAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{"source"} ||= "LOCAL"
MC/DC100%1/1
$args->{"source"} ||= "LOCAL"
$args->{"source"}
Truth table100%2/2
A
A= $args->{"source"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 83 | return $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 59 | ▶ | sub register { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=19 SCAR=50.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 59 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 59 | my $stack = $args{stack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 59 | ▶ | my $force = $args{force} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'force'} || 0
MC/DC0%0/1
$args{'force'} || 0
$args{'force'}
Truth table50%1/2
A
A= $args{'force'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 59 | ▶ | my $pin = $args{pin} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'pin'} || 0
MC/DC100%1/1
$args{'pin'} || 0
$args{'pin'}
Truth table100%2/2
A
A= $args{'pin'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 59 | my $can_intermingle = $stack->repo->config->intermingle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 59 | my $did_register = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 59 | $stack->assert_is_open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # TODO: This process makes a of trips to the database. You could | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # optimize this by fetching all the incumbents at once, checking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # for pins, and then bulk-insert the new registrations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 59 | for my $pkg ($self->packages) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 84 | ▶ | if (not $pkg->can_index) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | my $file = $pkg->file || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$pkg->file || ''
MC/DC0%0/1
$pkg->file || ''
$pkg->file
Truth table0%0/2
A
A= $pkg->file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | debug( sub {"Package $pkg in file $file is not indexable. Skipping registration"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 84 | my $where = {package_name => $pkg->name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 84 | my $incumbent = $stack->head->find_related(registrations => $where); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 84 | ▶ | if (not defined $incumbent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | debug( sub {"Registering package $pkg on stack $stack"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 84 | $pkg->register(stack => $stack, pin => $pin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 84 | $did_register++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 84 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | elsif (not $can_intermingle) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # If the repository prohibits intermingled distributions, we can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # assume all the apckages in the incumbent are already registered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $dist = $incumbent->distribution; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ($dist->id == $self->id and $incumbent->is_pinned == $pin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dist->id == $self->id and $incumbent->is_pinned == $pin
MC/DC0%0/2
$dist->id == $self->id and $incumbent->is_pinned == $pin
$dist->id == $self->id
$incumbent->is_pinned == $pin
Truth table0%0/3
A and B
A= $dist->id == $self->idB= $incumbent->is_pinned == $pin
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | debug( sub {"Distribution $dist is already fully registered"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $incumbent_pkg = $incumbent->package; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if ( $incumbent_pkg == $pkg ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | debug( sub {"Package $pkg is already on stack $stack"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | $incumbent->pin && $did_register++ if $pin and not $incumbent->is_pinned; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$pin && !$incumbent->is_pinned && ($incumbent->pin && ++$did_register)
$pin and not $incumbent->is_pinned
$incumbent->pin and ++$did_register
MC/DC0%0/4
$pin && !$incumbent->is_pinned && ($incumbent->pin && ++$did_register)
$pin
not $incumbent->is_pinned
$incumbent->pin
++$did_register
Truth table0%0/5
A and not(B) && C and D
A= $pinB= not $incumbent->is_pinnedC= $incumbent->pinD= ++$did_register
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | if ( $incumbent->is_pinned ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $pkg_name = $incumbent_pkg->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $dist = $incumbent->distribution; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $force ? whine "Forcibly changing $dist to $self" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | : throw "Unable to register distribution $self: $pkg_name is pinned to $incumbent_pkg"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | whine "Downgrading package $incumbent_pkg to $pkg on stack $stack" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | if $incumbent_pkg > $pkg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if ( $can_intermingle ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # If the repository allows intermingled distributions, then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # remove only the incumbent package from the index. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $incumbent->delete; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # Otherwise, remove all packages in the incumbent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # distribution from the index. This is the default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $incumbent->distribution->unregister(stack => $stack, force => $force); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $pkg->register(stack => $stack, pin => $pin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $did_register++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 59 | ▶ | $stack->mark_as_changed if $did_register; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 59 | return $did_register; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub unregister { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unregister: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $stack = $args{stack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $force = $args{force}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $did_unregister = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $conflicts = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $stack->assert_is_open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $stack->assert_not_locked; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $rs = $self->registrations( { revision => $stack->head->id } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | for my $reg ( $rs->all ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if ( $reg->is_pinned and not $force ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$reg->is_pinned and not $force
MC/DC0%0/2
$reg->is_pinned and not $force
$reg->is_pinned
not $force
Truth table0%0/3
A and not(B)
A= $reg->is_pinnedB= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $pkg = $reg->package; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | whine "Cannot unregister package $pkg because it is pinned to stack $stack"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $conflicts++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $did_unregister++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | throw "Unable to unregister distribution $self from stack $stack" if $conflicts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $rs->delete; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $stack->mark_as_changed if $did_unregister; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | return $did_unregister; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub pin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pin: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $stack = $args{stack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $stack->assert_not_locked; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $rev = $stack->head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $rev->assert_is_open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $where = { revision => $rev->id, is_pinned => 0 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $regs = $self->registrations($where); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | return 0 if not $regs->count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $regs->update( { is_pinned => 1 } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $stack->mark_as_changed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | sub unpin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unpin: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $stack = $args{stack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $stack->assert_not_locked; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $rev = $stack->head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $rev->assert_is_open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $where = { revision => $rev->id, is_pinned => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $regs = $self->registrations($where); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return 0 if not $regs->count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $regs->update( { is_pinned => 0 } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $stack->mark_as_changed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | has distname_info => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | isa => 'CPAN::DistnameInfo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | handles => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | name => 'dist', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | vname => 'distvname', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | version => 'version', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | maturity => 'maturity' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 13 | ▶ | default => sub { CPAN::DistnameInfo->new( $_[0]->path ) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 63 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | has is_devel => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 5 | ▶ | default => sub { $_[0]->maturity() eq 'developer' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 63 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 17 | ▶ | sub path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 17 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 17 | return join '/', ( substr( $self->author, 0, 1 ), substr( $self->author, 0, 2 ), $self->author, $self->archive ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 60 | ▶ | sub native_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
native_path: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 60 | my ( $self, @base ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 60 | ▶ | @base = ( $self->repo->config->authors_id_dir ) if not @base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 60 | return Path::Class::file( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | @base, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | substr( $self->author, 0, 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | substr( $self->author, 0, 2 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | $self->author, $self->archive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | ▶ | sub uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uri: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | my ( $self, $base ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # TODO: Is there a sensible URI for local dists? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | ▶ | return 'UNKNOWN' if $self->is_local; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | $base ||= $self->source; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$base ||= $self->source
MC/DC0%0/2
$base ||= $self->source
$base
$self->source
Truth table33%1/3
A ||= B
A= $baseB= $self->source
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | return URI->new( "$base/authors/id/" . $self->path )->canonical; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 8 | ▶ | sub is_local { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_local: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 8 | return $self->source eq 'LOCAL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
package: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $pkg_name = $args{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $where = { name => $pkg_name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $attrs = { key => 'name_distribution_unique' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | my $pkg = $self->find_related( 'packages', $where, $attrs ) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if ( my $stk_name = $args{stack} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | return $pkg->registration( stack => $stk_name ) ? $pkg : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return $pkg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | sub registered_stacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registered_stacks: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my %stacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | for my $reg ( $self->registrations ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # TODO: maybe use 'DISTICT' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $stacks{ $reg->stack } = $reg->stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | return values %stacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | sub main_module { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
main_module: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # We start by sorting packages by the length of their name. Most of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | # the time, the shorter one is more likely to be the main module name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my @pkgs = sort { length $a->name <=> length $b->name } $self->packages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # Transform the dist name into a package name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $dist_name = $self->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $dist_name =~ s/-/::/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # First, look for an indexable package that matches the dist name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | for my $pkg (@pkgs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | return $pkg if $pkg->can_index && $pkg->name eq $dist_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pkg->can_index and $pkg->name eq $dist_name
MC/DC0%0/2
$pkg->can_index and $pkg->name eq $dist_name
$pkg->can_index
$pkg->name eq $dist_name
Truth table0%0/3
A and B
A= $pkg->can_indexB= $pkg->name eq $dist_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # Then, look for any indexable package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | for my $pkg (@pkgs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | return $pkg if $pkg->can_index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # Then, just use the first package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | return $pkgs[0] if @pkgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # There are no packages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub package_count { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
package_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return scalar $self->packages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub prerequisite_specs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prerequisite_specs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return map { $_->as_target } $self->prerequisites; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | sub as_target { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_target: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | return Pinto::Target::Distribution->new( path => $self->path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub string_compare { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_compare: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my ( $dist_a, $dist_b ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | throw "Can only compare $pkg objects" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
itis($dist_a, $pkg) and itis($dist_b, $pkg)
MC/DC0%0/2
itis($dist_a, $pkg) and itis($dist_b, $pkg)
itis($dist_a, $pkg)
itis($dist_b, $pkg)
Truth table0%0/3
A and B
A= itis($dist_a, $pkg)B= itis($dist_b, $pkg)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | if not( itis( $dist_a, $pkg ) && itis( $dist_b, $pkg ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | return 0 if $dist_a->id == $dist_b->id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $r = ( $dist_a->archive cmp $dist_b->archive ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 334 | ▶ | sub to_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 334 | my ( $self, $format ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | my %fspec = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 1 | ▶ | 'd' => sub { $self->name }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 1 | ▶ | 'D' => sub { $self->vname }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ▶ | 'V' => sub { $self->version }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | ▶ | 'm' => sub { $self->is_devel ? 'd' : 'r' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | 'M' => sub { my $m = $self->main_module; $m ? $m->name : '' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | ▶ | 'h' => sub { $self->path }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | 'H' => sub { $self->native_path }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 325 | ▶ | 'f' => sub { $self->archive }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | ▶ | 's' => sub { $self->is_local ? 'l' : 'f' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 1 | ▶ | 'S' => sub { $self->source }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 326 | ▶ | 'a' => sub { $self->author }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 1 | ▶ | 'u' => sub { $self->uri }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | 'c' => sub { $self->package_count }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 334 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 334 | ▶ | $format ||= $self->default_format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$format ||= $self->default_format
MC/DC0%0/2
$format ||= $self->default_format
$format
$self->default_format
Truth table66%2/3
A ||= B
A= $formatB= $self->default_format
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 334 | return String::Format::stringf( $format, %fspec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 325 | ▶ | sub default_format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 325 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 325 | return '%a/%f', # AUTHOR/Dist-Name-1.0.tar.gz | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 63 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 63 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||