| 1 | package App::SmokeBrew::Tools; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | $App::SmokeBrew::Tools::VERSION = '1.06'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | #ABSTRACT: Various utility functions for smokebrew | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Archive::Extract; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use File::Fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use List::Util qw[uniq]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use Module::CoreList; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Perl::Version; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | my @mirrors = ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 'http://www.cpan.org/', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 'http://cpan.cpantesters.org/', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | sub fetch { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: called CC=10 SCAR=25.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | my $fetch = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | $fetch = shift if $fetch->isa(__PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | return unless $fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | my $loc = shift || return; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | my $mirrors = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | $mirrors = \@mirrors unless | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | $mirrors and ref $mirrors eq 'ARRAY' and scalar @{ $mirrors }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$mirrors and ref $mirrors eq "ARRAY" and scalar @{$mirrors;}
$mirrors and ref $mirrors eq "ARRAY"
MC/DC0%0/2
$mirrors and ref $mirrors eq "ARRAY" and scalar @{$mirrors;}
$mirrors
ref $mirrors eq "ARRAY"
Truth table33%1/3
A and B
A= $mirrorsB= ref $mirrors eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | $loc = File::Spec->rel2abs($loc); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | my $stat; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | foreach my $mirror ( @{ $mirrors } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | my $uri = URI->new( ( $mirror->isa('URI') ? $mirror->as_string : $mirror ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | $uri->path_segments( ( grep { $_ } $uri->path_segments ), split(m!/!, $fetch) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | my $ff = File::Fetch->new( uri => $uri->as_string ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | $stat = $ff->fetch( to => $loc ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | last if $stat; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | return $stat; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | sub extract { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | $file = shift if $file->isa(__PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | return unless $file; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | my $loc = shift || return; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | $loc = File::Spec->rel2abs($loc); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | local $Archive::Extract::PREFER_BIN=1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | my $ae = Archive::Extract->new( archive => $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | return unless $ae; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | return unless $ae->extract( to => $loc ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | return $ae->extract_path(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | sub smokebrew_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smokebrew_dir: called CC=8 SCAR=38.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | return $ENV{PERL5_SMOKEBREW_DIR} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | if exists $ENV{PERL5_SMOKEBREW_DIR} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | && defined $ENV{PERL5_SMOKEBREW_DIR}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $ENV{"PERL5_SMOKEBREW_DIR"} and defined $ENV{"PERL5_SMOKEBREW_DIR"}
MC/DC0%0/2
exists $ENV{"PERL5_SMOKEBREW_DIR"} and defined $ENV{"PERL5_SMOKEBREW_DIR"}
exists $ENV{"PERL5_SMOKEBREW_DIR"}
defined $ENV{"PERL5_SMOKEBREW_DIR"}
Truth table33%1/3
A and B
A= exists $ENV{"PERL5_SMOKEBREW_DIR"}B= defined $ENV{"PERL5_SMOKEBREW_DIR"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my @os_home_envs = qw( APPDATA HOME USERPROFILE WINDIR SYS$LOGIN ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | for my $env ( @os_home_envs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | next unless exists $ENV{ $env }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | next unless defined $ENV{ $env } && length $ENV{ $env }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ENV{$env} and length $ENV{$env}
MC/DC0%0/2
defined $ENV{$env} and length $ENV{$env}
defined $ENV{$env}
length $ENV{$env}
Truth table0%0/3
A and B
A= defined $ENV{$env}B= length $ENV{$env}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | return $ENV{ $env } if -d $ENV{ $env }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | return cwd(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 8 | ▶ | sub perls { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perls: called CC=28 SCAR=33.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 8 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 8 | ▶ | $type = shift if $type->isa(__PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 8 | ▶ | if ( $type and $type eq 'latest' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type and $type eq "latest"
MC/DC100%2/2
$type and $type eq "latest"
$type
$type eq "latest"
Truth table100%3/3
A and B
A= $typeB= $type eq "latest"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | my %perls; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | foreach my $pv ( map { Perl::Version->new($_) } perls('recent') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 71 | my $vers = $pv->version; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 71 | ▶ | unless ( exists $perls{$vers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 19 | $perls{$vers} = $pv; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 19 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 52 | ▶ | $perls{$vers} = $pv if $pv > $perls{$vers}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 19 | return map { _format_version($_) } map { $perls{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | sort { $perls{$a} <=> $perls{$b} } keys %perls; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | ▶ | unless ( $type and $type =~ /^(rel|dev|recent|modern)$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type and $type =~ /^(rel|dev|recent|modern)$/i
MC/DC100%2/2
$type and $type =~ /^(rel|dev|recent|modern)$/i
$type
$type =~ /^(rel|dev|recent|modern)$/i
Truth table100%3/3
A and B
A= $typeB= $type =~ /^(rel|dev|recent|modern)$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | $type =~ s/[^\d\.]+//g if $type; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | uniq | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 931 | map { _format_version($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2415 | ▶ | if ( $type and $type eq 'rel' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition100%3/3
$type and $type eq "rel"
MC/DC100%2/2
$type and $type eq "rel"
$type
$type eq "rel"
Truth table100%3/3
A and B
A= $typeB= $type eq "rel"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 345 | ▶ | _is_rel($_) and !_is_ancient($_) and !_skip($_); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
_is_rel($_) && !_is_ancient($_) && !_skip($_)
_is_rel($_) and not _is_ancient($_)
MC/DC66%2/3
_is_rel($_) && !_is_ancient($_) && !_skip($_)
_is_rel($_)
not _is_ancient($_)
!_skip($_)
Truth table75%3/4
A and not(B) && not(C)
A= _is_rel($_)B= not _is_ancient($_)C= !_skip($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ▶ | elsif ( $type and $type eq 'dev' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$type and $type eq "dev"
MC/DC100%2/2
$type and $type eq "dev"
$type
$type eq "dev"
Truth table100%3/3
A and B
A= $typeB= $type eq "dev"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 345 | ▶ | _is_dev($_) and !_is_ancient($_); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
_is_dev($_) && !_is_ancient($_)
MC/DC50%1/2
_is_dev($_) && !_is_ancient($_)
_is_dev($_)
!_is_ancient($_)
Truth table66%2/3
A && not(B)
A= _is_dev($_)B= !_is_ancient($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ▶ | elsif ( $type and $type eq 'recent' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$type and $type eq "recent"
MC/DC100%2/2
$type and $type eq "recent"
$type
$type eq "recent"
Truth table100%3/3
A and B
A= $typeB= $type eq "recent"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 690 | ▶ | _is_recent($_) and !_skip($_); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
_is_recent($_) && !_skip($_)
MC/DC100%2/2
_is_recent($_) && !_skip($_)
_is_recent($_)
!_skip($_)
Truth table100%3/3
A && not(B)
A= _is_recent($_)B= !_skip($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ▶ | elsif ( $type and $type eq 'modern' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$type and $type eq "modern"
MC/DC100%2/2
$type and $type eq "modern"
$type
$type eq "modern"
Truth table100%3/3
A and B
A= $typeB= $type eq "modern"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 345 | ▶ | _is_modern($_) and !_skip($_); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
_is_modern($_) && !_skip($_)
MC/DC100%2/2
_is_modern($_) && !_skip($_)
_is_modern($_)
!_skip($_)
Truth table100%3/3
A && not(B)
A= _is_modern($_)B= !_skip($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | elsif ( $type ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 345 | $_->normal =~ /\Q$type\E$/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 345 | ▶ | _is_dev($_) or _is_rel($_) and !_is_ancient($_) and !_skip($_); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
_is_dev($_) || _is_rel($_) && !_is_ancient($_) && !_skip($_)
_is_rel($_) and not _is_ancient($_) and not _skip($_)
_is_rel($_) and not _is_ancient($_)
MC/DC75%3/4
_is_dev($_) || _is_rel($_) && !_is_ancient($_) && !_skip($_)
_is_dev($_)
_is_rel($_)
not _is_ancient($_)
not _skip($_)
Truth table80%4/5
A || B and not(C) and not(D)
A= _is_dev($_)B= _is_rel($_)C= not _is_ancient($_)D= not _skip($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2415 | map { Perl::Version->new($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 7 | ▶ | map { $_ >= 5.006 ? sprintf('%.6f', $_) : $_ } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | sort keys %Module::CoreList::released; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | ▶ | sub _has_quadmath { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_has_quadmath: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | return 1 if $pv->numify >= 5.021004; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1697 | ▶ | sub _is_dev { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_dev: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1697 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1697 | ▶ | return 0 if _is_ancient($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1677 | return $pv->version % 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 461 | ▶ | sub _is_rel { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_rel: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 461 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 461 | ▶ | return 0 if _is_ancient($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 441 | return !( $pv->version % 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 690 | ▶ | sub _is_recent { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_recent: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 690 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 690 | ▶ | return 0 if _is_ancient($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 670 | ▶ | return 0 if _is_dev($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 212 | ▶ | return 1 if $pv->numify >= 5.008009; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 28 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 345 | ▶ | sub _is_modern { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_modern: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 345 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 345 | ▶ | return 0 if _is_ancient($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 335 | ▶ | return 0 if _is_dev($pv); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 106 | ▶ | return 1 if $pv->numify >= 5.010000; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 15 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 3634 | ▶ | sub _is_ancient { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_ancient: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 3634 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 3634 | ( my $numify = $pv->numify ) =~ s/_//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 3634 | ▶ | return 1 if $numify < 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3564 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 487 | ▶ | sub _skip { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_skip: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 487 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 487 | my $nv = $pv->numify; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 487 | ▶ | return 1 if $nv == 5.034002 || $nv == 5.036002 || $nv == 5.038001; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$nv == "5.034002" or $nv == "5.036002" or $nv == "5.038001"
$nv == "5.034002" or $nv == "5.036002"
MC/DC100%3/3
$nv == "5.034002" or $nv == "5.036002" or $nv == "5.038001"
$nv == "5.034002"
$nv == "5.036002"
$nv == "5.038001"
Truth table100%4/4
A or B or C
A= $nv == "5.034002"B= $nv == "5.036002"C= $nv == "5.038001"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 472 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 950 | ▶ | sub _format_version { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_version: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 950 | my $pv = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 950 | my $numify = $pv->numify; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 950 | $numify =~ s/_//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 950 | ▶ | return $pv if $numify < 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 950 | my $normal = $pv->normal(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 950 | $normal =~ s/^v//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 950 | return $normal; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | ▶ | sub perl_version { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perl_version: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | my $vers = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | ▶ | $vers = shift if eval { $vers->isa(__PACKAGE__) }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | my $version = Perl::Version->new( $vers ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | ( my $numify = $version->numify ) =~ s/_//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | ▶ | my $pv = 'perl'.( $numify < 5.006 ? $version->numify : $version->normal ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | $pv =~ s/perlv/perl-/g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 2 | return $pv; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | ▶ | sub devel_perl { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
devel_perl: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | my $perl = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | ▶ | $perl = shift if eval { $perl->isa(__PACKAGE__) }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | ▶ | return unless $perl; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | return _is_dev( Perl::Version->new( $perl ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | ▶ | sub can_quadmath { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_quadmath: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | my $perl = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | ▶ | $perl = shift if eval { $perl->isa(__PACKAGE__) }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | ▶ | return unless $perl; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | return _has_quadmath( Perl::Version->new( $perl ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 8 | qq[Smoke tools look what's inside of you]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||