| 1 | 63 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Pinto::Schema::Result::Package; | ||||||||||||||||||||||||||||
| 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("package"); | |||||||||||||||||||||||||||
| 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 | "version", { data_type => "text", is_nullable => 0 }, | ||||||||||||||||||||||||||||
| 25 | "file", { data_type => "text", default_value => \"null", is_nullable => 1 }, | ||||||||||||||||||||||||||||
| 26 | "sha256", { data_type => "text", default_value => \"null", is_nullable => 1 }, | ||||||||||||||||||||||||||||
| 27 | "distribution", { 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_distribution_unique", [ "name", "distribution" ] ); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 63 | __PACKAGE__->belongs_to( | |||||||||||||||||||||||||||
| 38 | "distribution", | ||||||||||||||||||||||||||||
| 39 | "Pinto::Schema::Result::Distribution", | ||||||||||||||||||||||||||||
| 40 | { id => "distribution" }, | ||||||||||||||||||||||||||||
| 41 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 63 | __PACKAGE__->has_many( | |||||||||||||||||||||||||||
| 46 | "registrations", "Pinto::Schema::Result::Registration", | ||||||||||||||||||||||||||||
| 47 | { "foreign.package" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, | ||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 63 | with 'Pinto::Role::Schema::Result'; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-04 12:39:54 | ||||||||||||||||||||||||||||
| 54 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wYrDViIlHDocM5byRBn1Qg | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # ABSTRACT: Represents a Package provided by a Distribution | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 63 | ▶ | use String::Format; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 63 | ▶ | use MooseX::Types::Moose qw(Bool); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 63 | ▶ | use Pinto::Target::Package; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 67 | 63 | ▶ | use Pinto::Util qw(itis throw); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 63 | ▶ | use overload ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | 63 | '""' => 'to_string', | |||||||||||||||||||||||||||
| 71 | '<=>' => 'numeric_compare', | ||||||||||||||||||||||||||||
| 72 | 'cmp' => 'string_compare', | ||||||||||||||||||||||||||||
| 73 | fallback => undef | ||||||||||||||||||||||||||||
| 74 | 63 | ); | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 63 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | __PACKAGE__->inflate_column( | ||||||||||||||||||||||||||||
| 83 | 'version' => { | ||||||||||||||||||||||||||||
| 84 | 22 | ▶ | inflate => sub { version->parse( $_[0] ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 85 | 85 | ▶ | deflate => sub { $_[0]->stringify() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | 63 | ); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 90 | # Schema::Loader does not create many-to-many relationships for us. So we | ||||||||||||||||||||||||||||
| 91 | # must create them by hand here... | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 63 | __PACKAGE__->many_to_many( revisions => 'registration', 'revision' ); | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | has is_main_module => ( | ||||||||||||||||||||||||||||
| 98 | is => 'ro', | ||||||||||||||||||||||||||||
| 99 | isa => Bool, | ||||||||||||||||||||||||||||
| 100 | init_arg => undef, | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | default => sub { $_[0]->distribution->main_module->id eq $_[0]->id }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 102 | 63 | lazy => 1, | |||||||||||||||||||||||||||
| 103 | ); | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 106 | ▶ | sub FOREIGNBUILDARGS { | ||||||||||||||||||||||||||
|
Subroutine
FOREIGNBUILDARGS: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 108 | 106 | my ( $class, $args ) = @_; | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 106 | ▶ | $args ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||
| 111 | 106 | ▶ | $args->{version} = 0 if not defined $args->{version}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | # We're no longer storing the file path and sha digests of each package | ||||||||||||||||||||||||||||
| 114 | # because the paths in the META are often wrong anyway, and that would | ||||||||||||||||||||||||||||
| 115 | # cause Dist::Metadata to blow up. I had hoped this information would be | ||||||||||||||||||||||||||||
| 116 | # used to figure out which distribution a given file came from. But I've | ||||||||||||||||||||||||||||
| 117 | # decided that is out of scope for Pinto. Eventually, we'll remove | ||||||||||||||||||||||||||||
| 118 | # these from the schema entirely. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 106 | ▶ | $args->{file} ||= ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$args->{"file"} ||= ""
MC/DC100%1/1
$args->{"file"} ||= ""
$args->{"file"}
Truth table100%2/2
A
A= $args->{"file"}
| |||||||||||||||||||||||||||||
| 121 | 106 | ▶ | $args->{sha256} ||= ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"sha256"} ||= ""
MC/DC0%0/1
$args->{"sha256"} ||= ""
$args->{"sha256"}
Truth table50%1/2
A
A= $args->{"sha256"}
| |||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 106 | return $args; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 84 | ▶ | sub register { | ||||||||||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 129 | 84 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 84 | my $stack = $args{stack}; | |||||||||||||||||||||||||||
| 132 | 84 | my $pin = $args{pin}; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 84 | my $struct = { | |||||||||||||||||||||||||||
| 135 | revision => $stack->head->id, | ||||||||||||||||||||||||||||
| 136 | is_pinned => $pin, | ||||||||||||||||||||||||||||
| 137 | package_name => $self->name, | ||||||||||||||||||||||||||||
| 138 | distribution => $self->get_column('distribution') | ||||||||||||||||||||||||||||
| 139 | }; | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 84 | $self->create_related( registrations => $struct ); | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 84 | return $self; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 11 | ▶ | sub vname { | ||||||||||||||||||||||||||
|
Subroutine
vname: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 149 | 11 | my ($self) = @_; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 11 | return $self->name . '~' . $self->version; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub as_target { | ||||||||||||||||||||||||||
|
Subroutine
as_target: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 157 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | return Pinto::Target::Package->new( | |||||||||||||||||||||||||||
| 160 | name => $self->name, | ||||||||||||||||||||||||||||
| 161 | version => $self->version | ||||||||||||||||||||||||||||
| 162 | ); | ||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 84 | ▶ | sub is_simile { | ||||||||||||||||||||||||||
|
Subroutine
is_simile: called CC=5 SCAR=17.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 169 | 84 | my($self) = @_; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 84 | my $package = $self->name; | |||||||||||||||||||||||||||
| 172 | 84 | my $file = $self->file; | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | # Some older version of Pinto did not record the filename of each | ||||||||||||||||||||||||||||
| 175 | # package. In that case we must assume that it is a simile. | ||||||||||||||||||||||||||||
| 176 | 84 | ▶ | return 1 if not $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | # The following code was taken from simile() in PAUSE/pmfile.pm | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | # MakeMaker gives them the chance to have the file Simple.pm in | ||||||||||||||||||||||||||||
| 181 | # this directory but have the package HTML::Simple in it. | ||||||||||||||||||||||||||||
| 182 | # Afaik, they wouldn't be able to do so with deeper nested packages | ||||||||||||||||||||||||||||
| 183 | 84 | $file =~ s|.*/||; | |||||||||||||||||||||||||||
| 184 | 84 | $file =~ s|\.pm(?:\.PL)?||; | |||||||||||||||||||||||||||
| 185 | 84 | my $ret = $package =~ m/\b\Q$file\E$/; | |||||||||||||||||||||||||||
| 186 | 84 | ▶ | $ret ||= 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$ret ||= 0
MC/DC0%0/1
$ret ||= 0
$ret
Truth table50%1/2
A
A= $ret
| |||||||||||||||||||||||||||||
| 187 | 84 | ▶ | unless ($ret) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | # Apache::mod_perl_guide stuffs it into Version.pm | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $ret = 1 if lc $file eq 'version'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 84 | return $ret; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 84 | ▶ | sub can_index { | ||||||||||||||||||||||||||
|
Subroutine
can_index: called CC=5 SCAR=19.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 198 | 84 | my ($self) = @_; | |||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | # Workaround for Net::LibIDN (see GH #194) | ||||||||||||||||||||||||||||
| 201 | 84 | ▶ | return 1 if $self->name eq 'Net::LibIDN' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->name eq "Net::LibIDN" and $self->file eq "_LibIDN.pm"
MC/DC0%0/2
$self->name eq "Net::LibIDN" and $self->file eq "_LibIDN.pm"
$self->name eq "Net::LibIDN"
$self->file eq "_LibIDN.pm"
Truth table33%1/3
A and B
A= $self->name eq "Net::LibIDN"B= $self->file eq "_LibIDN.pm"
| |||||||||||||||||||||||||||||
| 202 | and $self->file eq '_LibIDN.pm'; | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | # Workaround for FCGI | ||||||||||||||||||||||||||||
| 205 | 84 | ▶ | return 1 if $self->name eq 'FCGI' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->name eq "FCGI" and $self->file eq "FCGI.PL"
MC/DC0%0/2
$self->name eq "FCGI" and $self->file eq "FCGI.PL"
$self->name eq "FCGI"
$self->file eq "FCGI.PL"
Truth table33%1/3
A and B
A= $self->name eq "FCGI"B= $self->file eq "FCGI.PL"
| |||||||||||||||||||||||||||||
| 206 | and $self->file eq 'FCGI.PL'; | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 84 | return $self->is_simile; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub flags { | ||||||||||||||||||||||||||
|
Subroutine
flags: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 214 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | my $format = '%m%s?%x'; | |||||||||||||||||||||||||||
| 217 | 0 | return $self->to_string($format); | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 20 | ▶ | sub to_string { | ||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=7.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 223 | 20 | my ( $self, $format ) = @_; | |||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | # my ($pkg, $file, $line) = caller; | ||||||||||||||||||||||||||||
| 226 | # warn __PACKAGE__ . " stringified from $file at line $line"; | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | my %fspec = ( | ||||||||||||||||||||||||||||
| 229 | 1 | ▶ | 'p' => sub { $self->name() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 230 | 9 | ▶ | 'P' => sub { $self->vname() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | 'x' => sub { $self->can_index ? 'x' : '-'}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | 'M' => sub { $self->is_main_module ? 'm' : '-'}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 1 | ▶ | 'v' => sub { $self->version->stringify() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 234 | 1 | ▶ | 'm' => sub { $self->distribution->is_devel() ? 'd' : 'r' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 1 | ▶ | 'h' => sub { $self->distribution->path() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | 'H' => sub { $self->distribution->native_path() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | 'f' => sub { $self->distribution->archive }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 238 | 1 | ▶ | 's' => sub { $self->distribution->is_local() ? 'l' : 'f' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 1 | ▶ | 'S' => sub { $self->distribution->source() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 240 | 9 | ▶ | 'a' => sub { $self->distribution->author() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 241 | 1 | ▶ | 'd' => sub { $self->distribution->name() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 242 | 9 | ▶ | 'D' => sub { $self->distribution->vname() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 243 | 1 | ▶ | 'V' => sub { $self->distribution->version() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 244 | 1 | ▶ | 'u' => sub { $self->distribution->uri() }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 245 | 0 | ▶ | 'F' => sub { $self->flags }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 246 | 20 | ); | |||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | # Some attributes are just undefined, usually because of | ||||||||||||||||||||||||||||
| 249 | # oddly named distributions and other old stuff on CPAN. | ||||||||||||||||||||||||||||
| 250 | 63 | ▶ | no warnings 'uninitialized'; ## no critic qw(NoWarnings); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 20 | ▶ | $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
| |||||||||||||||||||||||||||||
| 253 | 20 | return String::Format::stringf( $format, %fspec ); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 8 | ▶ | sub default_format { | ||||||||||||||||||||||||||
|
Subroutine
default_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 259 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 8 | return '%a/%D/%P'; # AUTHOR/DIST_VNAME/PKG_VNAME | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 9 | ▶ | sub numeric_compare { | ||||||||||||||||||||||||||
|
Subroutine
numeric_compare: called CC=7 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 267 | 9 | my ( $pkg_a, $pkg_b ) = @_; | |||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 9 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||
| 270 | 9 | ▶ | throw "Can only compare $pkg objects" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
itis($pkg_a, $pkg) and itis($pkg_b, $pkg)
MC/DC0%0/2
itis($pkg_a, $pkg) and itis($pkg_b, $pkg)
itis($pkg_a, $pkg)
itis($pkg_b, $pkg)
Truth table33%1/3
A and B
A= itis($pkg_a, $pkg)B= itis($pkg_b, $pkg)
| |||||||||||||||||||||||||||||
| 271 | if not( itis( $pkg_a, $pkg ) && itis( $pkg_b, $pkg ) ); | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 9 | ▶ | return 0 if $pkg_a->id == $pkg_b->id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 9 | ▶ | throw "Cannot compare packages with different names: $pkg_a <=> $pkg_b" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | if $pkg_a->name ne $pkg_b->name; | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 8 | ▶ | my $r = ( $pkg_a->version <=> $pkg_b->version ) | ||||||||||||||||||||||||||
|
Condition100%3/3
$pkg_a->version <=> $pkg_b->version || $pkg_a->distribution->mtime <=> $pkg_b->distribution->mtime
MC/DC100%2/2
$pkg_a->version <=> $pkg_b->version || $pkg_a->distribution->mtime <=> $pkg_b->distribution->mtime
$pkg_a->version <=> $pkg_b->version
$pkg_a->distribution->mtime <=> $pkg_b->distribution->mtime
Truth table100%3/3
A || B
A= $pkg_a->version <=> $pkg_b->versionB= $pkg_a->distribution->mtime <=> $pkg_b->distribution->mtime
| |||||||||||||||||||||||||||||
| 279 | || ( $pkg_a->distribution->mtime <=> $pkg_b->distribution->mtime ); | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | # No two non-identical packages can be considered equal! | ||||||||||||||||||||||||||||
| 282 | 8 | ▶ | throw "Unable to determine ordering: $pkg_a <=> $pkg_b" if not $r; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 6 | return $r; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub string_compare { | ||||||||||||||||||||||||||
|
Subroutine
string_compare: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 290 | 0 | my ( $pkg_a, $pkg_b ) = @_; | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 0 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||
| 293 | 0 | ▶ | throw "Can only compare $pkg objects" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
itis($pkg_a, $pkg) and itis($pkg_b, $pkg)
MC/DC0%0/2
itis($pkg_a, $pkg) and itis($pkg_b, $pkg)
itis($pkg_a, $pkg)
itis($pkg_b, $pkg)
Truth table0%0/3
A and B
A= itis($pkg_a, $pkg)B= itis($pkg_b, $pkg)
| |||||||||||||||||||||||||||||
| 294 | if not( itis( $pkg_a, $pkg ) && itis( $pkg_b, $pkg ) ); | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 0 | ▶ | return 0 if $pkg_a->id() == $pkg_b->id(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | my $r = ( $pkg_a->name cmp $pkg_b->name ) | ||||||||||||||||||||||||||
|
Condition0%0/3
$pkg_a->name cmp $pkg_b->name || $pkg_a->version <=> $pkg_b->version
MC/DC0%0/2
$pkg_a->name cmp $pkg_b->name || $pkg_a->version <=> $pkg_b->version
$pkg_a->name cmp $pkg_b->name
$pkg_a->version <=> $pkg_b->version
Truth table0%0/3
A || B
A= $pkg_a->name cmp $pkg_b->nameB= $pkg_a->version <=> $pkg_b->version
| |||||||||||||||||||||||||||||
| 299 | || ( $pkg_a->version <=> $pkg_b->version ); | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 0 | return $r; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 63 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 309 | 63 | 1; | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | __END__ | ||||||||||||||||||||||||||||