lib/File/Information/Inode.pm

filter: Statementstmt 24.0% 132 / 548 Branchbran 9.4% 26 / 276 Conditioncond 5.9% 16 / 271 MC/DCmcdc 1.3% 2 / 148 Subroutinesub 39.3% 13 / 33 Podpod 100% 4 / 4 totaltotal 15.0% 193 / 1280 CC 259 SCAR 65.2
CC
259
Cov
16%
_load_tagpool_file
1942.6
_load_tagpool_directory
1190.0
_tagpool_paths
870.0
CRAP 679.7
« lib/File/Information/Tagpool.pm ↑ Summary lib/File/Information.pm »
1 # Copyright (c) 2024-2026 Philipp Schafft <lion@cpan.org>
2  
3 # licensed under Artistic License 2.0 (see LICENSE file)
4  
5 # ABSTRACT: generic module for extracting information from filesystems
6  
7  
8 package File::Information::Inode;
9  
10 3 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use parent 'File::Information::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use Fcntl qw(S_ISREG S_ISDIR S_ISLNK S_ISBLK S_ISCHR S_ISFIFO S_ISSOCK S_IWUSR S_IWGRP S_IWOTH SEEK_SET);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 3 ▶use Data::Identifier v0.08;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶use Data::Identifier::Generate;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 3 our $VERSION = v0.17;
24  
25 0 my $HAVE_XATTR = eval {require File::ExtAttr; 1;};
26 3 my $HAVE_FILE_VALUEFILE = eval {require File::ValueFile::Simple::Reader; 1;};
27 3 my $HAVE_CONFIG_INI_READER = eval {require Config::INI::Reader; 1;};
28  
29 3 my %_ntfs_attributes = (
30 FILE_ATTRIBUTE_READONLY => 0x0001,
31 FILE_ATTRIBUTE_HIDDEN => 0x0002,
32 FILE_ATTRIBUTE_SYSTEM => 0x0004,
33 FILE_ATTRIBUTE_ARCHIVE => 0x0020,
34 FILE_ATTRIBUTE_TEMPORARY => 0x0100,
35 FILE_ATTRIBUTE_COMPRESSED => 0x0800,
36 FILE_ATTRIBUTE_OFFLINE => 0x1000,
37 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED => 0x2000,
38 );
39  
40 3 my %_tagpool_directory_setting_tagmap; # define here, but only load (below) if we $HAVE_FILE_VALUEFILE
41  
42 3 my %_magic_map = (
43 # image/*
44 "\xff\xd8\xff" => 'image/jpeg',
45 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a" => 'image/png',
46 'GIF87a' => 'image/gif',
47 'GIF89a' => 'image/gif',
48 "\0\0\1\0" => 'image/vnd.microsoft.icon',
49 # audio/*
50 'fLaC' => 'audio/flac',
51 # application/*
52 '%PDF-' => 'application/pdf',
53 "PK\x03\x04" => 'application/zip',
54 '%!PS-Adobe-' => 'application/postscript',
55 );
56  
57 my %_wk_tagged_as_tags = (
58 9 (map {$_ => {for => 'write-mode'}} qw(7b177183-083c-4387-abd3-8793eb647373 3877b2ef-6c77-423f-b15f-76508fbd48ed 4dc9fd07-7ef3-4215-8874-31d78ed55c22)),
59 3 (map {$File::Information::Base::_mediatypes{$_} => {for => 'mediatype', mediatype => $_}} keys %File::Information::Base::_mediatypes),
60 'f418cdb9-64a7-4f15-9a18-63f7755c5b47' => {for => 'finalmode', implies => [qw(7b177183-083c-4387-abd3-8793eb647373)]},
61 'cb9c2c8a-b6bd-4733-80a4-5bd65af6b957' => {for => 'finalmode'},
62 );
63  
64 3 my %_URLZONE = (
65 # tag-ise 66294283-0a5d-4e78-a4b0-91df2c82068d # URLZONE-namespace
66 0 => {ise => 'd0e96897-b82f-5696-aa8e-8c29a16ab613', displayname => 'URLZONE_LOCAL_MACHINE'},
67 1 => {ise => 'cb576748-97f3-5fd7-80db-3682a94c67aa', displayname => 'URLZONE_INTRANET'},
68 2 => {ise => '445acf47-7049-5af1-8ed9-fecb54a8c517', displayname => 'URLZONE_TRUSTED'},
69 3 => {ise => 'a80b2f16-0db7-5536-a3ee-be8d85d123bd', displayname => 'URLZONE_INTERNET'},
70 4 => {ise => '73ef6c11-cdef-5547-be38-aa2cede0d4ea', displayname => 'URLZONE_UNTRUSTED'},
71 );
72  
73 my %_properties = (
74 3 (map {$_ => {loader => \&_load_stat}}qw(st_dev st_ino st_mode st_nlink st_uid st_gid st_rdev st_size st_blksize st_blocks st_atime st_mtime st_ctime stat_readonly stat_cachehash)),
75 magic_mediatype => {loader => \&_load_magic, rawtype => 'mediatype'},
76 magic_valuefile_version => {loader => \&_load_magic, rawtype => 'uuid'},
77 magic_valuefile_format => {loader => \&_load_magic, rawtype => 'ise'},
78 db_inode_tag => {loader => \&_load_db, rawtype => 'Data::TagDB::Tag'},
79 content_sha_3_512_uuid => {loader => \&_load_contentise, rawtype => 'uuid'},
80 content_sha_1_160_sha_3_512_uuid => {loader => \&_load_contentise, rawtype => 'uuid'},
81 store_file => {loader => \&_load_fstore, rawtype => 'File::FStore::File'},
82 shebang_line => {loader => \&_load_shebang},
83 shebang_interpreter => {loader => \&_load_shebang, rawtype => 'filename'},
84 );
85  
86 3 $_properties{$_}{rawtype} = 'unixts' foreach qw(st_atime st_mtime st_ctime);
87 3 $_properties{$_}{rawtype} = 'bool' foreach qw(stat_readonly);
88  
89 3 ▶if ($HAVE_XATTR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_XATTR) 0 3 3
90 0 $_properties{'xattr_'.$_} = {loader => \&_load_xattr, xattr_key => $_} foreach qw(mime_type charset creator);
91 0 $_properties{'xattr_mime_type'}{rawtype} = 'mediatype';
92  
93 0 $_properties{'xattr_xdg_'.($_ =~ tr/.-/__/r)} = {loader => \&_load_xattr, xattr_key => 'xdg.'.$_} foreach qw(comment origin.url origin.email.subject origin.email.from origin.email.message-id language creator publisher);
94  
95 0 $_properties{'xattr_dublincore_'.($_ =~ tr/.-/__/r)} = {loader => \&_load_xattr, xattr_key => 'dublincore.'.$_} foreach qw(title creator subject description publisher contributor date type format identifier source language relation coverage rights);
96  
97 0 $_properties{'xattr_utag_'.($_ =~ tr/.-/__/r)} = {loader => \&_load_xattr, rawtype => 'ise', xattr_key => 'utag.'.$_} foreach qw(ise write-mode final-mode);
98 0 $_properties{'xattr_utag_final_'.($_ =~ tr/.-/__/r)} = {loader => \&_load_xattr, lifecycle => 'final', xattr_key => 'utag.final.'.$_} foreach qw(file.size file.encoding file.hash);
99 0 $_properties{'xattr_utag_final_file_encoding'}{parts} = [qw(ise mediatype)];
100 0 $_properties{'xattr_utag_final_file_hash'}{parsing} = 'utag';
101 0 $_properties{'xattr_utag_final_file_hash_size'} = {loader => \&_load_redirect, redirect => 'xattr_utag_final_file_hash'};
102  
103 0 $_properties{'ntfs_'.lc($_)} = {loader => \&_load_ntfs_xattr, ntfs_attribute => $_, rawtype => 'bool'} foreach keys %_ntfs_attributes;
104 }
105  
106 3 ▶if ($HAVE_FILE_VALUEFILE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_FILE_VALUEFILE) 3 0 3
107 3 my $config = {loader => \&_load_tagpool_directory};
108 3 $_properties{'tagpool_directory_'.$_} = {%{$config}} foreach qw(title comment description inode mtime pool_uuid timestamp);
109 3 $_properties{'tagpool_directory_setting_'.($_ =~ tr/-/_/r)} = {%{$config}} foreach qw(thumbnail-uri thumbnail-mode update-mode add-mode file-tags tag-mode tag-implies entry-sort-order tag tag-root tag-parent tag-type entry-display-name entry-sort-key);
110 3 $_properties{'tagpool_directory_'.$_}{rawtype} = 'unixts' foreach qw(mtime timestamp);
111 3 $_properties{'tagpool_directory_'.$_}{rawtype} = 'uuid' foreach qw(pool_uuid);
112 3 $_properties{'tagpool_directory_setting_'.($_ =~ tr/-/_/r)}{rawtype} = 'ise' foreach qw(tag tag-root tag-parent tag-type);
113 3 $_properties{'tagpool_directory_throw_option_'.$_} = {%{$config}} foreach qw(linkname linktype filter);
114  
115 3 $_properties{'tagpool_file_'.($_ =~ tr/-/_/r)} = {loader => \&_load_tagpool_file} foreach qw(title comment description mtime timestamp inode size actual-size original-url original-description-url pool-name-suffix original-filename uuid mediatype write-mode finalmode thumbnail tags);
116 3 $_properties{'tagpool_file_'.$_}{rawtype} = 'unixts' foreach qw(mtime timestamp);
117 3 $_properties{'tagpool_file_'.($_ =~ tr/-/_/r)}{rawtype} = 'uuid' foreach qw(uuid write-mode finalmode tags);
118 3 $_properties{'tagpool_file_'.($_ =~ tr/-/_/r)}{rawtype} = 'mediatype' foreach qw(mediatype);
119 3 $_properties{'tagpool_file_'.($_ =~ tr/-/_/r)}{rawtype} = 'filename' foreach qw(thumbnail);
120  
121  
122 3 %_tagpool_directory_setting_tagmap = (
123 'thumbnail-mode' => {
124 'file-uri' => 'e4c80ac0-7c71-4548-9e84-9422bf1dae11',
125 'tag-uri' => '0025b1b2-20db-40e6-9345-baf0f9b5e166',
126 'tag' => '30c09ebd-bc14-48a3-8c0f-2d66c3d6e429',
127 'throw-filter' => 'c4438812-6011-42ee-984a-183745d9b013',
128 },
129 'update-mode' => {
130 'add' => 'dd1ff55a-fd87-428d-bd7e-57fc56488e72',
131 'throw' => '41217e01-4468-4d54-b613-902835ae0596',
132 },
133 'add-mode' => {
134 'all' => '65de001a-9063-4591-8b67-99ee1f91c4dd',
135 'no-boring' => 'db7c2ac0-4205-4f99-8556-c48cbb51138e',
136 'none' => '36fd66fd-b07f-4010-b796-05b488826571',
137 },
138 'file-tags' => {
139 'root' => '908c9015-b760-441e-85bf-ba98b5ff452b',
140 'level' => '53e36ce9-8afb-425e-9cae-2016cbdc27fe',
141 'root-and-level' => 'f8733429-8dc8-493b-8b91-958c6485afeb',
142 'parent-and-level' => 'e2cbc030-447a-4ee3-8adc-5b84c0400038',
143 'root-and-parent-and-level' => 'fe58aa1a-4cd7-49ca-a11d-ceab5223ccd9',
144 },
145 'tag-mode' => {
146 'random' => '02110f2e-b2c1-45a8-910b-0210f87cb7a1',
147 'named-random' => '7c6b6534-bd85-40c6-99f0-c0d308f790b6',
148 'namebased' => '39a2be03-7d07-41c4-93da-815c5f5d6f8d',
149 },
150 'tag-implies' => {
151 'root' => '60384e20-8d88-4171-970b-560ddafc1f95',
152 'parent' => '5e5acf8e-4e07-4ce9-8516-a014a7fbf91a',
153 'root-and-parent' => '112db395-84c3-4711-b99f-b5c6d6051781',
154 },
155 'entry-sort-order' => {
156 'asc' => '994e3f9c-79c1-40d1-892f-d66d406538a1',
157 'desc' => '54140078-a52a-4693-9f66-30b4ac4f1da4',
158 },
159 );
160  
161 3 foreach my $setting (values %_tagpool_directory_setting_tagmap) {
162 21 foreach my $entry (values %{$setting}) {
163 66 ▶ $entry = {ise => $entry} unless ref $entry;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $entry 66 0 66
164 }
165 }
166 }
167  
168 {
169 3 my %_wk = (
170 # tagpool-sysfile-type:
171 'e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb' => {displayname => 'regular'},
172 '577c3095-922b-4569-805d-a5df94686b35' => {displayname => 'directory'},
173 '76ae899c-ad0c-4bbc-b693-485f91779b9f' => {displayname => 'symlink'},
174 'f1765bfc-96d5-4ff3-ba2e-16a2a9f24cb3' => {displayname => 'blockdevice'},
175 '241431a9-c83f-4bce-93ff-0024021cd754' => {displayname => 'characterdevice'},
176 '3d680b7b-115c-486a-a186-4ad77facc52e' => {displayname => 'fifo'},
177 '3d1cb160-5fc5-4d8e-a8d3-3b0ec85bb000' => {displayname => 'socket'},
178  
179 # write-mode:
180 '7b177183-083c-4387-abd3-8793eb647373' => {displayname => 'none'},
181 '3877b2ef-6c77-423f-b15f-76508fbd48ed' => {displayname => 'random access'},
182 '4dc9fd07-7ef3-4215-8874-31d78ed55c22' => {displayname => 'append only'},
183  
184 # Final states:
185 'f418cdb9-64a7-4f15-9a18-63f7755c5b47' => {displayname => 'final'},
186 'cb9c2c8a-b6bd-4733-80a4-5bd65af6b957' => {displayname => 'auto-final'},
187  
188 # ValueFile:
189 '54bf8af4-b1d7-44da-af48-5278d11e8f32' => {displayname => 'ValueFile'},
190 'e5da6a39-46d5-48a9-b174-5c26008e208e' => {displayname => 'tagpool-source-format'},
191 'afdb46f2-e13f-4419-80d7-c4b956ed85fa' => {displayname => 'tagpool-taglist-format-v1'},
192 '25990339-3913-4b5a-8bcf-5042ef6d8b5e' => {displayname => 'tagpool-httpd-htdirectories-format'},
193 '11431b85-41cd-4be5-8d88-a769ebbd603f' => {displayname => 'tagpool-directory-info-format'},
194  
195 #'' => {displayname => ''},
196 );
197  
198 3 foreach my $setting (values %_tagpool_directory_setting_tagmap) {
199 21 foreach my $key (keys %{$setting}) {
200 66 my $value = $setting->{$key};
201 66 ▶ $value->{displayname} //= $key;
Condition33%1/3
$value->{"displayname"} //= $key
l!l&&r!l&&!r
0660
MC/DC0%0/2
$value->{"displayname"} //= $key
$value->{"displayname"} $key
Truth table33%1/3
A //= B
A= $value->{"displayname"}B= $key
ABresult
1X1
011
000
202 66 $_wk{$value->{ise}} = $value;
203 }
204 }
205  
206 3 ▶ while (my ($mediatype, $ise) = each %File::Information::Base::_mediatypes) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %File::Information::Base::_mediatypes) 135 3 138
207 135 ▶ ($_wk{$ise} //= {})->{displayname} //= $mediatype;
Condition40%2/5
+($_wk{$ise} //= {})->{"displayname"} //= $mediatype
l!l&&r!l&&!r
01350
$_wk{$ise} //= {}
l!l
0135
MC/DC0%0/2
+($_wk{$ise} //= {})->{"displayname"} //= $mediatype
+($_wk{$ise} //= {})->{"displayname"} $mediatype
MC/DC0%0/1
$_wk{$ise} //= {}
$_wk{$ise}
Truth table33%1/3
A //= B
A= +($_wk{$ise} //= {})->{"displayname"}B= $mediatype
ABresult
1X1
011
000
Truth table50%1/2
A
A= $_wk{$ise}
Aresult
11
00
208 }
209  
210  
211 3 ▶ while (my ($key, $value) = each %_wk) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %_wk) 252 3 255
212 252 Data::Identifier->new(ise => $key, %{$value})->register;
213 }
214  
215 3 foreach my $value (values %_URLZONE) {
216 15 Data::Identifier->new(ise => $value->{ise}, displayname => $value->{displayname})->register;
217 }
218 }
219  
220 3 ▶if ($HAVE_CONFIG_INI_READER) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_CONFIG_INI_READER) 3 0 3
221 3 $_properties{'zonetransfer_'.lc($_)} = {loader => \&_load_zonetransfer, zonetransfer_key => $_} foreach qw(HostIpAddress ZoneId ReferrerUrl HostUrl);
222 }
223  
224 {
225 3 my %_S_IS_to_tagpool_ise = (
226 S_ISREG => 'e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb',
227 S_ISDIR => '577c3095-922b-4569-805d-a5df94686b35',
228 S_ISLNK => '76ae899c-ad0c-4bbc-b693-485f91779b9f',
229 S_ISBLK => 'f1765bfc-96d5-4ff3-ba2e-16a2a9f24cb3',
230 S_ISCHR => '241431a9-c83f-4bce-93ff-0024021cd754',
231 S_ISFIFO => '3d680b7b-115c-486a-a186-4ad77facc52e',
232 S_ISSOCK => '3d1cb160-5fc5-4d8e-a8d3-3b0ec85bb000',
233 );
234  
235 0 ▶ $_properties{tagpool_inode_type} = {loader => sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
236 0 my ($self, undef, %opts) = @_;
237 0 ▶ if ($opts{lifecycle} eq 'current') {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"lifecycle"} eq "current") 0 0 0
238 0 my $mode = $self->get('st_mode', default => undef, as => 'raw');
239 0 my $ise;
240  
241 0 ▶ if (defined($mode)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mode) 0 0 0
242 0 foreach my $key (keys %_S_IS_to_tagpool_ise) {
243 0 my $func = __PACKAGE__->can($key);
244 0 ▶ if (defined $func) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $func) 0 0 0
245 0 ▶ if (eval {$func->($mode)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { &$func($mode) } }) 0 0 0
246 0 $ise = $_S_IS_to_tagpool_ise{$key};
247 0 last;
248 }
249 }
250 }
251 }
252  
253 0 ▶ if (defined $ise) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ise) 0 0 0
254 0 ▶ (($self->{properties_values} //= {})->{current} //= {})->{tagpool_inode_type} = {raw => $ise};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
255 }
256 }
257 3 }, rawtype => 'ise'},
258 }
259  
260 2 ▶sub _new {
Subroutine _new: called CC=2 SCAR=7.0
261 2 my ($pkg, %opts) = @_;
262 2 my $self = $pkg->SUPER::_new(%opts, properties => \%_properties);
263  
264 2 ▶ croak 'No handle is given' unless defined $self->{handle};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"handle"} 0 2 2
265  
266 2 return $self;
267 }
268  
269  
270 #@returns File::Information::Filesystem
271 0 ▶sub filesystem {
Subroutine filesystem: not called CC=4 SCAR=30.0
Pod documented
272 0 my ($self, %opts) = @_;
273 0 ▶ my $filesystem = $self->{filesystem} //= eval {
Condition0%0/3
$self->{"filesystem"} //= eval { do { my $instance = $self->instance; my $st_dev = $self->get("st_dev"); $instance->_filesystem_for($st_dev) } }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"filesystem"} //= eval { do { my $instance = $self->instance; my $st_dev = $self->get("st_dev"); $instance->_filesystem_for($st_dev) } }
$self->{"filesystem"} eval { do { my $instance = $self->instance; my $st_dev = $self->get("st_dev"); $instance->_filesystem_for($st_dev) } }
Truth table0%0/3
A //= B
A= $self->{"filesystem"}B= eval { do { my $instance = $self->instance; my $st_dev = $self->get("st_dev"); $instance->_filesystem_for($st_dev) } }
ABresult
1X1
011
000
274 0 my $instance = $self->instance;
275 0 my $st_dev = $self->get('st_dev');
276 0 $instance->_filesystem_for($st_dev);
277 };
278  
279 0 ▶ return $filesystem if defined $filesystem;
Branch: 1 branch
BranchTrueFalseTotal
if defined $filesystem 0 0 0
280 0 ▶ return $opts{default} if exists $opts{default};
Branch: 1 branch
BranchTrueFalseTotal
if exists $opts{"default"} 0 0 0
281 0 croak 'Cannot locate filesystem for inode';
282 }
283  
284  
285 0 ▶sub tagpool {
Subroutine tagpool: not called CC=4 SCAR=30.0
Pod documented
286 0 my ($self) = @_;
287 0 ▶ my $tagpools = $self->{_tagpools} //= do {
Condition0%0/3
$self->{"_tagpools"} //= do { my $pools = $self->instance->_tagpool; [map({$pools->{$_};} keys %{$self->_tagpool_paths;})] }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"_tagpools"} //= do { my $pools = $self->instance->_tagpool; [map({$pools->{$_};} keys %{$self->_tagpool_paths;})] }
$self->{"_tagpools"} do { my $pools = $self->instance->_tagpool; [map({$pools->{$_};} keys %{$self->_tagpool_paths;})] }
Truth table0%0/3
A //= B
A= $self->{"_tagpools"}B= do { my $pools = $self->instance->_tagpool; [map({$pools->{$_};} keys %{$self->_tagpool_paths;})] }
ABresult
1X1
011
000
288 0 my $pools = $self->instance->_tagpool;
289 0 [map {$pools->{$_}} keys %{$self->_tagpool_paths}]
290 };
291  
292 0 ▶ return wantarray ? @{$tagpools} : ($tagpools->[0] // croak 'Not part of any tagpool');
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
Condition0%0/2
$tagpools->[0] // croak("Not part of any tagpool")
l!l
00
MC/DC0%0/1
$tagpools->[0] // croak("Not part of any tagpool")
$tagpools->[0]
Truth table0%0/2
A
A= $tagpools->[0]
Aresult
11
00
293 }
294  
295  
296 0 ▶sub peek {
Subroutine peek: not called CC=9 SCAR=45.0
Pod documented
297 0 my ($self, %opts) = @_;
298 0 ▶ my $wanted = $opts{wanted} || 0;
Condition0%0/2
$opts{'wanted'} || 0
l!l
00
MC/DC0%0/1
$opts{'wanted'} || 0
$opts{'wanted'}
Truth table0%0/2
A
A= $opts{'wanted'}
Aresult
11
00
299 0 ▶ my $required = $opts{required} || 0;
Condition0%0/2
$opts{'required'} || 0
l!l
00
MC/DC0%0/1
$opts{'required'} || 0
$opts{'required'}
Truth table0%0/2
A
A= $opts{'required'}
Aresult
11
00
300 0 my $buffer;
301  
302 0 ▶ if (defined($self->{_peek_buffer}) && length($self->{_peek_buffer}) >= $required) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_peek_buffer"} and length $self->{"_peek_buffer"} >= $required) 0 0 0
Condition0%0/3
defined $self->{"_peek_buffer"} and length $self->{"_peek_buffer"} >= $required
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"_peek_buffer"} and length $self->{"_peek_buffer"} >= $required
defined $self->{"_peek_buffer"} length $self->{"_peek_buffer"} >= $required
Truth table0%0/3
A and B
A= defined $self->{"_peek_buffer"}B= length $self->{"_peek_buffer"} >= $required
ABresult
0X0
100
111
303 0 return $self->{_peek_buffer};
304 }
305  
306 0 ▶ $wanted = $required if $required > $wanted;
Branch: 1 branch
BranchTrueFalseTotal
if $required > $wanted 0 0 0
307 0 ▶ $wanted = 4096 if $wanted < 4096; # enforce some minimum
Branch: 1 branch
BranchTrueFalseTotal
if $wanted < 4096 0 0 0
308  
309 0 ▶ croak 'Requested peek too big: '.$wanted if $wanted > 65536;
Branch: 1 branch
BranchTrueFalseTotal
if $wanted > 65536 0 0 0
310  
311 0 $self->_get_fh->read($buffer, $wanted);
312  
313 0 ▶ croak 'Cannot peek required amount of data' if length($buffer) < $required;
Branch: 1 branch
BranchTrueFalseTotal
if length $buffer < $required 0 0 0
314  
315 0 return $self->{_peek_buffer} = $buffer;
316 }
317  
318  
319 0 ▶sub open_handle {
Subroutine open_handle: not called CC=8 SCAR=42.8
Pod documented
320 0 my ($self, $mode) = @_;
321 0 my @sa;
322 my @sb;
323  
324 0 ▶ open(my $handle, $mode // '<', $self->{path} // croak 'Open not supported on this object') or croak 'Cannot open inode: '.$!;
Branch: 1 branch
BranchTrueFalseTotal
open my $handle, $mode // "<", $self->{"path"} // croak("Open not supported on this object") or croak('Cannot open inode: ' . $!) 0 0 0
Condition0%0/4
$mode // "<"
l!l
00
$self->{"path"} // croak("Open not supported on this object")
l!l
00
MC/DC0%0/1
$mode // "<"
$mode
MC/DC0%0/1
$self->{"path"} // croak("Open not supported on this object")
$self->{"path"}
Truth table0%0/2
A
A= $mode
Aresult
11
00
Truth table0%0/2
A
A= $self->{"path"}
Aresult
11
00
325  
326 # (Re)stat() late so any effects of the open are taken into account:
327 0 @sa = stat($self->{handle});
328 0 @sb = stat($handle);
329  
330 0 ▶ for (my $i = 0; $i < 13; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 13) 0 0 0
331 0 ▶ my $va = $sa[$i] // '<undef>';
Condition0%0/2
$sa[$i] // "<undef>"
l!l
00
MC/DC0%0/1
$sa[$i] // "<undef>"
$sa[$i]
Truth table0%0/2
A
A= $sa[$i]
Aresult
11
00
332 0 ▶ my $vb = $sb[$i] // '<undef>';
Condition0%0/2
$sb[$i] // "<undef>"
l!l
00
MC/DC0%0/1
$sb[$i] // "<undef>"
$sb[$i]
Truth table0%0/2
A
A= $sb[$i]
Aresult
11
00
333  
334 0 ▶ croak 'Race lost' unless $va eq $vb;
Branch: 1 branch
BranchTrueFalseTotal
unless $va eq $vb 0 0 0
335 }
336  
337 0 return $handle;
338 }
339  
340 # ----------------
341  
342 0 ▶sub _get_fh {
Subroutine _get_fh: not called CC=2 SCAR=17.9
343 0 my ($self) = @_;
344 0 my $fh = $self->{handle};
345  
346 0 ▶ $fh->seek(0, SEEK_SET) or croak $!;
Branch: 1 branch
BranchTrueFalseTotal
$fh->seek(0, 0) or croak($!) 0 0 0
347  
348 0 return $fh;
349 }
350  
351 0 ▶sub _tagpool_paths {
Subroutine _tagpool_paths: not called CC=29 SCAR=67.7
352 0 my ($self) = @_;
353  
354 0 ▶ unless (defined $self->{_tagpool_paths}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_tagpool_paths"}) 0 0 0
355 0 my File::Information $instance = $self->instance;
356 0 my $sysfile_cache = $instance->_tagpool_sysfile_cache;
357 0 my @stat;
358 my %paths;
359 0 my $found;
360  
361 0 ▶ return unless scalar @{$instance->_tagpool_path};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$instance->_tagpool_path;} 0 0 0
362  
363 0 @stat = eval {stat($self->{handle})};
364 0 ▶ return $self->{_tagpool_paths} = {} unless scalar(@stat) && S_ISREG($stat[2]);
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @stat and S_ISREG($stat[2]) 0 0 0
Condition0%0/3
scalar @stat and S_ISREG($stat[2])
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @stat and S_ISREG($stat[2])
scalar @stat S_ISREG($stat[2])
Truth table0%0/3
A and B
A= scalar @statB= S_ISREG($stat[2])
ABresult
0X0
100
111
365  
366 # Try the cache first:
367 {
368 0 my $key = $stat[1].'@'.$stat[0];
369  
370 0 foreach my $pool_path (keys %{$sysfile_cache}) {
371 0 $found = $sysfile_cache->{$pool_path}{$key};
372 0 ▶ if (defined $found) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $found) 0 0 0
373 0 $paths{$pool_path} = $found;
374 }
375 }
376 }
377  
378 # Then guess:
379 0 ▶ unless (defined($found)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $found) 0 0 0
380 0 ▶ if (defined $self->{path}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"path"}) 0 0 0
381 outer:
382 0 foreach my $uuid ($self->{path} =~ /([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})/g) {
383 0 foreach my $pool_path (@{$instance->_tagpool_path}) {
384 0 my $info_path = File::Spec->catdir($pool_path => 'data', 'info.'.$uuid);
385 0 my $info;
386  
387 0 ▶ next unless -f $info_path;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $info_path 0 0 0
388 0 $info = eval {
389 0 my $reader = File::ValueFile::Simple::Reader->new($info_path, supported_formats => [], supported_features => []);
390 0 $reader->read_as_simple_tree;
391 };
392  
393 0 ▶ if (defined($info) && defined($info->{'pool-name-suffix'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info and defined $info->{"pool-name-suffix"}) 0 0 0
Condition0%0/3
defined $info and defined $info->{"pool-name-suffix"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info and defined $info->{"pool-name-suffix"}
defined $info defined $info->{"pool-name-suffix"}
Truth table0%0/3
A and B
A= defined $infoB= defined $info->{"pool-name-suffix"}
ABresult
0X0
100
111
394 0 ▶ my $local_cache = $sysfile_cache->{$pool_path} //= {};
Condition0%0/2
$sysfile_cache->{$pool_path} //= {}
l!l
00
MC/DC0%0/1
$sysfile_cache->{$pool_path} //= {}
$sysfile_cache->{$pool_path}
Truth table0%0/2
A
A= $sysfile_cache->{$pool_path}
Aresult
11
00
395 0 my @c_stat = stat(File::Spec->catfile($pool_path, 'data', $info->{'pool-name-suffix'}));
396  
397 0 ▶ next unless scalar @c_stat;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @c_stat 0 0 0
398  
399 0 $local_cache->{$c_stat[1].'@'.$c_stat[0]} = $info->{'pool-name-suffix'};
400  
401 0 ▶ if ($c_stat[0] eq $stat[0] && $c_stat[1] eq $stat[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]) 0 0 0
Condition0%0/3
$c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]
!ll&&!rl&&r
000
MC/DC0%0/2
$c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]
$c_stat[0] eq $stat[0] $c_stat[1] eq $stat[1]
Truth table0%0/3
A and B
A= $c_stat[0] eq $stat[0]B= $c_stat[1] eq $stat[1]
ABresult
0X0
100
111
402 0 $found = $info->{'pool-name-suffix'};
403 0 $paths{$pool_path} = $found;
404 }
405 }
406 }
407 }
408 }
409 }
410  
411 # Then try the pool:
412 0 ▶ unless (defined($found)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $found) 0 0 0
413 outer:
414 0 foreach my $pool_path (@{$instance->_tagpool_path}) {
415 0 my $data_path = File::Spec->catdir($pool_path => 'data');
416 0 ▶ my $local_cache = $sysfile_cache->{$pool_path} //= {};
Condition0%0/2
$sysfile_cache->{$pool_path} //= {}
l!l
00
MC/DC0%0/1
$sysfile_cache->{$pool_path} //= {}
$sysfile_cache->{$pool_path}
Truth table0%0/2
A
A= $sysfile_cache->{$pool_path}
Aresult
11
00
417  
418 0 ▶ next if $local_cache->{complete};
Branch: 1 branch
BranchTrueFalseTotal
if $local_cache->{"complete"} 0 0 0
419  
420 0 ▶ if (opendir(my $dir, $data_path)) {
Branch: 1 branch
BranchTrueFalseTotal
if (opendir my $dir, $data_path) 0 0 0
421 0 my @c_stat = stat($dir);
422  
423 0 ▶ next if $c_stat[0] ne $stat[0];
Branch: 1 branch
BranchTrueFalseTotal
if $c_stat[0] ne $stat[0] 0 0 0
424  
425 0 ▶ while (my $entry = readdir($dir)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $entry = readdir $dir)) 0 0 0
426 0 ▶ $entry =~ /^file\./ or next; # skip everything that is not a file.* to begin with.
Branch: 1 branch
BranchTrueFalseTotal
$entry =~ /^file\./ or next 0 0 0
427  
428 0 @c_stat = stat(File::Spec->catfile($data_path, $entry));
429 0 ▶ next unless scalar @c_stat;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @c_stat 0 0 0
430  
431 0 $local_cache->{$c_stat[1].'@'.$c_stat[0]} = $entry;
432  
433 0 ▶ if ($c_stat[0] eq $stat[0] && $c_stat[1] eq $stat[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]) 0 0 0
Condition0%0/3
$c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]
!ll&&!rl&&r
000
MC/DC0%0/2
$c_stat[0] eq $stat[0] and $c_stat[1] eq $stat[1]
$c_stat[0] eq $stat[0] $c_stat[1] eq $stat[1]
Truth table0%0/3
A and B
A= $c_stat[0] eq $stat[0]B= $c_stat[1] eq $stat[1]
ABresult
0X0
100
111
434 0 $found = $entry;
435 0 $paths{$pool_path} = $found;
436 }
437 }
438  
439 0 $local_cache->{complete} = 1;
440 }
441 }
442 }
443  
444 0 $self->{_tagpool_paths} = \%paths;
445 }
446  
447 0 return $self->{_tagpool_paths};
448 }
449  
450 2 ▶sub _load_stat {
Subroutine _load_stat: called CC=16 SCAR=30.3
451 2 my ($self, undef, %opts) = @_;
452 2 ▶ if ($opts{lifecycle} eq 'current' && !$self->{_loaded_stat}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"lifecycle"} eq "current" and not $self->{"_loaded_stat"}) 2 0 2
Condition33%1/3
$opts{"lifecycle"} eq "current" and not $self->{"_loaded_stat"}
!ll&&!rl&&r
002
MC/DC0%0/2
$opts{"lifecycle"} eq "current" and not $self->{"_loaded_stat"}
$opts{"lifecycle"} eq "current" not $self->{"_loaded_stat"}
Truth table33%1/3
A and not(B)
A= $opts{"lifecycle"} eq "current"B= not $self->{"_loaded_stat"}
ABresult
0X0
100
111
453 2 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition50%2/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
20
$self->{"properties_values"} //= {}
l!l
20
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table50%1/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table50%1/2
A
A= $self->{"properties_values"}
Aresult
11
00
454 2 my @values = eval {stat($self->{handle})};
455 2 my @keys = qw(st_dev st_ino st_mode st_nlink st_uid st_gid st_rdev st_size st_atime st_mtime st_ctime st_blksize st_blocks);
456  
457 2 ▶ if (scalar @values) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @values) 2 0 2
458 2 ▶ for (my $i = 0; $i < scalar(@keys); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @keys) 26 2 28
459 26 my $value = $values[$i];
460 26 my $key = $keys[$i];
461  
462 26 ▶ next if $key eq ':skip';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq ":skip" 0 26 26
463 26 ▶ next if $value eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $value eq "" 0 26 26
464 26 ▶ next if $value == 0 && ($key eq 'st_ino' || $key eq 'st_rdev' || $key eq 'st_blksize');
Branch: 1 branch
BranchTrueFalseTotal
if $value == 0 and $key eq "st_ino" || $key eq "st_rdev" || $key eq "st_blksize" 2 24 26
Condition77%7/9
$value == 0 and $key eq "st_ino" || $key eq "st_rdev" || $key eq "st_blksize"
!ll&&!rl&&r
2042
$key eq "st_ino" or $key eq "st_rdev" or $key eq "st_blksize"
l!l&&r!l&&!r
204
$key eq "st_ino" or $key eq "st_rdev"
l!l&&r!l&&!r
024
MC/DC50%2/4
$value == 0 and $key eq "st_ino" || $key eq "st_rdev" || $key eq "st_blksize"
$value == 0 $key eq "st_ino" $key eq "st_rdev" $key eq "st_blksize"
Truth table60%3/5
A and B or C or D
A= $value == 0B= $key eq "st_ino"C= $key eq "st_rdev"D= $key eq "st_blksize"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
465 24 ▶ next if $value < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $value < 0 0 24 24
466  
467 24 $pv->{$key} = {raw => $values[$i]};
468 }
469  
470 2 $pv->{stat_readonly} = {raw => !($values[2] & (S_IWUSR|S_IWGRP|S_IWOTH))};
471 2 ▶ $pv->{stat_cachehash} = {raw => $values[1].'@'.$values[0]} if $values[1] > 0 && $values[0] ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $values[1] > 0 and $values[0] ne "" 2 0 2
Condition33%1/3
$values[1] > 0 and $values[0] ne ""
!ll&&!rl&&r
002
MC/DC0%0/2
$values[1] > 0 and $values[0] ne ""
$values[1] > 0 $values[0] ne ""
Truth table33%1/3
A and B
A= $values[1] > 0B= $values[0] ne ""
ABresult
0X0
100
111
472 }
473  
474 2 $self->{_loaded_stat} = 1;
475 }
476 }
477  
478 0 ▶sub _load_contentise {
Subroutine _load_contentise: not called CC=6 SCAR=37.4
479 0 my ($self, $key, %opts) = @_;
480 0 my $lifecycle = $opts{lifecycle};
481 0 ▶ my $pv = ($self->{properties_values} //= {})->{$lifecycle} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{$lifecycle} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{$lifecycle} //= {}
+($self->{"properties_values"} //= {})->{$lifecycle}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{$lifecycle}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
482 0 my $digest_sha_1_160 = $self->digest('sha-1-160', as => 'utag', lifecycle => $lifecycle, default => undef);
483 0 my $digest_sha_3_512 = $self->digest('sha-3-512', as => 'utag', lifecycle => $lifecycle, default => undef);
484  
485 0 ▶ if (defined $digest_sha_3_512) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $digest_sha_3_512) 0 0 0
486 0 my $id = Data::Identifier::Generate->generic(namespace => '66d488c0-3b19-4e6c-856f-79edf2484f37', input => $digest_sha_3_512);
487 0 $pv->{content_sha_3_512_uuid} = {raw => $id->uuid};
488 }
489  
490 0 ▶ if (defined($digest_sha_1_160) && defined($digest_sha_3_512)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $digest_sha_1_160 and defined $digest_sha_3_512) 0 0 0
Condition0%0/3
defined $digest_sha_1_160 and defined $digest_sha_3_512
!ll&&!rl&&r
000
MC/DC0%0/2
defined $digest_sha_1_160 and defined $digest_sha_3_512
defined $digest_sha_1_160 defined $digest_sha_3_512
Truth table0%0/3
A and B
A= defined $digest_sha_1_160B= defined $digest_sha_3_512
ABresult
0X0
100
111
491 0 my $digest = $digest_sha_1_160.' '.$digest_sha_3_512;
492 0 $digest =~ s/^v0 /v0m /;
493 0 my $id = Data::Identifier::Generate->generic(namespace => '66d488c0-3b19-4e6c-856f-79edf2484f37', input => $digest);
494 0 $pv->{content_sha_1_160_sha_3_512_uuid} = {raw => $id->uuid};
495 }
496 }
497  
498 0 ▶sub _load_xattr {
Subroutine _load_xattr: not called CC=22 SCAR=62.3
499 0 my ($self, $key, %opts) = @_;
500 0 my $info = $self->{properties}{$key};
501 0 ▶ my $lifecycle = $info->{lifecycle} // 'current';
Condition0%0/2
$info->{"lifecycle"} // "current"
l!l
00
MC/DC0%0/1
$info->{"lifecycle"} // "current"
$info->{"lifecycle"}
Truth table0%0/2
A
A= $info->{"lifecycle"}
Aresult
11
00
502 0 ▶ my $pv = ($self->{properties_values} //= {})->{$lifecycle} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{$lifecycle} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{$lifecycle} //= {}
+($self->{"properties_values"} //= {})->{$lifecycle}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{$lifecycle}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
503 0 my $value;
504 my $fh;
505  
506 0 ▶ return unless ($opts{lifecycle} // 'current') eq $lifecycle;
Branch: 1 branch
BranchTrueFalseTotal
unless ($opts{"lifecycle"} // "current") eq $lifecycle 0 0 0
Condition0%0/2
$opts{"lifecycle"} // "current"
l!l
00
MC/DC0%0/1
$opts{"lifecycle"} // "current"
$opts{"lifecycle"}
Truth table0%0/2
A
A= $opts{"lifecycle"}
Aresult
11
00
507  
508 0 ▶ croak 'Not supported, requires File::ExtAttr' unless $HAVE_XATTR;
Branch: 1 branch
BranchTrueFalseTotal
unless $HAVE_XATTR 0 0 0
509  
510 0 ▶ $self->{_loaded_xattr} //= {};
Condition0%0/2
$self->{"_loaded_xattr"} //= {}
l!l
00
MC/DC0%0/1
$self->{"_loaded_xattr"} //= {}
$self->{"_loaded_xattr"}
Truth table0%0/2
A
A= $self->{"_loaded_xattr"}
Aresult
11
00
511 0 ▶ return if $self->{_loaded_xattr}{$key};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_xattr"}{$key} 0 0 0
512 0 $self->{_loaded_xattr}{$key} = 1;
513  
514 0 $fh = File::Information::Inode::_DUMMY_FOR_XATTR->new($self->{handle});
515 0 $value = eval {File::ExtAttr::getfattr($fh, $info->{xattr_key})};
516  
517 0 ▶ return unless defined($value) && length($value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and length $value 0 0 0
Condition0%0/3
defined $value and length $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
518  
519 0 $pv->{$key} = {raw => $value};
520  
521 0 ▶ if (defined(my $parts = $info->{parts})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $parts = $info->{"parts"})) 0 0 0
522 0 my @values = split(/\s+/, $value);
523 0 my $out = $pv->{$key};
524  
525 0 ▶ for (my $i = 0; $i < scalar(@{$parts}); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$parts;}) 0 0 0
526 0 ▶ if (defined($values[$i]) && length($values[$i])) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $values[$i] and length $values[$i]) 0 0 0
Condition0%0/3
defined $values[$i] and length $values[$i]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $values[$i] and length $values[$i]
defined $values[$i] length $values[$i]
Truth table0%0/3
A and B
A= defined $values[$i]B= length $values[$i]
ABresult
0X0
100
111
527 0 $out->{$parts->[$i]} = $values[$i];
528 }
529 }
530 0 $out->{rawtype} = 'multipart';
531 }
532  
533 0 ▶ if (defined(my $parsing = $info->{parsing})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $parsing = $info->{"parsing"})) 0 0 0
534 0 ▶ if ($parsing eq 'utag') {
Branch: 1 branch
BranchTrueFalseTotal
if ($parsing eq "utag") 0 0 0
535 0 my $v = $value;
536 0 my %digest;
537 my $given_size;
538  
539 0 $given_size = $self->_set_digest_utag($lifecycle => $v, $given_size);
540  
541 0 ▶ $pv->{xattr_utag_final_file_hash_size} = {raw => $given_size} if defined $given_size;
Branch: 1 branch
BranchTrueFalseTotal
if defined $given_size 0 0 0
542 0 ▶ $self->{digest} //= {};
Condition0%0/2
$self->{"digest"} //= {}
l!l
00
MC/DC0%0/1
$self->{"digest"} //= {}
$self->{"digest"}
Truth table0%0/2
A
A= $self->{"digest"}
Aresult
11
00
543  
544 {
545 0 ▶ my $digests = $self->{digest}{$lifecycle} //= {};
Condition0%0/2
$self->{"digest"}{$lifecycle} //= {}
l!l
00
MC/DC0%0/1
$self->{"digest"}{$lifecycle} //= {}
$self->{"digest"}{$lifecycle}
Truth table0%0/2
A
A= $self->{"digest"}{$lifecycle}
Aresult
11
00
546 0 foreach my $algo (keys %digest) {
547 0 ▶ $digests->{$algo} //= $digest{$algo};
Condition0%0/3
$digests->{$algo} //= $digest{$algo}
l!l&&r!l&&!r
000
MC/DC0%0/2
$digests->{$algo} //= $digest{$algo}
$digests->{$algo} $digest{$algo}
Truth table0%0/3
A //= B
A= $digests->{$algo}B= $digest{$algo}
ABresult
1X1
011
000
548 }
549 }
550 }
551 }
552 }
553  
554 # Bad workaround for File::ExtAttr
555 3 package File::Information::Inode::_DUMMY_FOR_XATTR {
556 0 ▶ sub new {
Subroutine new: not called CC=1 SCAR=6.9
557 0 my ($pkg, $fh) = @_;
558 0 return bless \$fh;
559 }
560 0 ▶ sub isa {
Subroutine isa: not called CC=2 SCAR=17.9
561 0 my ($self, $pkg) = @_;
562 0 ▶ return 1 if $pkg eq 'IO::Handle';
Branch: 1 branch
BranchTrueFalseTotal
if $pkg eq "IO::Handle" 0 0 0
563 0 return $self->SUPER::isa($pkg);
564 }
565 0 ▶ sub fileno {
Subroutine fileno: not called CC=1 SCAR=6.9
566 0 my ($self) = @_;
567 0 return ${$self}->fileno;
568 }
569 }
570  
571 0 ▶sub _load_tagpool_directory {
Subroutine _load_tagpool_directory: not called CC=34 SCAR=70.8
572 0 my ($self) = @_;
573 0 ▶ my $pv = $self->{properties_values} //= {};
Condition0%0/2
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
574 0 my $tree;
575  
576 0 ▶ return if $self->{_loaded_tagpool_directory};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_tagpool_directory"} 0 0 0
577 0 $self->{_loaded_tagpool_directory} = 1;
578  
579 0 eval {
580 0 my @stat = stat($self->{handle});
581  
582 0 ▶ if (scalar(@stat) && S_ISDIR($stat[2])) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @stat and S_ISDIR($stat[2])) 0 0 0
Condition0%0/3
scalar @stat and S_ISDIR($stat[2])
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @stat and S_ISDIR($stat[2])
scalar @stat S_ISDIR($stat[2])
Truth table0%0/3
A and B
A= scalar @statB= S_ISDIR($stat[2])
ABresult
0X0
100
111
583 0 ▶ my $c = $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
584 0 $c->{tagpool_directory_timestamp} = {raw => time()};
585  
586 0 $c->{tagpool_directory_inode} = {raw => $stat[1]};
587 0 $c->{tagpool_directory_mtime} = {raw => $stat[9]};
588 }
589 };
590  
591 0 ▶ return unless defined $self->{path};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"path"} 0 0 0
592 0 ▶ return unless $HAVE_FILE_VALUEFILE;
Branch: 1 branch
BranchTrueFalseTotal
unless $HAVE_FILE_VALUEFILE 0 0 0
593  
594 0 eval {
595 0 my $path = File::Spec->catfile($self->{path}, '.tagpool-info', 'directory');
596 0 my $reader = File::ValueFile::Simple::Reader->new($path, supported_formats => '11431b85-41cd-4be5-8d88-a769ebbd603f', supported_features => []);
597 0 $tree = $reader->read_as_simple_tree;
598 };
599  
600 0 ▶ if (defined $tree) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tree) 0 0 0
601 0 foreach my $key (qw(title comment description)) {
602 0 my $value = $tree->{$key};
603 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
604 0 ▶ $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
605 0 $pv->{current}{'tagpool_directory_'.$key} = {raw => $value};
606 }
607 }
608  
609 0 foreach my $key (qw(inode mtime pool-uuid timestamp)) {
610 0 foreach my $lifecycle (qw(initial last)) {
611 0 my $value = $tree->{$lifecycle.'-'.$key};
612 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
613 0 ▶ my $c = $pv->{$lifecycle} //= {};
Condition0%0/2
$pv->{$lifecycle} //= {}
l!l
00
MC/DC0%0/1
$pv->{$lifecycle} //= {}
$pv->{$lifecycle}
Truth table0%0/2
A
A= $pv->{$lifecycle}
Aresult
11
00
614  
615 0 $c->{'tagpool_directory_'.($key =~ tr/-/_/r)} = {raw => $value};
616 }
617 }
618 }
619  
620 0 ▶ if (defined(my $setting = $tree->{'directory-setting'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $setting = $tree->{"directory-setting"})) 0 0 0
621 0 foreach my $key (qw(thumbnail-uri thumbnail-mode update-mode add-mode file-tags tag-mode tag-implies entry-sort-order tag tag-root tag-parent tag-type entry-display-name entry-sort-key)) {
622 0 my $value = $setting->{$key};
623 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
624 0 my $val = {raw => $value};
625 0 ▶ $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
626 0 $pv->{current}{'tagpool_directory_setting_'.($key =~ tr/-/_/r)} = $val;
627  
628 # Add ise if known:
629 0 ▶ if (defined(my $info = $_tagpool_directory_setting_tagmap{$key})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $info = $_tagpool_directory_setting_tagmap{$key})) 0 0 0
630 0 ▶ if (defined(my $entry = $info->{$value})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $entry = $info->{$value})) 0 0 0
631 0 $val->{ise} = $entry->{ise};
632 }
633 }
634 }
635 }
636 }
637  
638 0 ▶ if (defined(my $option = $tree->{'throw-option'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $option = $tree->{"throw-option"})) 0 0 0
639 0 foreach my $key (qw(linkname linktype filter)) {
640 0 my $value = $option->{$key};
641 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
642 0 ▶ $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
643 0 $pv->{current}{'tagpool_directory_throw_option_'.$key} = {raw => $value};
644 }
645 }
646 }
647 }
648 }
649  
650 8 ▶sub _load_tagpool_file {
Subroutine _load_tagpool_file: called CC=49 SCAR=75.7
651 8 my ($self) = @_;
652 8 my File::Information $instance = $self->instance;
653 8 my $sysfile_cache = $instance->_tagpool_sysfile_cache;
654 8 ▶ my $pv = $self->{properties_values} //= {};
Condition50%1/2
$self->{"properties_values"} //= {}
l!l
80
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table50%1/2
A
A= $self->{"properties_values"}
Aresult
11
00
655 8 my @stat;
656 my $found;
657 8 my $in_pool;
658  
659 8 ▶ return if $self->{_loaded_tagpool_file};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_tagpool_file"} 6 2 8
660 2 $self->{_loaded_tagpool_file} = 1;
661  
662 2 ▶ return unless scalar @{$instance->_tagpool_path};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$instance->_tagpool_path;} 2 0 2
663  
664 0 @stat = eval {stat($self->{handle})};
665 0 ▶ return unless scalar(@stat) && S_ISREG($stat[2]);
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @stat and S_ISREG($stat[2]) 0 0 0
Condition0%0/3
scalar @stat and S_ISREG($stat[2])
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @stat and S_ISREG($stat[2])
scalar @stat S_ISREG($stat[2])
Truth table0%0/3
A and B
A= scalar @statB= S_ISREG($stat[2])
ABresult
0X0
100
111
666  
667 {
668 0 ▶ my $c = $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
669 0 $c->{tagpool_file_timestamp} = {raw => time()};
670  
671 0 $c->{tagpool_file_inode} = {raw => $stat[1]};
672 0 $c->{tagpool_file_size} = {raw => $stat[7]};
673 0 $c->{tagpool_file_mtime} = {raw => $stat[9]};
674 }
675  
676 # Try to find the file:
677 0 ($in_pool, $found) = %{$self->_tagpool_paths};
678  
679 0 ▶ return unless defined($in_pool) && defined($found);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $in_pool and defined $found 0 0 0
Condition0%0/3
defined $in_pool and defined $found
!ll&&!rl&&r
000
MC/DC0%0/2
defined $in_pool and defined $found
defined $in_pool defined $found
Truth table0%0/3
A and B
A= defined $in_poolB= defined $found
ABresult
0X0
100
111
680  
681 0 ▶ if ($found =~ /^file\.([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})(?:\..*)?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($found =~ /^file\.([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})(?:\..*)?$/) 0 0 0
682 0 my $uuid = $1;
683 0 my $info = eval {
684 0 my $path = File::Spec->catfile($in_pool, 'data' => 'info.'.$uuid);
685 0 my $reader = File::ValueFile::Simple::Reader->new($path, supported_formats => [], supported_features => []);
686 0 $reader->read_as_simple_tree;
687 };
688 0 my $tags = eval {
689 0 my $path = File::Spec->catfile($in_pool, 'data' => 'tags.'.$uuid);
690 0 my $reader = File::ValueFile::Simple::Reader->new($path, supported_formats => [], supported_features => []);
691 0 $reader->read_as_hash_of_arrays;
692 };
693 0 ▶ if (defined($info) && defined($tags)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info and defined $tags) 0 0 0
Condition0%0/3
defined $info and defined $tags
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info and defined $tags
defined $info defined $tags
Truth table0%0/3
A and B
A= defined $infoB= defined $tags
ABresult
0X0
100
111
694 0 ▶ $pv->{current} //= {};
Condition0%0/2
$pv->{"current"} //= {}
l!l
00
MC/DC0%0/1
$pv->{"current"} //= {}
$pv->{"current"}
Truth table0%0/2
A
A= $pv->{"current"}
Aresult
11
00
695 0 $pv->{current}{tagpool_file_uuid} = {raw => $uuid};
696  
697 0 foreach my $key (qw(title comment description original-url original-description-url pool-name-suffix original-filename)) {
698 0 my $value = $info->{$key};
699 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
700 0 $pv->{current}{'tagpool_file_'.($key =~ tr/-/_/r)} = {raw => $value};
701 }
702 }
703  
704 0 foreach my $key (qw(mtime timestamp inode size actual-size)) {
705 0 foreach my $lifecycle (qw(initial last final)) {
706 0 my $value = $info->{$lifecycle.'-'.$key};
707 0 ▶ if (defined($value) && !ref($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 0 0 0
Condition0%0/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
000
defined $value and not ref $value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table0%0/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
708 0 ▶ my $c = $pv->{$lifecycle} //= {};
Condition0%0/2
$pv->{$lifecycle} //= {}
l!l
00
MC/DC0%0/1
$pv->{$lifecycle} //= {}
$pv->{$lifecycle}
Truth table0%0/2
A
A= $pv->{$lifecycle}
Aresult
11
00
709  
710 0 $c->{'tagpool_file_'.($key =~ tr/-/_/r)} = {raw => $value};
711 }
712 }
713 }
714  
715 # Digest:
716 0 foreach my $key (keys %{$info}) {
717 0 ▶ if (my ($lifecycle, $tagpool_name) = $key =~ /^(initial|last|final)-hash-(.+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $key =~ /^(initial|last|final)-hash-(.+)$/) 0 0 0
718 0 ▶ my $utag_name = $File::Information::Base::_digest_name_converter{$tagpool_name} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $utag_name = $File::Information::Base::_digest_name_converter{$tagpool_name} or next 0 0 0
719 0 my $value = $info->{$key};
720 0 ▶ my ($size) = $utag_name =~ /-([0-9]+)$/ or next;
Branch: 1 branch
BranchTrueFalseTotal
my($size) = $utag_name =~ /-([0-9]+)$/ or next 0 0 0
721  
722 0 ▶ next unless $value =~ /^[0-9a-f]+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /^[0-9a-f]+$/ 0 0 0
723 0 ▶ next unless length($value) == ($size / 4);
Branch: 1 branch
BranchTrueFalseTotal
unless length $value == $size / 4 0 0 0
724 0 ▶ $self->{digest} //= {};
Condition0%0/2
$self->{"digest"} //= {}
l!l
00
MC/DC0%0/1
$self->{"digest"} //= {}
$self->{"digest"}
Truth table0%0/2
A
A= $self->{"digest"}
Aresult
11
00
725 0 ▶ $self->{digest}{$lifecycle} //= {};
Condition0%0/2
$self->{"digest"}{$lifecycle} //= {}
l!l
00
MC/DC0%0/1
$self->{"digest"}{$lifecycle} //= {}
$self->{"digest"}{$lifecycle}
Truth table0%0/2
A
A= $self->{"digest"}{$lifecycle}
Aresult
11
00
726 0 $self->{digest}{$lifecycle}{$utag_name} = $value;
727 }
728 }
729  
730 # Tags:
731 {
732 0 ▶ my @next = @{$tags->{'tagged-as'} // []};
Condition0%0/2
$tags->{"tagged-as"} // []
l!l
00
MC/DC0%0/1
$tags->{"tagged-as"} // []
$tags->{"tagged-as"}
Truth table0%0/2
A
A= $tags->{"tagged-as"}
Aresult
11
00
733  
734 0 $pv->{current}{tagpool_file_tags} = [map {{raw => $_}} @next];
735  
736 0 ▶ while (scalar(@next)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @next) 0 0 0
737 0 my @current = @next;
738 0 @next = ();
739  
740 0 foreach my $tag (@current) {
741 0 my $info = $_wk_tagged_as_tags{$tag};
742 0 ▶ next unless defined($info) && defined($info->{for});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $info and defined $info->{"for"} 0 0 0
Condition0%0/3
defined $info and defined $info->{"for"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info and defined $info->{"for"}
defined $info defined $info->{"for"}
Truth table0%0/3
A and B
A= defined $infoB= defined $info->{"for"}
ABresult
0X0
100
111
743  
744 0 ▶ if ($info->{for} eq 'write-mode') {
Branch: 3 branches
BranchTrueFalseTotal
if ($info->{'for'} eq 'write-mode') { } 0 0 0
elsif ($info->{'for'} eq 'mediatype') { } 0 0 0
elsif ($info->{'for'} eq 'finalmode') { } 0 0 0
745 0 $pv->{current}{tagpool_file_write_mode} = {raw => $tag};
746 } elsif ($info->{for} eq 'mediatype') {
747 0 $pv->{current}{tagpool_file_mediatype} = {raw => $info->{mediatype}, ise => $tag};
748 } elsif ($info->{for} eq 'finalmode') {
749 0 $pv->{current}{tagpool_file_finalmode} = {raw => $tag};
750 } else {
751 0 croak 'BUG!';
752 }
753  
754 0 ▶ push(@next, @{$info->{implies}}) if defined $info->{implies};
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"implies"} 0 0 0
755 }
756 }
757 }
758  
759 # Media Type:
760 {
761 0 my $value = readlink(File::Spec->catfile($in_pool, qw(cache mimetype file), $uuid));
762 0 ▶ if (defined($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and length $value) 0 0 0
Condition0%0/3
defined $value and length $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
763 0 ▶ $pv->{current}{tagpool_file_mediatype} //= {raw => $value};
Condition0%0/2
$pv->{"current"}{"tagpool_file_mediatype"} //= {"raw", $value}
l!l
00
MC/DC0%0/1
$pv->{"current"}{"tagpool_file_mediatype"} //= {"raw", $value}
$pv->{"current"}{"tagpool_file_mediatype"}
Truth table0%0/2
A
A= $pv->{"current"}{"tagpool_file_mediatype"}
Aresult
11
00
764 }
765 }
766  
767 # Write mode:
768 {
769 0 my $value = readlink(File::Spec->catfile($in_pool, qw(cache write-mode file), $uuid));
770 0 ▶ if (defined($value) && length($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and length $value) 0 0 0
Condition0%0/3
defined $value and length $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
771 0 ▶ $pv->{current}{tagpool_file_write_mode} //= {raw => $value};
Condition0%0/2
$pv->{"current"}{"tagpool_file_write_mode"} //= {"raw", $value}
l!l
00
MC/DC0%0/1
$pv->{"current"}{"tagpool_file_write_mode"} //= {"raw", $value}
$pv->{"current"}{"tagpool_file_write_mode"}
Truth table0%0/2
A
A= $pv->{"current"}{"tagpool_file_write_mode"}
Aresult
11
00
772 }
773 }
774  
775 {
776 0 my $value = File::Spec->catfile($in_pool, qw(cache thumbnail file), $uuid.'.png');
777 0 my @c_stat = stat($value);
778 0 ▶ if (scalar(@c_stat)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @c_stat) 0 0 0
779 0 ▶ if ($stat[9] < $c_stat[9]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stat[9] < $c_stat[9]) 0 0 0
780 0 ▶ $pv->{current}{tagpool_file_thumbnail} //= {raw => $value};
Condition0%0/2
$pv->{"current"}{"tagpool_file_thumbnail"} //= {"raw", $value}
l!l
00
MC/DC0%0/1
$pv->{"current"}{"tagpool_file_thumbnail"} //= {"raw", $value}
$pv->{"current"}{"tagpool_file_thumbnail"}
Truth table0%0/2
A
A= $pv->{"current"}{"tagpool_file_thumbnail"}
Aresult
11
00
781 }
782 }
783 }
784 }
785 }
786 }
787  
788 0 ▶sub _load_magic {
Subroutine _load_magic: not called CC=23 SCAR=63.1
789 0 my ($self) = @_;
790 0 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
791 0 my $data;
792 my $media_type;
793  
794 0 ▶ return if $self->{_loaded_magic};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_magic"} 0 0 0
795 0 $self->{_loaded_magic} = 1;
796  
797 0 $data = eval {$self->peek};
798  
799 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
800  
801 0 ▶ if (substr($data, 0, 22) eq '<!DOCTYPE HTML PUBLIC ' || substr($data, 0, 22) eq '<!DOCTYPE html PUBLIC ' || substr($data, 0, 22) eq '<!DOCTYPE HTML SYSTEM ' || uc(substr($data, 0, 15)) eq '<!DOCTYPE HTML>' ||
Branch: 7 branches
BranchTrueFalseTotal
if (substr($data, 0, 22) eq '<!DOCTYPE HTML PUBLIC ' or substr($data, 0, 22) eq '<!DOCTYPE html PUBLIC ' or substr($data, 0, 22) eq '<!DOCTYPE HTML SYSTEM ' or uc substr($data, 0, 15) eq '<!DOCTYPE HTML>' or lc substr($data, 0, 6) eq '<html>' or $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /) { } 0 0 0
elsif ($data =~ m[^<\?xml version="1\.0" encoding="UTF-8"\?>\s*<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1\.0"[^>]+office:mimetype="(application/vnd\.oasis\.opendocument\.(?:text|spreadsheet|presentation|graphics|chart|formula|image|text-master|(?:text|spreadsheet|presentation|graphics)-template))"[^>]*>]) { } 0 0 0
elsif ($data =~ m[^PK\003\004....\0\0................\010\0\0\0mimetype(application/vnd\.oasis\.opendocument\.(?:text|spreadsheet|presentation|graphics|chart|formula|image|text-master|(?:text|spreadsheet|presentation|graphics)-template))PK\003\004]s) { } 0 0 0
elsif (substr($data, 0, 8) eq "!<arch>\n") { } 0 0 0
elsif ($data =~ /^!!ValueFile ([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\s+(!null|[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}|[0-2](?:\.(?:0|[1-9][0-9]*))+|[a-zA-Z][a-zA-Z0-9\+\.\-]+[^\s%]+)[\s\r\n]/) { } 0 0 0
elsif ($data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/ and (ord $1 & 7) == 7) { } 0 0 0
elsif ($data =~ /^RIFF.{4}WEBPVP8/s) { } 0 0 0
Condition0%0/15
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM " or uc substr($data, 0, 15) eq "<!DOCTYPE HTML>" or lc substr($data, 0, 6) eq "<html>" or $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /
l!l&&r!l&&!r
000
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM " or uc substr($data, 0, 15) eq "<!DOCTYPE HTML>" or lc substr($data, 0, 6) eq "<html>"
l!l&&r!l&&!r
000
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM " or uc substr($data, 0, 15) eq "<!DOCTYPE HTML>"
l!l&&r!l&&!r
000
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM "
l!l&&r!l&&!r
000
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC "
l!l&&r!l&&!r
000
MC/DC0%0/6
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " or substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM " or uc substr($data, 0, 15) eq "<!DOCTYPE HTML>" or lc substr($data, 0, 6) eq "<html>" or $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /
substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC " substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC " substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM " uc substr($data, 0, 15) eq "<!DOCTYPE HTML>" lc substr($data, 0, 6) eq "<html>" $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /
Truth table0%0/7
A or B or C or D or E or F
A= substr($data, 0, 22) eq "<!DOCTYPE HTML PUBLIC "B= substr($data, 0, 22) eq "<!DOCTYPE html PUBLIC "C= substr($data, 0, 22) eq "<!DOCTYPE HTML SYSTEM "D= uc substr($data, 0, 15) eq "<!DOCTYPE HTML>"E= lc substr($data, 0, 6) eq "<html>"F= $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
802 lc(substr($data, 0, 6)) eq '<html>' ||
803 $data =~ /^<\?xml version="1\.0" encoding="utf-8"\?>\r?\n?<\!DOCTYPE html PUBLIC /) {
804 0 $media_type = 'text/html';
805 } elsif ($data =~ /^<\?xml version="1\.0" encoding="UTF-8"\?>\s*<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1\.0"[^>]+office:mimetype="(application\/vnd\.oasis\.opendocument\.(?:text|spreadsheet|presentation|graphics|chart|formula|image|text-master|(?:text|spreadsheet|presentation|graphics)-template))"[^>]*>/) {
806 0 $media_type = $1;
807 } elsif ($data =~ /^PK\003\004....\0\0................\010\0\0\0mimetype(application\/vnd\.oasis\.opendocument\.(?:text|spreadsheet|presentation|graphics|chart|formula|image|text-master|(?:text|spreadsheet|presentation|graphics)-template))PK\003\004/s) {
808 0 $media_type = $1;
809 } elsif (substr($data, 0, 8) eq "!<arch>\n") {
810 0 ▶ if ($data =~ /^!<arch>\ndebian-binary [0-9 ]{12}0 0 [0-7 ]{8}[0-9] `\n/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data =~ /^!<arch>\ndebian-binary [0-9 ]{12}0 0 [0-7 ]{8}[0-9] `\n/) { } 0 0 0
811 0 $media_type = 'application/vnd.debian.binary-package';
812 } else {
813 0 $media_type = 'application/x-archive';
814 }
815 } elsif ($data =~ /^!!ValueFile ([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\s+(!null|[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}|[0-2](?:\.(?:0|[1-9][0-9]*))+|[a-zA-Z][a-zA-Z0-9\+\.\-]+[^\s%]+)[\s\r\n]/) {
816 0 my ($version, $format) = ($1, $2);
817 0 $pv->{magic_valuefile_version} = {raw => $version};
818 0 ▶ $pv->{magic_valuefile_format} = {raw => $format} unless $format =~ /^!/;
Branch: 1 branch
BranchTrueFalseTotal
unless $format =~ /^!/ 0 0 0
819 ▶ } elsif ($data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/ && (ord($1) & 07) == 07) {
Condition0%0/3
$data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/ and (ord $1 & 7) == 7
!ll&&!rl&&r
000
MC/DC0%0/2
$data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/ and (ord $1 & 7) == 7
$data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/ (ord $1 & 7) == 7
Truth table0%0/3
A and B
A= $data =~ /^\0([\x07-\x3f])VM\x0d\x0a\xc0\x0a/B= (ord $1 & 7) == 7
ABresult
0X0
100
111
820 0 $media_type = 'application/vnd.sirtx.vmv0';
821 } elsif ($data =~ /^RIFF.{4}WEBPVP8/s) {
822 0 $media_type = 'image/webp';
823 } else {
824 0 foreach my $magic (sort {length($b) <=> length($a)} keys %_magic_map) {
825 0 ▶ if (substr($data, 0, length($magic)) eq $magic) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($data, 0, length $magic) eq $magic) 0 0 0
826 0 $media_type = $_magic_map{$magic};
827 0 last;
828 }
829 }
830 }
831  
832 0 ▶ $pv->{magic_mediatype} = {raw => $media_type} if defined $media_type;
Branch: 1 branch
BranchTrueFalseTotal
if defined $media_type 0 0 0
833 }
834  
835 0 ▶sub _load_db {
Subroutine _load_db: not called CC=6 SCAR=37.4
836 0 my ($self, $key, %opts) = @_;
837 0 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
838  
839 0 ▶ return if $self->{_loaded_db};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_db"} 0 0 0
840 0 $self->{_loaded_db} = 1;
841  
842 0 ▶ if (defined(my $db = eval { $self->instance->db })) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $db = eval { do { $self->instance->db } })) 0 0 0
843 0 eval {
844 0 my $inode = $self->get('st_ino', as => 'raw');
845 0 my $fs = $self->filesystem->get('ise', as => 'Data::TagDB::Tag');
846 0 my $inode_number = $db->tag_by_id(uuid => 'd2526d8b-25fa-4584-806b-67277c01c0db');
847 0 my $also_on_filesystem = $db->tag_by_id(uuid => 'cd5bfb11-620b-4cce-92bd-85b7d010f070');
848 0 my $wk = $db->wk;
849 0 my $metadata = $db->metadata(relation => $wk->also_shares_identifier, type => $inode_number, data_raw => $inode);
850 0 my $res;
851  
852 #warn sprintf('inode=%s, inode_number=%s, fs=%s', $inode, $inode_number, $fs);
853 0 ▶ $metadata->foreach(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
854 0 my ($entry) = @_;
855 0 my $fs_relation = $db->relation(tag => $entry->tag, relation => $also_on_filesystem, related => $fs)->one;
856 0 $res = $entry->tag;
857 #warn $fs_relation;
858 0 });
859  
860 0 ▶ $pv->{db_inode_tag} = {raw => $res} if defined $res;
Branch: 1 branch
BranchTrueFalseTotal
if defined $res 0 0 0
861 };
862 }
863 }
864  
865 0 ▶sub _load_redirect {
Subroutine _load_redirect: not called CC=1 SCAR=6.9
866 0 my ($self, $key, %opts) = @_;
867 0 my $info = $self->{properties}{$key};
868  
869 0 $self->get($info->{redirect}, lifecycle => $opts{lifecycle}, default => undef, as => 'raw');
870 }
871  
872 0 ▶sub _load_zonetransfer {
Subroutine _load_zonetransfer: not called CC=17 SCAR=57.2
873 0 my ($self, $key, %opts) = @_;
874 0 my $info = $self->{properties}{$key};
875 0 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
876 0 my $raw;
877 my $parsed;
878  
879 0 ▶ return if $self->{_loaded_zonetransfer};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_zonetransfer"} 0 0 0
880 0 $self->{_loaded_zonetransfer} = 1;
881  
882 0 ▶ if ($HAVE_XATTR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_XATTR) 0 0 0
883 0 my $fh = File::Information::Inode::_DUMMY_FOR_XATTR->new($self->{handle});
884 0 $raw = eval {File::ExtAttr::getfattr($fh, 'Zone.Identifier')};
885 }
886  
887 0 ▶ if (!defined($raw) && $^O eq 'MSWin32' && defined($self->{path})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $raw and $^O eq "MSWin32" and defined $self->{"path"}) 0 0 0
Condition0%0/6
not defined $raw and $^O eq "MSWin32" and defined $self->{"path"}
!ll&&!rl&&r
000
not defined $raw and $^O eq "MSWin32"
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $raw and $^O eq "MSWin32" and defined $self->{"path"}
not defined $raw $^O eq "MSWin32" defined $self->{"path"}
Truth table0%0/4
not(A) and B and C
A= not defined $rawB= $^O eq "MSWin32"C= defined $self->{"path"}
ABCresult
0XX0
10X0
1100
1111
888 0 ▶ if (open(my $ads, '<', sprintf('%s:Zone.Identifier', $self->{path}))) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $ads, "<", sprintf('%s:Zone.Identifier', $self->{"path"})) 0 0 0
889 0 local $/ = undef;
890 0 $raw = <$ads>;
891 0 close($ads);
892 }
893 }
894  
895 0 ▶ return unless defined $raw;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $raw 0 0 0
896  
897 0 $parsed = Config::INI::Reader->read_string($raw);
898  
899 0 ▶ if (defined(my $ZoneTransfer = $parsed->{ZoneTransfer})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $ZoneTransfer = $parsed->{"ZoneTransfer"})) 0 0 0
900 0 foreach my $key (qw(HostIpAddress ZoneId ReferrerUrl HostUrl)) {
901 0 my $value = $ZoneTransfer->{$key};
902  
903 0 ▶ next unless defined($value) && length($value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and length $value 0 0 0
Condition0%0/3
defined $value and length $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
904  
905 0 $pv->{'zonetransfer_'.lc($key)} = {raw => $value};
906  
907 0 ▶ if ($key eq 'ZoneId' && defined(my $zone = $_URLZONE{$value})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "ZoneId" and defined(my $zone = $_URLZONE{$value})) 0 0 0
Condition0%0/3
$key eq "ZoneId" and defined(my $zone = $_URLZONE{$value})
!ll&&!rl&&r
000
MC/DC0%0/2
$key eq "ZoneId" and defined(my $zone = $_URLZONE{$value})
$key eq "ZoneId" defined(my $zone = $_URLZONE{$value})
Truth table0%0/3
A and B
A= $key eq "ZoneId"B= defined(my $zone = $_URLZONE{$value})
ABresult
0X0
100
111
908 0 ▶ $pv->{'zonetransfer_'.lc($key)}{ise} //= $zone->{ise};
Condition0%0/3
$$pv{'zonetransfer_' . lc($key)}{"ise"} //= $zone->{"ise"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$$pv{'zonetransfer_' . lc($key)}{"ise"} //= $zone->{"ise"}
$$pv{'zonetransfer_' . lc($key)}{"ise"} $zone->{"ise"}
Truth table0%0/3
A //= B
A= $$pv{'zonetransfer_' . lc($key)}{"ise"}B= $zone->{"ise"}
ABresult
1X1
011
000
909 }
910 }
911 }
912 }
913  
914 0 ▶sub _load_ntfs_xattr {
Subroutine _load_ntfs_xattr: not called CC=8 SCAR=42.8
915 0 my ($self, $key, %opts) = @_;
916 0 my $info = $self->{properties}{$key};
917 0 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
918 0 my $attrb;
919  
920 0 ▶ return if $self->{_loaded_ntfs_xattr};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_ntfs_xattr"} 0 0 0
921 0 $self->{_loaded_ntfs_xattr} = 1;
922  
923 0 ▶ if ($HAVE_XATTR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_XATTR) 0 0 0
924 0 my $fh = File::Information::Inode::_DUMMY_FOR_XATTR->new($self->{handle});
925 0 my $raw = eval {File::ExtAttr::getfattr($fh, 'ntfs_attrib_be', {namespace => 'system'})};
926 0 ▶ $attrb = unpack('N', $raw) if defined $raw;
Branch: 1 branch
BranchTrueFalseTotal
if defined $raw 0 0 0
927 }
928  
929 0 ▶ if (defined $attrb) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attrb) 0 0 0
930 0 foreach my $key (keys %_ntfs_attributes) {
931 0 $pv->{'ntfs_'.lc($key)} = {raw => ($attrb & $_ntfs_attributes{$key})};
932 }
933 }
934 }
935  
936 4 ▶sub _load_fstore {
Subroutine _load_fstore: called CC=19 SCAR=51.4
937 4 my ($self, $key, %opts) = @_;
938 4 my $dev;
939 my $inode;
940 4 my @candidates;
941  
942 4 ▶ return if $self->{_loaded_fstore};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_fstore"} 2 2 4
943 2 $self->{_loaded_fstore} = 1;
944  
945 2 $dev = $self->get('st_dev', default => undef);
946 2 $inode = $self->get('st_ino', default => undef);
947  
948 2 ▶ return unless defined($dev) && defined($inode);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dev and defined $inode 0 2 2
Condition33%1/3
defined $dev and defined $inode
!ll&&!rl&&r
002
MC/DC0%0/2
defined $dev and defined $inode
defined $dev defined $inode
Truth table33%1/3
A and B
A= defined $devB= defined $inode
ABresult
0X0
100
111
949  
950 2 foreach my $store ($self->instance->store(as => 'File::FStore')) {
951 0 foreach my $candidate ($store->query(properties => inode => $inode)) {
952 0 my @stat = $candidate->stat;
953  
954 0 ▶ if (defined($stat[0]) && length($stat[0]) && $stat[0] != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stat[0] and length $stat[0] and $stat[0] != 0) 0 0 0
Condition0%0/6
defined $stat[0] and length $stat[0] and $stat[0] != 0
!ll&&!rl&&r
000
defined $stat[0] and length $stat[0]
!ll&&!rl&&r
000
MC/DC0%0/3
defined $stat[0] and length $stat[0] and $stat[0] != 0
defined $stat[0] length $stat[0] $stat[0] != 0
Truth table0%0/4
A and B and C
A= defined $stat[0]B= length $stat[0]C= $stat[0] != 0
ABCresult
0XX0
10X0
1100
1111
955 0 ▶ if (defined($stat[1]) && length($stat[1]) && $stat[1] > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stat[1] and length $stat[1] and $stat[1] > 0) 0 0 0
Condition0%0/6
defined $stat[1] and length $stat[1] and $stat[1] > 0
!ll&&!rl&&r
000
defined $stat[1] and length $stat[1]
!ll&&!rl&&r
000
MC/DC0%0/3
defined $stat[1] and length $stat[1] and $stat[1] > 0
defined $stat[1] length $stat[1] $stat[1] > 0
Truth table0%0/4
A and B and C
A= defined $stat[1]B= length $stat[1]C= $stat[1] > 0
ABCresult
0XX0
10X0
1100
1111
956 0 ▶ if ($stat[0] == $dev && $stat[1] == $inode) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stat[0] == $dev and $stat[1] == $inode) 0 0 0
Condition0%0/3
$stat[0] == $dev and $stat[1] == $inode
!ll&&!rl&&r
000
MC/DC0%0/2
$stat[0] == $dev and $stat[1] == $inode
$stat[0] == $dev $stat[1] == $inode
Truth table0%0/3
A and B
A= $stat[0] == $devB= $stat[1] == $inode
ABresult
0X0
100
111
957 0 push(@candidates, $candidate);
958 }
959 }
960 }
961 }
962 }
963  
964 2 ▶ if (scalar(@candidates)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @candidates) 0 2 2
965 0 ▶ my $pv_current = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
966 0 ▶ my $pv_final = ($self->{properties_values} //= {})->{final} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"final"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"final"} //= {}
+($self->{"properties_values"} //= {})->{"final"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"final"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
967  
968 0 $pv_current->{store_file} = [map {{raw => $_}} @candidates];
969 0 $pv_final->{store_file} = [map {{raw => $_}} @candidates];
970 }
971 }
972  
973 0 ▶sub _load_shebang {
Subroutine _load_shebang: not called CC=9 SCAR=45.0
974 0 my ($self, $key, %opts) = @_;
975 0 ▶ my $pv = ($self->{properties_values} //= {})->{current} //= {};
Condition0%0/4
+($self->{"properties_values"} //= {})->{"current"} //= {}
l!l
00
$self->{"properties_values"} //= {}
l!l
00
MC/DC0%0/1
+($self->{"properties_values"} //= {})->{"current"} //= {}
+($self->{"properties_values"} //= {})->{"current"}
MC/DC0%0/1
$self->{"properties_values"} //= {}
$self->{"properties_values"}
Truth table0%0/2
A
A= +($self->{"properties_values"} //= {})->{"current"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"properties_values"}
Aresult
11
00
976  
977 0 ▶ return if $self->{_loaded_shebang};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_shebang"} 0 0 0
978 0 $self->{_loaded_shebang} = 1;
979  
980 0 ▶ if ($self->peek =~ /^(#\!.+)\r?\n/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->peek =~ /^(#\!.+)\r?\n/) 0 0 0
981 0 my $line = $1;
982 0 my $interpreter;
983  
984 0 $pv->{shebang_line} = {raw => $line};
985  
986 0 ▶ if ($line =~ m(^#\!(?:(?:/usr)?(?:/local)?/s?bin/)?env\s+(\S+)(\s.*)?$)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ m[^#\!(?:(?:/usr)?(?:/local)?/s?bin/)?env\s+(\S+)(\s.*)?$]) { } 0 0 0
elsif ($line =~ /^#\!(\S+)(?:\s.*)?$/) { } 0 0 0
987 0 $interpreter = $1;
988 0 eval {
989 0 require File::Which;
990  
991 0 $interpreter = File::Which::which($interpreter);
992  
993 };
994 } elsif ($line =~ m(^#\!(\S+)(?:\s.*)?$)) {
995 0 $interpreter = $1;
996 }
997  
998 0 ▶ $pv->{shebang_interpreter} = {raw => $interpreter} if defined($interpreter) && length($interpreter);
Branch: 1 branch
BranchTrueFalseTotal
if defined $interpreter and length $interpreter 0 0 0
Condition0%0/3
defined $interpreter and length $interpreter
!ll&&!rl&&r
000
MC/DC0%0/2
defined $interpreter and length $interpreter
defined $interpreter length $interpreter
Truth table0%0/3
A and B
A= defined $interpreterB= length $interpreter
ABresult
0X0
100
111
999 }
1000 }
1001  
1002 3 1;
1003  
1004 __END__
« lib/File/Information/Tagpool.pm ↑ Summary lib/File/Information.pm »