| 1 | package Module::Reader; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | BEGIN { require 5.006 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | our $VERSION = '0.003003'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Exporter (); BEGIN { *import = \&Exporter::import } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | our @EXPORT_OK = qw(module_content module_handle); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | our %EXPORT_TAGS = (all => [@EXPORT_OK]); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Scalar::Util qw(reftype refaddr openhandle); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use Config (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Errno qw(EACCES); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use constant _OPEN_LAYERS => "$]" >= 5.008_000 ? ':' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use constant _ABORT_ON_EACCES => "$]" >= 5.017_001; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use constant _ALLOW_PREFIX => "$]" >= 5.008009; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use constant _VMS => $^O eq 'VMS' && !!require VMS::Filespec; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.6
Condition33%1/3
$^O eq 'VMS' && !!(require VMS::Filespec)
MC/DC0%0/2
$^O eq 'VMS' && !!(require VMS::Filespec)
$^O eq 'VMS'
!!(require VMS::Filespec)
Truth table33%1/3
A && B
A= $^O eq 'VMS'B= !!(require VMS::Filespec)
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | use constant _WIN32 => $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | use constant _PMC_ENABLED => !( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | exists &Config::non_bincompat_options | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 30 | ? grep { $_ eq 'PERL_DISABLE_PMC' } Config::non_bincompat_options() | |||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | : $Config::Config{ccflags} =~ /(?:^|\s)-DPERL_DISABLE_PMC\b/ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | use constant _FAKE_FILE_FORMAT => do { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | my $uvx = $Config::Config{uvxformat} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Config::Config{'uvxformat'} || ''
MC/DC0%0/1
$Config::Config{'uvxformat'} || ''
$Config::Config{'uvxformat'}
Truth table50%1/2
A
A= $Config::Config{'uvxformat'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | $uvx =~ tr/"\0//d; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | $uvx ||= 'lx'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$uvx ||= "lx"
MC/DC0%0/1
$uvx ||= "lx"
$uvx
Truth table50%1/2
A
A= $uvx
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | "/loader/0x%$uvx/%s" | |||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 44 | ▶ | sub _mod_to_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mod_to_file: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 44 | my $module = shift; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 44 | (my $file = "$module.pm") =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 44 | $file; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 18 | ▶ | sub module_content { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_content: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 18 | ▶ | my $opts = ref $_[-1] eq 'HASH' && pop @_ || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
ref $_[-1] eq 'HASH' && pop @_ || {}
ref $_[-1] eq "HASH" and pop @_
MC/DC50%1/2
ref $_[-1] eq 'HASH' && pop @_ || {}
ref $_[-1] eq "HASH"
pop @_
Truth table66%2/3
A and B
A= ref $_[-1] eq "HASH"B= pop @_
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 18 | my $module = shift; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 18 | ▶ | $opts->{inc} = [@_] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | if @_; | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 18 | __PACKAGE__->new($opts)->module($module)->content; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub module_handle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_handle: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $opts = ref $_[-1] eq 'HASH' && pop @_ || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
ref $_[-1] eq 'HASH' && pop @_ || {}
ref $_[-1] eq "HASH" and pop @_
MC/DC0%0/2
ref $_[-1] eq 'HASH' && pop @_ || {}
ref $_[-1] eq "HASH"
pop @_
Truth table0%0/3
A and B
A= ref $_[-1] eq "HASH"B= pop @_
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $module = shift; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $opts->{inc} = [@_] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | if @_; | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | __PACKAGE__->new($opts)->module($module)->handle; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 119 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=11 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 119 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 119 | my %options; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 119 | ▶ | if (@_ == 1 && ref $_[-1]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@_ == 1 and ref $_[-1]
MC/DC50%1/2
@_ == 1 and ref $_[-1]
@_ == 1
ref $_[-1]
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 18 | %options = %{(pop)}; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | elsif (@_ % 2 == 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 101 | %options = @_; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | croak "Expected hash ref, or key value pairs. Got ".@_." arguments."; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 119 | ▶ | $options{inc} ||= \@INC; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options{"inc"} ||= \@INC
MC/DC100%1/1
$options{"inc"} ||= \@INC
$options{"inc"}
Truth table100%2/2
A
A= $options{"inc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | $options{found} = \%INC | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 119 | ▶ | if exists $options{found} && $options{found} eq 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $options{"found"} and $options{"found"} eq 1
MC/DC0%0/2
exists $options{"found"} and $options{"found"} eq 1
exists $options{"found"}
$options{"found"} eq 1
Truth table66%2/3
A and B
A= exists $options{"found"}B= $options{"found"} eq 1
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | $options{pmc} = _PMC_ENABLED | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 119 | ▶ | if !exists $options{pmc}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | $options{open} = 1 | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 119 | ▶ | if !exists $options{open}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | $options{abort_on_eacces} = _ABORT_ON_EACCES | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 119 | ▶ | if !exists $options{abort_on_eacces}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | $options{check_hooks_for_nonsearchable} = 1 | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 119 | ▶ | if !exists $options{check_hooks_for_nonsearchable}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 119 | bless \%options, $class; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 44 | ▶ | sub module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 44 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 44 | $self->file(_mod_to_file($module)); | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub modules { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modules: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->files(_mod_to_file($module)); | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 119 | ▶ | sub file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 119 | my ($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 119 | $self->_find($file); | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
files: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my ($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $self->_find($file, 1); | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 99 | ▶ | sub _searchable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_searchable: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 99 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 99 | ▶ | File::Spec->file_name_is_absolute($file) ? 0 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | : _WIN32 && $file =~ m{^\.\.?[/\\]} ? 0 | ||||||||||||||||||||||||||||||||||||||||||
| 108 | : $file =~ m{^\.\.?/} ? 0 | ||||||||||||||||||||||||||||||||||||||||||
| 109 | : 1 | ||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 119 | ▶ | sub _find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find: called CC=21 SCAR=32.4
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 119 | my ($self, $file, $all) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 119 | my @found; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 119 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 117 | 119 | ▶ | if (my $found = $self->{found}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 26 | ▶ | if (defined( my $full = $found->{$file} )) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 26 | ▶ | my $open = length ref $full ? $self->_open_ref($full, $file) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | : $self->_open_file($full, $file); | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 23 | ▶ | push @found, $open | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | if $open; | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 119 | ▶ | if (!$all) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 119 | ▶ | return $found[0] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | if @found; | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 102 | ▶ | die $@ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | if $@; | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 99 | my $searchable = _searchable($file); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 99 | ▶ | if (!$searchable) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 25 | my $open = $self->_open_file($file); | |||||||||||||||||||||||||||||||||||||||||
| 136 | 22 | ▶ | if ($all) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | push @found, $open; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | elsif ($open) { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | return $open; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 6 | croak "Can't locate $file"; | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 74 | my $search = $self->{inc}; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 74 | for my $inc (@$search) { | |||||||||||||||||||||||||||||||||||||||||
| 149 | 99 | my $open; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 99 | ▶ | if (!$searchable) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | last | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if !$self->{check_hooks_for_nonsearchable}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | next | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if !length ref $inc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 99 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 99 | ▶ | if (!length ref $inc) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 61 | my $full = _VMS ? VMS::Filespec::unixpath($inc) : $inc; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 61 | $full =~ s{/?$}{/}; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 61 | $full .= $file; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 61 | $open = $self->_open_file($full, $file, $inc); | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 38 | $open = $self->_open_ref($inc, $file); | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 77 | ▶ | push @found, $open | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | if $open; | ||||||||||||||||||||||||||||||||||||||||||
| 168 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 99 | ▶ | if (!$all) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 99 | ▶ | return $found[0] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | if @found; | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 47 | ▶ | die $@ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | if $@; | ||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | croak "Can't locate $file" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | if !$all; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return @found; | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 111 | ▶ | sub _open_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_open_file: called CC=14 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 111 | my ($self, $full, $file, $inc) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 111 | ▶ | $file = $full | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | if !defined $file; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 111 | ▶ | for my $try ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"pmc"} and $file =~ /\.pm\z/
MC/DC50%1/2
$self->{"pmc"} and $file =~ /\.pm\z/
$self->{"pmc"}
$file =~ /\.pm\z/
Truth table66%2/3
A and B
A= $self->{"pmc"}B= $file =~ /\.pm\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | ($self->{pmc} && $file =~ /\.pm\z/ ? $full.'c' : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 187 | $full, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 157 | my $pmc = $full ne $try; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 157 | ▶ | if (-e $try) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | next | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 125 | ▶ | if -d _ || -b _; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-d _ or -b _
MC/DC50%1/2
-d _ or -b _
-d _
-b _
Truth table66%2/3
A or B
A= -d _B= -b _
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 94 | ▶ | if (open my $fh, '<'._OPEN_LAYERS, $try) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | return Module::Reader::File->new( | ||||||||||||||||||||||||||||||||||||||||||
| 195 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 63 | ▶ | ($self->{open} ? (raw_filehandle => $fh) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | found_file => $full, | ||||||||||||||||||||||||||||||||||||||||||
| 198 | disk_file => $try, | ||||||||||||||||||||||||||||||||||||||||||
| 199 | is_pmc => $pmc, | ||||||||||||||||||||||||||||||||||||||||||
| 200 | (defined $inc ? (inc_entry => $inc) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | croak "Can't locate $file: $full: $!" | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 63 | ▶ | if $self->{abort_on_eacces} && $! == EACCES && !$pmc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$self->{"abort_on_eacces"} and $! == 13 and not $pmc
$self->{"abort_on_eacces"} and $! == 13
MC/DC66%2/3
$self->{"abort_on_eacces"} and $! == 13 and not $pmc
$self->{"abort_on_eacces"}
$! == 13
not $pmc
Truth table75%3/4
A and B and not(C)
A= $self->{"abort_on_eacces"}B= $! == 13C= not $pmc
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 32 | return; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 39 | ▶ | sub _open_ref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_open_ref: called CC=17 SCAR=28.8
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 39 | my ($self, $inc, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 39 | my @cb; | |||||||||||||||||||||||||||||||||||||||||
| 215 | { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # strings in arrayrefs are taken as sub names relative to main | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 39 | package | |||||||||||||||||||||||||||||||||||||||||
| 218 | main; | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 39 | ▶ | @cb = defined Scalar::Util::blessed $inc ? $inc->INC($file) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | : ref $inc eq 'ARRAY' ? $inc->[0]->($inc, $file) | ||||||||||||||||||||||||||||||||||||||||||
| 223 | : $inc->($inc, $file); | ||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | return | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 27 | ▶ | unless length ref $cb[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 24 | my $fake_file = sprintf _FAKE_FILE_FORMAT, refaddr($inc), $file; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 24 | my $fh; | |||||||||||||||||||||||||||||||||||||||||
| 232 | my $prefix; | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 24 | my $cb; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 24 | my $cb_options; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 24 | ▶ | if (_ALLOW_PREFIX && reftype $cb[0] eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $prefix = shift @cb; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 24 | ▶ | if ((reftype $cb[0]||'') eq 'GLOB' && openhandle $cb[0]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
(builtin::reftype($cb[0]) || "") eq "GLOB" and &openhandle($cb[0])
builtin::reftype($cb[0]) || ''
MC/DC0%0/2
(builtin::reftype($cb[0]) || "") eq "GLOB" and &openhandle($cb[0])
builtin::reftype($cb[0])
&openhandle($cb[0])
Truth table33%1/3
A and B
A= builtin::reftype($cb[0])B= &openhandle($cb[0])
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 6 | $fh = shift @cb; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 24 | ▶ | if ((reftype $cb[0]||'') eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%2/2
builtin::reftype($cb[0]) || ''
MC/DC100%1/1
builtin::reftype($cb[0]) || ''
builtin::reftype($cb[0])
Truth table100%2/2
A
A= builtin::reftype($cb[0])
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 16 | $cb = $cb[0]; | |||||||||||||||||||||||||||||||||||||||||
| 246 | # only one or zero callback options will be passed | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 16 | ▶ | $cb_options = @cb > 1 ? [ $cb[1] ] : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | ▶ | elsif (!defined $fh && !defined $prefix) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $fh || defined $prefix
MC/DC50%1/2
defined $fh || defined $prefix
defined $fh
defined $prefix
Truth table66%2/3
A || B
A= defined $fhB= defined $prefix
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 22 | ▶ | return Module::Reader::File->new( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 254 | found_file => $fake_file, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | inc_entry => $inc, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | (defined $prefix ? (prefix => $prefix) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 257 | (defined $fh ? (raw_filehandle => $fh) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 258 | (defined $cb ? (read_callback => $cb) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 259 | (defined $cb_options ? (read_callback_options => $cb_options) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 260 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub inc { $_[0]->{inc} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub found { $_[0]->{found} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
found: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub pmc { $_[0]->{pmc} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pmc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | sub open { $_[0]->{open} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | { | ||||||||||||||||||||||||||||||||||||||||||
| 269 | package Module::Reader::File; | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 3 | ▶ | use constant _OPEN_STRING => "$]" >= 5.008 || !require IO::String; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.6
Condition33%1/3
"$]" >= 5.008 || !(require IO::String)
MC/DC0%0/2
"$]" >= 5.008 || !(require IO::String)
"$]" >= 5.008
!(require IO::String)
Truth table33%1/3
A || not(B)
A= "$]" >= 5.008B= !(require IO::String)
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 85 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 85 | my ($class, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 85 | my $filename = $opts{filename}; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 85 | ▶ | if (!exists $opts{module} && $opts{filename} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not exists $opts{"module"} and $opts{"filename"} and $opts{"filename"} =~ m[\A(\w+(?:/\w+)?)\.pm\z]
not exists $opts{"module"} and $opts{"filename"}
MC/DC33%1/3
not exists $opts{"module"} and $opts{"filename"} and $opts{"filename"} =~ m[\A(\w+(?:/\w+)?)\.pm\z]
not exists $opts{"module"}
$opts{"filename"}
$opts{"filename"} =~ m[\A(\w+(?:/\w+)?)\.pm\z]
Truth table50%2/4
not(A) and B and C
A= not exists $opts{"module"}B= $opts{"filename"}C= $opts{"filename"} =~ m[\A(\w+(?:/\w+)?)\.pm\z]
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | && $opts{filename} =~ m{\A(\w+(?:/\w+)?)\.pm\z}) { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 69 | my $module = $1; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 69 | $module =~ s{/}{::}g; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 69 | $opts{module} = $module; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 85 | bless \%opts, $class; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub filename { $_[0]->{filename} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filename: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | sub module { $_[0]->{module} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | sub found_file { $_[0]->{found_file} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
found_file: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 14 | ▶ | sub disk_file { $_[0]->{disk_file} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disk_file: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 48 | ▶ | sub is_pmc { $_[0]->{is_pmc} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_pmc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 78 | ▶ | sub inc_entry { $_[0]->{inc_entry} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inc_entry: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 6 | ▶ | sub read_callback { $_[0]->{read_callback} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_callback: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub read_callback_options { $_[0]->{read_callback_options} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_callback_options: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 6 | ▶ | sub raw_filehandle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_filehandle: called CC=4 SCAR=25.0
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 6 | ▶ | $_[0]->{raw_filehandle} ||= !$_[0]->{disk_file} ? undef : do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0]{"raw_filehandle"} ||= !$_[0]{"disk_file"} ? undef : do {
open my $fh, "<:", $_[0]{"disk_file"} or croak(qq[Can't locate $_[0]{"disk_file"}]);
$fh
}
MC/DC0%0/2
$_[0]{"raw_filehandle"} ||= !$_[0]{"disk_file"} ? undef : do {
open my $fh, "<:", $_[0]{"disk_file"} or croak(qq[Can't locate $_[0]{"disk_file"}]);
$fh
}
$_[0]{"raw_filehandle"}
!$_[0]{"disk_file"} ? undef : do {
open my $fh, "<:", $_[0]{"disk_file"} or croak(qq[Can't locate $_[0]{"disk_file"}]);
$fh
}
Truth table33%1/3
A ||= not(B)
A= $_[0]{"raw_filehandle"}B= !$_[0]{"disk_file"} ? undef : do {
open my $fh, "<:", $_[0]{"disk_file"} or croak(qq[Can't locate $_[0]{"disk_file"}]);
$fh
}
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | open my $fh, '<'.Module::Reader::_OPEN_LAYERS, $_[0]->{disk_file} | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | or croak "Can't locate $_[0]->{disk_file}"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | $fh; | |||||||||||||||||||||||||||||||||||||||||
| 298 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 6 | ▶ | sub content { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content: called CC=10 SCAR=34.3
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 303 | return $self->{content} | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 6 | ▶ | if exists $self->{content}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 6 | my $fh = $self->raw_filehandle; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 6 | my $cb = $self->read_callback; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | my $content = defined $self->{prefix} ? ${$self->{prefix}} : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 6 | ▶ | if ($fh && !$cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$fh and not $cb
MC/DC0%0/2
$fh and not $cb
$fh
not $cb
Truth table33%1/3
A and not(B)
A= $fhB= not $cb
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 6 | local $/; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 6 | $content .= <$fh>; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 6 | ▶ | if ($cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my @params = @{$self->read_callback_options||[]}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->read_callback_options || []
MC/DC0%0/1
$self->read_callback_options || []
$self->read_callback_options
Truth table0%0/2
A
A= $self->read_callback_options
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | local $_ = $fh ? <$fh> : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | $_ = '' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | if !defined; | ||||||||||||||||||||||||||||||||||||||||||
| 318 | # perlfunc/require says that the first parameter will be a reference the | ||||||||||||||||||||||||||||||||||||||||||
| 319 | # sub itself. this is wrong. 0 will be passed. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | last if !$cb->(0, @params); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $content .= $_; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 6 | return $self->{content} = $content; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | sub handle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my $fh = $self->raw_filehandle; | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if ($fh && !$self->read_callback && -f $fh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$fh and not $self->read_callback and -f $fh
$fh and not $self->read_callback
MC/DC0%0/3
$fh and not $self->read_callback and -f $fh
$fh
not $self->read_callback
-f $fh
Truth table0%0/4
A and not(B) and C
A= $fhB= not $self->read_callbackC= -f $fh
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | open my $dup, '<&', $fh | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | or croak "can't dup file handle: $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | return $dup; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $content = $self->content; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | if (_OPEN_STRING) { | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | open my $fh, '<', \$content; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return $fh; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | return IO::String->new($content); | ||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | __END__ | ||||||||||||||||||||||||||||||||||||||||||