| 1 | 63 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Pinto::Schema::Result::Stack; | ||||||||||||||||||||||||||||
| 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("stack"); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 63 | __PACKAGE__->add_columns( | |||||||||||||||||||||||||||
| 22 | "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 23 | "name", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 24 | "is_default", { data_type => "boolean", is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 25 | "is_locked", { data_type => "boolean", is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 26 | "properties", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 27 | "head", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 63 | __PACKAGE__->set_primary_key("id"); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 63 | __PACKAGE__->add_unique_constraint( "name_unique", ["name"] ); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 63 | __PACKAGE__->belongs_to( | |||||||||||||||||||||||||||
| 38 | "head", | ||||||||||||||||||||||||||||
| 39 | "Pinto::Schema::Result::Revision", | ||||||||||||||||||||||||||||
| 40 | { id => "head" }, | ||||||||||||||||||||||||||||
| 41 | { is_deferrable => 0, on_delete => "RESTRICT", on_update => "NO ACTION" }, | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 63 | with 'Pinto::Role::Schema::Result'; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-04 12:39:54 | ||||||||||||||||||||||||||||
| 48 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+O/IwTdVRx98MHUkJ281lg | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | # ABSTRACT: Represents a named set of Packages | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 63 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 63 | ▶ | use MooseX::Types::Moose qw(Bool Str Undef); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 63 | ▶ | use String::Format; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 63 | 63 | ▶ | use File::Copy (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 64 | 63 | ▶ | use JSON qw(encode_json decode_json); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 63 | ▶ | use Pinto::Util qw(:all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 67 | 63 | ▶ | use Pinto::Types qw(Dir File Version); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 63 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | 63 | ▶ | use overload ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 71 | 63 | '""' => 'to_string', | |||||||||||||||||||||||||||
| 72 | '<=>' => 'numeric_compare', | ||||||||||||||||||||||||||||
| 73 | 'cmp' => 'string_compare' | ||||||||||||||||||||||||||||
| 74 | 63 | ); | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | __PACKAGE__->inflate_column( | ||||||||||||||||||||||||||||
| 79 | 'properties' => { | ||||||||||||||||||||||||||||
| 80 | 100 | ▶ | inflate => sub { decode_json( $_[0] || '{}' ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$_[0] || '{}'
MC/DC0%0/1
$_[0] || '{}'
$_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||||||||||||||||||
| 81 | 95 | ▶ | deflate => sub { encode_json( $_[0] || {} ) } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$_[0] || {}
MC/DC0%0/1
$_[0] || {}
$_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 63 | ); | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | has stack_dir => ( | ||||||||||||||||||||||||||||
| 88 | is => 'ro', | ||||||||||||||||||||||||||||
| 89 | isa => Dir, | ||||||||||||||||||||||||||||
| 90 | lazy => 1, | ||||||||||||||||||||||||||||
| 91 | 112 | ▶ | default => sub { $_[0]->repo->config->stacks_dir->subdir( $_[0]->name ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 92 | 63 | ); | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | has modules_dir => ( | ||||||||||||||||||||||||||||
| 95 | is => 'ro', | ||||||||||||||||||||||||||||
| 96 | isa => Dir, | ||||||||||||||||||||||||||||
| 97 | lazy => 1, | ||||||||||||||||||||||||||||
| 98 | 107 | ▶ | default => sub { $_[0]->stack_dir->subdir('modules') }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 99 | 63 | ); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | has authors_dir => ( | ||||||||||||||||||||||||||||
| 102 | is => 'ro', | ||||||||||||||||||||||||||||
| 103 | isa => Dir, | ||||||||||||||||||||||||||||
| 104 | lazy => 1, | ||||||||||||||||||||||||||||
| 105 | 91 | ▶ | default => sub { $_[0]->stack_dir->subdir('authors') }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 63 | ); | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | has description => ( | ||||||||||||||||||||||||||||
| 109 | is => 'ro', | ||||||||||||||||||||||||||||
| 110 | isa => Str | Undef, | ||||||||||||||||||||||||||||
| 111 | lazy => 1, | ||||||||||||||||||||||||||||
| 112 | 2 | ▶ | default => sub { $_[0]->get_property('description') }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 113 | 63 | init_arg => undef, | |||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | has target_perl_version => ( | ||||||||||||||||||||||||||||
| 117 | is => 'ro', | ||||||||||||||||||||||||||||
| 118 | isa => Version, | ||||||||||||||||||||||||||||
| 119 | lazy => 1, | ||||||||||||||||||||||||||||
| 120 | 98 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 121 | 98 | ▶ | $_[0]->get_property('target_perl_version') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | or $_[0]->repo->config->target_perl_version; | ||||||||||||||||||||||||||||
| 123 | }, | ||||||||||||||||||||||||||||
| 124 | 63 | init_arg => undef, | |||||||||||||||||||||||||||
| 125 | coerce => 1, | ||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 85 | ▶ | sub FOREIGNBUILDARGS { | ||||||||||||||||||||||||||
|
Subroutine
FOREIGNBUILDARGS: called CC=5 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 131 | 85 | my ( $class, $args ) = @_; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 85 | ▶ | $args ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||
| 134 | 85 | ▶ | $args->{is_default} ||= 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"is_default"} ||= 0
MC/DC0%0/1
$args->{"is_default"} ||= 0
$args->{"is_default"}
Truth table50%1/2
A
A= $args->{"is_default"}
| |||||||||||||||||||||||||||||
| 135 | 85 | ▶ | $args->{is_locked} ||= 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"is_locked"} ||= 0
MC/DC0%0/1
$args->{"is_locked"} ||= 0
$args->{"is_locked"}
Truth table50%1/2
A
A= $args->{"is_locked"}
| |||||||||||||||||||||||||||||
| 136 | 85 | ▶ | $args->{properties} ||= '{}'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"properties"} ||= "{}"
MC/DC0%0/1
$args->{"properties"} ||= "{}"
$args->{"properties"}
Truth table50%1/2
A
A= $args->{"properties"}
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 85 | return $args; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 95 | ▶ | before is_default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 144 | 95 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 145 | 95 | ▶ | throw "Cannot directly set is_default. Use mark_as_default instead" if @args; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 63 | }; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 149 | # TODO: All methods below that operate on the head should be moved into the | ||||||||||||||||||||||||||||
| 150 | # Revision class, since that is where the data actually is. For convenience, | ||||||||||||||||||||||||||||
| 151 | # the Stack class can have the same methods, but they should just delegate to | ||||||||||||||||||||||||||||
| 152 | # the Revision class. | ||||||||||||||||||||||||||||
| 153 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 9 | ▶ | sub get_distribution { | ||||||||||||||||||||||||||
|
Subroutine
get_distribution: called CC=10 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 157 | 9 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 9 | my $cache = $args{cache}; | |||||||||||||||||||||||||||
| 160 | 9 | ▶ | my $target = $args{target} or throw 'Invalid arguments'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 9 | ▶ | return $cache->{$target} if $cache && exists $cache->{$target}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cache and exists $cache->{$target}
MC/DC0%0/2
$cache and exists $cache->{$target}
$cache
exists $cache->{$target}
Truth table33%1/3
A and B
A= $cacheB= exists $cache->{$target}
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 9 | my $dist; | |||||||||||||||||||||||||||
| 164 | 9 | ▶ | if ( itis( $target, 'Pinto::Target::Distribution' ) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | my $attrs = { prefetch => 'distribution'}; | |||||||||||||||||||||||||||
| 167 | 0 | my $where = {'distribution.author' => $target->author, 'distribution.archive' => $target->archive}; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 0 | ▶ | return unless my $reg = $self->head->search_related( registrations => $where, $attrs )->first; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 0 | $dist = $reg->distribution; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | elsif ( itis( $target, 'Pinto::Target::Package' ) ) { | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 9 | my $attrs = { prefetch => 'distribution' }; | |||||||||||||||||||||||||||
| 175 | 9 | my $where = { package_name => $target->name }; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 9 | ▶ | return unless my $reg = $self->head->find_related( registrations => $where, $attrs ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | return unless $target->is_satisfied_by($reg->package->version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | $dist = $reg->distribution; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | $cache->{$target} = $dist if $cache; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | return $dist; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 91 | ▶ | sub make_filesystem { | ||||||||||||||||||||||||||
|
Subroutine
make_filesystem: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 189 | 91 | my ($self) = @_; | |||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 91 | my $stack_dir = $self->stack_dir; | |||||||||||||||||||||||||||
| 192 | 91 | debug "Making stack directory at $stack_dir"; | |||||||||||||||||||||||||||
| 193 | 91 | $stack_dir->mkpath; | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 91 | my $stack_modules_dir = $self->modules_dir; | |||||||||||||||||||||||||||
| 196 | 91 | debug "Making modules directory at $stack_modules_dir"; | |||||||||||||||||||||||||||
| 197 | 91 | $stack_modules_dir->mkpath; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 91 | my $stack_authors_dir = $self->authors_dir; | |||||||||||||||||||||||||||
| 200 | 91 | my $shared_authors_dir = $self->repo->config->authors_dir->relative($stack_dir); | |||||||||||||||||||||||||||
| 201 | 91 | mksymlink( $stack_authors_dir => $shared_authors_dir ); | |||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 91 | $self->write_modlist; | |||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 91 | return $self; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 3 | ▶ | sub rename_filesystem { | ||||||||||||||||||||||||||
|
Subroutine
rename_filesystem: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 211 | 3 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 3 | my $new_name = $args{to}; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 3 | $self->assert_not_locked; | |||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 3 | my $orig_dir = $self->stack_dir; | |||||||||||||||||||||||||||
| 218 | 3 | ▶ | throw "Directory $orig_dir does not exist" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | if not -e $orig_dir; | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 3 | my $new_dir = $self->repo->config->stacks_dir->subdir($new_name); | |||||||||||||||||||||||||||
| 222 | 3 | ▶ | throw "Directory $new_dir already exists" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-e $new_dir and lc $new_dir ne lc $orig_dir
MC/DC50%1/2
-e $new_dir and lc $new_dir ne lc $orig_dir
-e $new_dir
lc $new_dir ne lc $orig_dir
Truth table66%2/3
A and B
A= -e $new_dirB= lc $new_dir ne lc $orig_dir
| |||||||||||||||||||||||||||||
| 223 | if -e $new_dir && (lc $new_dir ne lc $orig_dir); | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 2 | debug "Renaming directory $orig_dir to $new_dir"; | |||||||||||||||||||||||||||
| 226 | 2 | ▶ | File::Copy::move( $orig_dir, $new_dir ) or throw "Rename failed: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 2 | return $self; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 2 | ▶ | sub kill_filesystem { | ||||||||||||||||||||||||||
|
Subroutine
kill_filesystem: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 234 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 2 | $self->assert_not_locked; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 2 | my $stack_dir = $self->stack_dir; | |||||||||||||||||||||||||||
| 239 | 2 | ▶ | $stack_dir->rmtree or throw "Failed to remove $stack_dir: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 2 | return $self; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 6 | ▶ | sub duplicate { | ||||||||||||||||||||||||||
|
Subroutine
duplicate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 247 | 6 | my ( $self, %changes ) = @_; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 6 | $changes{is_default} = 0; # Never duplicate the default flag | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 6 | return $self->copy( \%changes ); | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 66 | ▶ | sub duplicate_registrations { | ||||||||||||||||||||||||||
|
Subroutine
duplicate_registrations: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 257 | 66 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 66 | my $new_rev = $args{to}; | |||||||||||||||||||||||||||
| 260 | 66 | ▶ | my $old_rev = $args{from} || $self->head; | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{'from'} || $self->head
MC/DC0%0/2
$args{'from'} || $self->head
$args{'from'}
$self->head
Truth table33%1/3
A || B
A= $args{'from'}B= $self->head
| |||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 66 | my $new_rev_id = $new_rev->id; | |||||||||||||||||||||||||||
| 263 | 66 | my $old_rev_id = $old_rev->id; | |||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 66 | debug "Copying registrations for stack $self to $new_rev"; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | # This raw SQL is an optimization. I was using DBIC's HashReinflator | ||||||||||||||||||||||||||||
| 268 | # to fetch all the registrations, change the revision, and then reinsert | ||||||||||||||||||||||||||||
| 269 | # them as new records using populate(). But that was too slow if there | ||||||||||||||||||||||||||||
| 270 | # are lots of registrations. | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 66 | my $sql = qq{ | |||||||||||||||||||||||||||
| 273 | INSERT INTO registration(revision, package, package_name, distribution, is_pinned) | ||||||||||||||||||||||||||||
| 274 | SELECT '$new_rev_id', package, package_name, distribution, is_pinned | ||||||||||||||||||||||||||||
| 275 | FROM registration WHERE revision = '$old_rev_id'; | ||||||||||||||||||||||||||||
| 276 | }; | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 66 | $self->result_source->storage->dbh->do($sql); | |||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 66 | return $self; | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 2 | ▶ | sub rename { | ||||||||||||||||||||||||||
|
Subroutine
rename: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 286 | 2 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 2 | my $new_name = $args{to}; | |||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 2 | $self->assert_not_locked; | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 2 | $self->update( { name => $new_name } ); | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 2 | $self->refresh; # Causes moose attributes to be reinitialized | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 2 | ▶ | $self->repo->link_modules_dir( to => $self->modules_dir ) if $self->is_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 2 | return $self; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 4 | ▶ | sub kill { | ||||||||||||||||||||||||||
|
Subroutine
kill: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 304 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 4 | $self->assert_not_locked; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 3 | ▶ | throw "Cannot kill the default stack" if $self->is_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 2 | $self->delete; | |||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 2 | return $self; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 4 | ▶ | sub lock { | ||||||||||||||||||||||||||
|
Subroutine
lock: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 318 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 4 | ▶ | return $self if $self->is_locked; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 4 | debug "Locking stack $self"; | |||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 4 | $self->update( { is_locked => 1 } ); | |||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 4 | return $self; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 1 | ▶ | sub unlock { | ||||||||||||||||||||||||||
|
Subroutine
unlock: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 332 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 1 | ▶ | return $self if not $self->is_locked; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 1 | debug "Unlocking stack $self"; | |||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | 1 | $self->update( { is_locked => 0 } ); | |||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | 1 | return $self; | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 66 | ▶ | sub set_head { | ||||||||||||||||||||||||||
|
Subroutine
set_head: called CC=1 SCAR=0.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 346 | 66 | my ( $self, $revision ) = @_; | |||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 0 | ▶ | debug sub {"Setting head of stack $self to revision $revision"}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 66 | $self->update( { head => $revision } ); | |||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 66 | return $self; | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | 66 | ▶ | sub start_revision { | ||||||||||||||||||||||||||
|
Subroutine
start_revision: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 358 | 66 | my ($self) = @_; | |||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 66 | debug "Starting revision on stack $self"; | |||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 66 | $self->assert_is_committed; | |||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | 66 | my $old_head = $self->head; | |||||||||||||||||||||||||||
| 365 | 66 | my $new_head = $self->result_source->schema->create_revision( {} ); | |||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | 66 | $self->duplicate_registrations( to => $new_head ); | |||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | 66 | $new_head->add_parent($old_head); | |||||||||||||||||||||||||||
| 370 | 66 | $self->set_head($new_head); | |||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | 66 | $self->assert_is_open; | |||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 66 | return $self; | |||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | 58 | ▶ | sub commit_revision { | ||||||||||||||||||||||||||
|
Subroutine
commit_revision: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 380 | 58 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | throw "Must specify a message to commit" | ||||||||||||||||||||||||||||
| 383 | 58 | ▶ | if not( $args{message} or $self->head->message ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"message"} or $self->head->message
MC/DC0%0/2
$args{"message"} or $self->head->message
$args{"message"}
$self->head->message
Truth table33%1/3
A or B
A= $args{"message"}B= $self->head->message
| |||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | 58 | $self->assert_is_open; | |||||||||||||||||||||||||||
| 386 | 58 | $self->assert_has_changed; | |||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | 58 | $self->head->commit(%args); | |||||||||||||||||||||||||||
| 389 | 2 | $self->write_index; | |||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 2 | $self->assert_is_committed; | |||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 2 | return $self; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | ▶ | sub should_keep_history { | ||||||||||||||||||||||||||
|
Subroutine
should_keep_history: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 399 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | # Is this revision referenced by other stacks? | ||||||||||||||||||||||||||||
| 402 | 0 | ▶ | return 1 if $self->head->stacks->count > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | # Then do not keep history | ||||||||||||||||||||||||||||
| 405 | 0 | return 0; | |||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 0 | ▶ | sub package_count { | ||||||||||||||||||||||||||
|
Subroutine
package_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 411 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 0 | return $self->head->registrations->count; | |||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub distribution_count { | ||||||||||||||||||||||||||
|
Subroutine
distribution_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 419 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | 0 | my $attrs = { select => 'distribution', distinct => 1 }; | |||||||||||||||||||||||||||
| 422 | 0 | return $self->head->registrations( {}, $attrs )->count; | |||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | 183 | ▶ | sub assert_is_open { | ||||||||||||||||||||||||||
|
Subroutine
assert_is_open: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 428 | 183 | my ($self) = @_; | |||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | 183 | return $self->head->assert_is_open; | |||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | 68 | ▶ | sub assert_is_committed { | ||||||||||||||||||||||||||
|
Subroutine
assert_is_committed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 436 | 68 | my ($self) = @_; | |||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | 68 | return $self->head->assert_is_committed; | |||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 58 | ▶ | sub assert_has_changed { | ||||||||||||||||||||||||||
|
Subroutine
assert_has_changed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 444 | 58 | my ($self) = @_; | |||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 58 | return $self->head->assert_has_changed; | |||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 80 | ▶ | sub assert_not_locked { | ||||||||||||||||||||||||||
|
Subroutine
assert_not_locked: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 452 | 80 | my ($self) = @_; | |||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | 80 | ▶ | throw "Stack $self is locked and cannot be modified or deleted" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 455 | if $self->is_locked; | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 78 | return $self; | |||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 5 | ▶ | sub set_description { | ||||||||||||||||||||||||||
|
Subroutine
set_description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 463 | 5 | my ( $self, $description ) = @_; | |||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 5 | $self->set_property( description => $description ); | |||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | 5 | return $self; | |||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | 1 | ▶ | sub diff { | ||||||||||||||||||||||||||
|
Subroutine
diff: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 473 | 1 | my ( $self, $other ) = @_; | |||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | 1 | ▶ | my $left = $other || ( $self->head->parents )[0]; | ||||||||||||||||||||||||||
|
Condition33%1/3
$other || ($self->head->parents)[0]
MC/DC0%0/2
$other || ($self->head->parents)[0]
$other
($self->head->parents)[0]
Truth table33%1/3
A || B
A= $otherB= ($self->head->parents)[0]
| |||||||||||||||||||||||||||||
| 476 | 1 | my $right = $self; | |||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | 1 | require Pinto::Difference; | |||||||||||||||||||||||||||
| 479 | 1 | return Pinto::Difference->new( left => $left, right => $right ); | |||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub distributions { | ||||||||||||||||||||||||||
|
Subroutine
distributions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 485 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | 0 | return $self->head->distributions; | |||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||
| 492 | 0 | ▶ | sub packages { | ||||||||||||||||||||||||||
|
Subroutine
packages: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 493 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 0 | return $self->head->packages; | |||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 0 | ▶ | sub roots { | ||||||||||||||||||||||||||
|
Subroutine
roots: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 501 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | 0 | my @dists = $self->distributions->all; | |||||||||||||||||||||||||||
| 504 | 0 | my $tpv = $self->target_perl_version; | |||||||||||||||||||||||||||
| 505 | 0 | my %is_prereq_dist; | |||||||||||||||||||||||||||
| 506 | my %cache; | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | # Algorithm: Visit each distribution and resolve each of its | ||||||||||||||||||||||||||||
| 509 | # dependencies to the prerequisite distribution (if it exists). | ||||||||||||||||||||||||||||
| 510 | # Any distribution that is a prerequisite cannot be a root. | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 0 | for my $dist ( @dists ) { | |||||||||||||||||||||||||||
| 513 | 0 | for my $prereq ($dist->prerequisites) { | |||||||||||||||||||||||||||
| 514 | # TODO: When we support suggested/recommended prereqs | ||||||||||||||||||||||||||||
| 515 | # those will have to be skipped too. See here for more | ||||||||||||||||||||||||||||
| 516 | # discussion: https://github.com/thaljef/Pinto/issues/158 | ||||||||||||||||||||||||||||
| 517 | 0 | ▶ | next if $prereq->is_test or $prereq->is_develop; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$prereq->is_test or $prereq->is_develop
MC/DC0%0/2
$prereq->is_test or $prereq->is_develop
$prereq->is_test
$prereq->is_develop
Truth table0%0/3
A or B
A= $prereq->is_testB= $prereq->is_develop
| |||||||||||||||||||||||||||||
| 518 | 0 | ▶ | next if $prereq->is_core(in => $tpv) or $prereq->is_perl; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$prereq->is_core("in", $tpv) or $prereq->is_perl
MC/DC0%0/2
$prereq->is_core("in", $tpv) or $prereq->is_perl
$prereq->is_core("in", $tpv)
$prereq->is_perl
Truth table0%0/3
A or B
A= $prereq->is_core("in", $tpv)B= $prereq->is_perl
| |||||||||||||||||||||||||||||
| 519 | 0 | my %args = (target => $prereq->as_target, cache => \%cache); | |||||||||||||||||||||||||||
| 520 | 0 | ▶ | next unless my $prereq_dist = $self->get_distribution(%args); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 521 | 0 | $is_prereq_dist{$prereq_dist} = 1; | |||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | 0 | return grep { not $is_prereq_dist{$_} } @dists; | |||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | 71 | ▶ | sub mark_as_default { | ||||||||||||||||||||||||||
|
Subroutine
mark_as_default: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 531 | 71 | my ($self) = @_; | |||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 71 | ▶ | return $self if $self->is_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | 71 | debug 'Marking all stacks as non-default'; | |||||||||||||||||||||||||||
| 536 | 71 | my $rs = $self->result_source->resultset->search; | |||||||||||||||||||||||||||
| 537 | 71 | $rs->update_all( { is_default => 0 } ); | |||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | 71 | debug "Marking stack $self as default"; | |||||||||||||||||||||||||||
| 540 | 71 | $self->update( { is_default => 1 } ); | |||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | 71 | $self->repo->link_modules_dir( to => $self->modules_dir ); | |||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | 71 | return 1; | |||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||
| 547 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||
| 549 | 2 | ▶ | sub unmark_as_default { | ||||||||||||||||||||||||||
|
Subroutine
unmark_as_default: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 550 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | 2 | ▶ | return $self if not $self->is_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | 2 | debug "Unmarking stack $self as default"; | |||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | 2 | $self->update( { is_default => 0 } ); | |||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | 2 | $self->repo->unlink_modules_dir; | |||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | 2 | return 1; | |||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | 59 | ▶ | sub mark_as_changed { | ||||||||||||||||||||||||||
|
Subroutine
mark_as_changed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 566 | 59 | my ($self) = @_; | |||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | 59 | debug "Marking stack $self as changed"; | |||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | 59 | $self->head->update( { has_changes => 1 } ); | |||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | 59 | return $self; | |||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | 59 | ▶ | sub has_changed { | ||||||||||||||||||||||||||
|
Subroutine
has_changed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 578 | 59 | my ($self) = @_; | |||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | 59 | return $self->head->refresh->has_changes; | |||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | 58 | ▶ | sub has_not_changed { | ||||||||||||||||||||||||||
|
Subroutine
has_not_changed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 586 | 58 | my ($self) = @_; | |||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | 58 | return !$self->has_changed; | |||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | 93 | ▶ | sub write_index { | ||||||||||||||||||||||||||
|
Subroutine
write_index: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 594 | 93 | my ($self) = @_; | |||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | 93 | require Pinto::IndexWriter; | |||||||||||||||||||||||||||
| 597 | 93 | my $writer = Pinto::IndexWriter->new( stack => $self ); | |||||||||||||||||||||||||||
| 598 | 93 | $writer->write_index; | |||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | 93 | return $self; | |||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | 91 | ▶ | sub write_modlist { | ||||||||||||||||||||||||||
|
Subroutine
write_modlist: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 606 | 91 | my ($self) = @_; | |||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | 91 | require Pinto::ModlistWriter; | |||||||||||||||||||||||||||
| 609 | 91 | my $writer = Pinto::ModlistWriter->new( stack => $self ); | |||||||||||||||||||||||||||
| 610 | 91 | $writer->write_modlist; | |||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | 91 | return $self; | |||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||
| 617 | 101 | ▶ | sub get_property { | ||||||||||||||||||||||||||
|
Subroutine
get_property: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 618 | 101 | my ( $self, @prop_keys ) = @_; | |||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | 101 | my %props = %{ $self->get_properties }; | |||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | 101 | return @props{ map {lc} @prop_keys }; | |||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | 108 | ▶ | sub get_properties { | ||||||||||||||||||||||||||
|
Subroutine
get_properties: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 628 | 108 | my ($self) = @_; | |||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | 108 | my %props = %{ $self->properties }; # Making a copy! | |||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | 108 | return \%props; | |||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | 9 | ▶ | sub set_property { | ||||||||||||||||||||||||||
|
Subroutine
set_property: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 638 | 9 | my ( $self, $key, $value ) = @_; | |||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | 9 | $self->set_properties( { $key => "$value" } ); | |||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||
| 642 | 8 | return $self; | |||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||
| 647 | 94 | ▶ | sub set_properties { | ||||||||||||||||||||||||||
|
Subroutine
set_properties: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 648 | 94 | my ( $self, $new_props ) = @_; | |||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||
| 650 | 94 | my $props = $self->properties; | |||||||||||||||||||||||||||
| 651 | 94 | ▶ | while ( my ( $key, $value ) = each %{$new_props} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 652 | 179 | Pinto::Util::validate_property_name($key); | |||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||
| 654 | 178 | ▶ | if ( defined $value && length "$value" ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and length "$value"
MC/DC50%1/2
defined $value and length "$value"
defined $value
length "$value"
Truth table66%2/3
A and B
A= defined $valueB= length "$value"
| |||||||||||||||||||||||||||||
| 655 | 177 | $props->{ lc $key } = "$value"; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | else { | ||||||||||||||||||||||||||||
| 658 | 1 | delete $props->{ lc $key }; | |||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | 93 | $self->update( { properties => $props } ); | |||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | 93 | return $self; | |||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||
| 667 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||
| 669 | 2 | ▶ | sub delete_property { | ||||||||||||||||||||||||||
|
Subroutine
delete_property: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 670 | 2 | my ( $self, @prop_keys ) = @_; | |||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||
| 672 | 2 | my $props = $self->properties; | |||||||||||||||||||||||||||
| 673 | 2 | delete $props->{ lc $_ } for @prop_keys; | |||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||
| 675 | 2 | $self->update( { properties => $props } ); | |||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | 2 | return $self; | |||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||
| 680 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||
| 682 | 0 | ▶ | sub delete_properties { | ||||||||||||||||||||||||||
|
Subroutine
delete_properties: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 683 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||
| 685 | 0 | self->update( { properties => {} } ); | |||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | 0 | return $self; | |||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||
| 692 | 84 | ▶ | sub default_properties { | ||||||||||||||||||||||||||
|
Subroutine
default_properties: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 693 | 84 | my ($self) = @_; | |||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||
| 695 | 84 | my $desc = sprintf( 'The %s stack', $self->name ); | |||||||||||||||||||||||||||
| 696 | 84 | my $tpv = $self->repo->config->target_perl_version->stringify; | |||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | return { | ||||||||||||||||||||||||||||
| 699 | 84 | description => $desc, | |||||||||||||||||||||||||||
| 700 | target_perl_version => $tpv | ||||||||||||||||||||||||||||
| 701 | }; | ||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | 0 | ▶ | sub numeric_compare { | ||||||||||||||||||||||||||
|
Subroutine
numeric_compare: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 707 | 0 | my ( $stack_a, $stack_b ) = @_; | |||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||
| 709 | 0 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||
| 710 | 0 | ▶ | throw "Can only compare $pkg objects" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
itis($stack_a, $pkg) and itis($stack_b, $pkg)
MC/DC0%0/2
itis($stack_a, $pkg) and itis($stack_b, $pkg)
itis($stack_a, $pkg)
itis($stack_b, $pkg)
Truth table0%0/3
A and B
A= itis($stack_a, $pkg)B= itis($stack_b, $pkg)
| |||||||||||||||||||||||||||||
| 711 | if not( itis( $stack_a, $pkg ) && itis( $stack_b, $pkg ) ); | ||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||
| 713 | 0 | ▶ | return 0 if $stack_a->id == $stack_b->id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||
| 715 | 0 | my $r = ( $stack_a->head <=> $stack_b->head ); | |||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||
| 717 | 0 | return $r; | |||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||
| 722 | 0 | ▶ | sub string_compare { | ||||||||||||||||||||||||||
|
Subroutine
string_compare: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 723 | 0 | my ( $stack_a, $stack_b ) = @_; | |||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||
| 725 | 0 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||
| 726 | 0 | ▶ | throw "Can only compare $pkg objects" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
itis($stack_a, $pkg) and itis($stack_b, $pkg)
MC/DC0%0/2
itis($stack_a, $pkg) and itis($stack_b, $pkg)
itis($stack_a, $pkg)
itis($stack_b, $pkg)
Truth table0%0/3
A and B
A= itis($stack_a, $pkg)B= itis($stack_b, $pkg)
| |||||||||||||||||||||||||||||
| 727 | if not( itis( $stack_a, $pkg ) && itis( $stack_b, $pkg ) ); | ||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||
| 729 | 0 | ▶ | return 0 if $stack_a->id == $stack_b->id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | 0 | my $r = ( $stack_a->name cmp $stack_b->name ); | |||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||
| 733 | 0 | return $r; | |||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||
| 738 | 889 | ▶ | sub to_string { | ||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=13.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 739 | 889 | my ( $self, $format ) = @_; | |||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||
| 741 | my %fspec = ( | ||||||||||||||||||||||||||||
| 742 | 889 | ▶ | k => sub { $self->name }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 743 | 0 | ▶ | M => sub { $self->is_default ? '*' : ' ' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 744 | 0 | ▶ | L => sub { $self->is_locked ? '!' : ' ' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 745 | 0 | ▶ | I => sub { $self->head->uuid }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 746 | 0 | ▶ | i => sub { $self->head->uuid_prefix }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 747 | 0 | ▶ | g => sub { $self->head->message }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 748 | 0 | ▶ | G => sub { indent_text( trim_text( $self->head->message ), $_[0] ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 749 | 0 | ▶ | t => sub { $self->head->message_title }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 750 | 0 | ▶ | T => sub { truncate_text( $self->head->message_title, $_[0] ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 751 | 0 | ▶ | b => sub { $self->head->message_body }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 752 | 0 | ▶ | j => sub { $self->head->username }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 753 | 0 | ▶ | u => sub { $self->head->datetime_local->strftime( $_[0] || '%c' ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/2
$_[0] || '%c'
MC/DC0%0/1
$_[0] || '%c'
$_[0]
Truth table0%0/2
A
A= $_[0]
| |||||||||||||||||||||||||||||
| 754 | 889 | ); | |||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | 889 | ▶ | $format ||= $self->default_format(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$format ||= $self->default_format
MC/DC0%0/2
$format ||= $self->default_format
$format
$self->default_format
Truth table33%1/3
A ||= B
A= $formatB= $self->default_format
| |||||||||||||||||||||||||||||
| 757 | 889 | return String::Format::stringf( $format, %fspec ); | |||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||
| 760 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||
| 762 | 889 | ▶ | sub default_format { | ||||||||||||||||||||||||||
|
Subroutine
default_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 763 | 889 | my ($self) = @_; | |||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||
| 765 | 889 | return '%k'; | |||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||
| 768 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||
| 770 | 63 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||
| 772 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 773 | 63 | 1; | |||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||
| 775 | __END__ | ||||||||||||||||||||||||||||