lib/File/Information/Tagpool.pm

filter: Statementstmt 16.5% 35 / 211 Branchbran 1.2% 1 / 78 Conditioncond 0.0% 0 / 53 MC/DCmcdc 0.0% 0 / 31 Subroutinesub 45.0% 9 / 20 Podpod 100% 4 / 4 totaltotal 12.3% 49 / 397 CC 71 SCAR 66.9
CC
71
Cov
11%
file_add
1722.0
load_sysfile_cache
90.0
_load_tagpool
72.0
CRAP 805.9
« lib/File/Information/Base.pm ↑ Summary lib/File/Information/Inode.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::Tagpool;
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 Sys::Hostname ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 3 ▶use File::Information::Lock;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 3 our $VERSION = v0.17;
24  
25 3 my $HAVE_FILE_VALUEFILE = eval {require File::ValueFile::Simple::Reader; require File::ValueFile::Simple::Writer; 1;};
26  
27 3 my %_properties = (
28 tagpool_pool_path => {loader => \&_load_tagpool, rawtype => 'filename'},
29 );
30  
31 3 ▶if ($HAVE_FILE_VALUEFILE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_FILE_VALUEFILE) 3 0 3
32 3 $_properties{tagpool_pool_uuid} = {loader => \&_load_tagpool, rawtype => 'uuid'};
33 }
34  
35 0 ▶sub _new {
Subroutine _new: not called CC=2 SCAR=17.9
36 0 my ($pkg, %opts) = @_;
37 0 my $self = $pkg->SUPER::_new(%opts, properties => \%_properties);
38  
39 0 ▶ croak 'No path is given' unless defined $self->{path};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"path"} 0 0 0
40  
41 0 return $self;
42 }
43  
44  
45 #@returns File::Information::Lock
46 0 ▶sub lock {
Subroutine lock: not called CC=6 SCAR=37.4
Pod documented
47 0 my ($self) = @_;
48 0 ▶ my $locks = $self->{locks} //= {};
Condition0%0/2
$self->{"locks"} //= {}
l!l
00
MC/DC0%0/1
$self->{"locks"} //= {}
$self->{"locks"}
Truth table0%0/2
A
A= $self->{"locks"}
Aresult
11
00
49  
50 0 ▶ unless (scalar keys %{$locks}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %{$locks;}) 0 0 0
51 0 my $lockfile = $self->_catfile('lock');
52 0 my $lockname = $self->_tempfile('lock');
53 0 ▶ open(my $out, '>', $lockname) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $out, ">", $lockname or die $! 0 0 0
54 0 print $out ".\n";
55 0 close($out);
56  
57 0 ▶ for (my $i = 0; $i < 3; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 3) 0 0 0
58 0 ▶ if (link($lockname, $lockfile)) {
Branch: 1 branch
BranchTrueFalseTotal
if (link $lockname, $lockfile) 0 0 0
59 # Success.
60 0 $self->{lockfile} = $lockfile;
61 0 $self->{lockname} = $lockname;
62 {
63 0 my $lock = File::Information::Lock->new(parent => $self, on_unlock => \&_unlock);
64 0 $locks->{$lock} = $lock;
65 0 weaken($locks->{$lock}); # it holds a reference to us, so our's will be weak.
66 0 return $lock;
67 }
68 }
69 0 sleep(1);
70 }
71  
72 0 unlink($lockname);
73 0 croak 'Can not lock pool';
74 }
75  
76 {
77 0 my $lock = File::Information::Lock->new(parent => $self, on_unlock => \&_unlock);
78 0 $locks->{$lock} = $lock;
79 0 weaken($locks->{$lock}); # it holds a reference to us, so our's will be weak.
80 0 return $lock;
81 }
82 }
83  
84  
85 0 ▶sub locked {
Subroutine locked: not called CC=1 SCAR=6.9
Pod documented
86 0 my ($self, $func) = @_;
87 0 my $lock = $self->lock;
88 0 return $func->();
89 }
90  
91  
92 0 ▶sub load_sysfile_cache {
Subroutine load_sysfile_cache: not called CC=9 SCAR=45.0
Pod documented
93 0 my ($self) = @_;
94 0 ▶ my $locks = $self->{locks} //= {};
Condition0%0/2
$self->{"locks"} //= {}
l!l
00
MC/DC0%0/1
$self->{"locks"} //= {}
$self->{"locks"}
Truth table0%0/2
A
A= $self->{"locks"}
Aresult
11
00
95  
96 0 ▶ unless (scalar keys %{$locks}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %{$locks;}) 0 0 0
97 0 croak 'The pool must be locked to read the sysfile cache';
98 }
99  
100 0 ▶ unless (defined $self->{sysfile_cache}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"sysfile_cache"}) 0 0 0
101 0 ▶ my $local_cache = $self->instance->_tagpool_sysfile_cache->{$self->{path}} //= {};
Condition0%0/2
$self->instance->_tagpool_sysfile_cache->{$self->{"path"}} //= {}
l!l
00
MC/DC0%0/1
$self->instance->_tagpool_sysfile_cache->{$self->{"path"}} //= {}
$self->instance->_tagpool_sysfile_cache->{$self->{"path"}}
Truth table0%0/2
A
A= $self->instance->_tagpool_sysfile_cache->{$self->{"path"}}
Aresult
11
00
102 0 my $data_path = $self->_catdir('data');
103 0 my %cache;
104  
105 0 ▶ opendir(my $dir, $data_path) or croak $!;
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dir, $data_path or croak($!) 0 0 0
106  
107 0 ▶ while (my $entry = readdir($dir)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $entry = readdir $dir)) 0 0 0
108 0 my @c_stat;
109  
110 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
111  
112 0 @c_stat = stat($self->_catfile('data', $entry));
113 0 ▶ next unless scalar @c_stat;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @c_stat 0 0 0
114  
115 0 $cache{$c_stat[1].'@'.$c_stat[0]} = $entry;
116 }
117  
118 0 %{$local_cache} = (%cache, complete => 1);
119  
120 0 return $self->{sysfile_cache} = \%cache;
121 }
122  
123 0 return $self->{sysfile_cache};
124 }
125  
126  
127 0 ▶sub file_add {
Subroutine file_add: not called CC=41 SCAR=74.5
Pod documented
128 0 my ($self, $files, %opts) = @_;
129 0 my $instance = $self->instance;
130 0 ▶ my $local_cache = $instance->_tagpool_sysfile_cache->{$self->{path}} //= {};
Condition0%0/2
$instance->_tagpool_sysfile_cache->{$self->{"path"}} //= {}
l!l
00
MC/DC0%0/1
$instance->_tagpool_sysfile_cache->{$self->{"path"}} //= {}
$instance->_tagpool_sysfile_cache->{$self->{"path"}}
Truth table0%0/2
A
A= $instance->_tagpool_sysfile_cache->{$self->{"path"}}
Aresult
11
00
131 0 my $lock;
132 my $sysfile_cache;
133 0 my %to_add;
134  
135 # First setup %to_add:
136 0 ▶ $files = [$files] unless ref($files) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $files eq "ARRAY" 0 0 0
137 0 foreach my $file (@{$files}) {
138 0 my $link;
139 my $inode;
140 0 my $path;
141 0 my $key;
142  
143 0 ▶ croak 'File is undefined' unless $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file 0 0 0
144  
145 0 ▶ if (ref($file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $file) { } 0 0 0
146 0 ▶ if ($file->isa('File::Information::Link')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($file->isa('File::Information::Link')) { } 0 0 0
elsif ($file->isa('File::Information::Inode')) { } 0 0 0
147 0 $link = $file;
148 } elsif ($file->isa('File::Information::Inode')) {
149 0 $inode = $file;
150 } else {
151 0 $inode = $instance->for_handle($file);
152 }
153 } else {
154 0 $link = $instance->for_link($file);
155 }
156  
157 0 ▶ $inode = $link->inode if !defined($inode) && defined($link);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $inode and defined $link 0 0 0
Condition0%0/3
not defined $inode and defined $link
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $inode and defined $link
not defined $inode defined $link
Truth table0%0/3
not(A) and B
A= not defined $inodeB= defined $link
ABresult
0X0
100
111
158  
159 0 ▶ $path //= $link->{path} if defined $link;
Branch: 1 branch
BranchTrueFalseTotal
if defined $link 0 0 0
Condition0%0/3
$path //= $link->{"path"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$path //= $link->{"path"}
$path $link->{"path"}
Truth table0%0/3
A //= B
A= $pathB= $link->{"path"}
ABresult
1X1
011
000
160 0 ▶ $path //= $inode->{path} if defined $inode;
Branch: 1 branch
BranchTrueFalseTotal
if defined $inode 0 0 0
Condition0%0/3
$path //= $inode->{"path"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$path //= $inode->{"path"}
$path $inode->{"path"}
Truth table0%0/3
A //= B
A= $pathB= $inode->{"path"}
ABresult
1X1
011
000
161  
162 0 ▶ croak 'Cannot find any inode for file' unless defined $inode;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $inode 0 0 0
163  
164 0 $key = $inode->get('stat_cachehash');
165  
166 0 $to_add{$key} = {
167 inode => $inode,
168 link => $link,
169 path => $path,
170 type => $inode->get('tagpool_inode_type', as => 'ise'),
171 uuid => $inode->get('uuid', as => 'uuid', default => undef),
172 };
173 }
174  
175 # Lock the pool and figure out what to add.
176 0 $lock = $self->lock;
177 0 $sysfile_cache = $self->load_sysfile_cache;
178  
179 # Check if we have any valid files.
180 0 foreach my $key (keys %to_add) {
181 0 my $file = $to_add{$key};
182 0 my $invalid;
183  
184 0 ▶ $invalid ||= !defined($file->{path}) && length($file->{path});
Condition0%0/6
$invalid ||= !defined($file->{"path"}) && length $file->{"path"}
l!l&&r!l&&!r
000
!defined($file->{'path'}) && length $file->{'path'}
!ll&&!rl&&r
000
MC/DC0%0/3
$invalid ||= !defined($file->{"path"}) && length $file->{"path"}
$invalid !defined($file->{'path'}) length $file->{'path'}
Truth table0%0/4
A ||= not(B) && C
A= $invalidB= !defined($file->{'path'})C= length $file->{'path'}
ABCresult
1XX1
0111
00X0
0100
185 0 ▶ $invalid ||= $file->{type} ne 'e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb';
Condition0%0/3
$invalid ||= $file->{"type"} ne "e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb"
l!l&&r!l&&!r
000
MC/DC0%0/2
$invalid ||= $file->{"type"} ne "e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb"
$invalid $file->{"type"} ne "e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb"
Truth table0%0/3
A ||= B
A= $invalidB= $file->{"type"} ne "e6d6bb07-1a6a-46f6-8c18-5aa6ea24d7cb"
ABresult
1X1
011
000
186  
187 0 ▶ if (exists $sysfile_cache->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $sysfile_cache->{$key}) 0 0 0
188 0 ▶ if ($opts{skip_already}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"skip_already"}) 0 0 0
189 0 delete $to_add{$key};
190 0 next;
191 }
192 0 ▶ $invalid ||= 1;
Condition0%0/2
$invalid ||= 1
l!l
00
MC/DC0%0/1
$invalid ||= 1
$invalid
Truth table0%0/2
A
A= $invalid
Aresult
11
00
193 }
194  
195 0 ▶ if ($invalid && $opts{skip_invalid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invalid and $opts{"skip_invalid"}) 0 0 0
Condition0%0/3
$invalid and $opts{"skip_invalid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$invalid and $opts{"skip_invalid"}
$invalid $opts{"skip_invalid"}
Truth table0%0/3
A and B
A= $invalidB= $opts{"skip_invalid"}
ABresult
0X0
100
111
196 0 delete $to_add{$key};
197 0 next;
198 }
199  
200 0 ▶ unless (defined $file->{uuid}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $file->{"uuid"}) 0 0 0
201 0 $file->{uuid} = Data::Identifier->random(type => 'uuid')->uuid;
202 }
203  
204 0 ▶ $invalid ||= !defined($file->{uuid});
Condition0%0/3
$invalid ||= !defined($file->{"uuid"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$invalid ||= !defined($file->{"uuid"})
$invalid !defined($file->{"uuid"})
Truth table0%0/3
A ||= not(B)
A= $invalidB= !defined($file->{"uuid"})
ABresult
1X1
011
000
205  
206 0 ▶ $invalid ||= -e $self->_catfile('data', 'info.'.$file->{uuid});
Condition0%0/3
$invalid ||= -e $self->_catfile("data", 'info.' . $file->{"uuid"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$invalid ||= -e $self->_catfile("data", 'info.' . $file->{"uuid"})
$invalid -e $self->_catfile("data", 'info.' . $file->{"uuid"})
Truth table0%0/3
A ||= B
A= $invalidB= -e $self->_catfile("data", 'info.' . $file->{"uuid"})
ABresult
1X1
011
000
207  
208 0 ▶ if ($invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invalid) 0 0 0
209 0 croak 'Cannot add file '.$key.': Not permissible for adding';
210 }
211 }
212  
213 # Now we only have files in %to_add which we can actually add.
214 # We also have a lock.
215 # So add them!
216  
217 0 foreach my $key (keys %to_add) {
218 0 my $file = $to_add{$key};
219 0 my $uuid = $file->{uuid};
220 my $inode = $file->{inode},
221 0 my $pool_name_suffix = 'file.'.$uuid.'.x';
222 0 my $writer;
223 0 my %data = (
224 );
225 0 my %info;
226 my %tags;
227 0 my %_base_key_to_tagpool_info = (
228 st_ino => 'inode',
229 st_mtime => 'mtime',
230 size => 'size',
231 );
232  
233 0 foreach my $lifecycle (qw(current final)) {
234 0 my $c = $data{$lifecycle} = {};
235  
236 0 foreach my $base_key (qw(st_ino st_mtime size)) {
237 0 $c->{$_base_key_to_tagpool_info{$base_key}} = $inode->get($base_key, lifecycle => $lifecycle, default => undef);
238 }
239 }
240  
241 0 foreach my $lifecycle (qw(current final)) {
242 0 foreach my $tagpool_name (qw(sha1 sha512)) {
243 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
244 0 my $digest = $inode->digest($utag_name, lifecycle => $lifecycle, as => 'hex', default => undef);
245 0 ▶ next unless defined $digest;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $digest 0 0 0
246 0 $data{$lifecycle}{'hash-'.$tagpool_name} = $digest;
247 }
248 }
249  
250 0 $data{current}{timestamp} = time();
251  
252 %info = (
253 0 (map {$_ => $inode->get($_, default => undef)} qw(title comment description)),
254 0 (map {'initial-'.$_ => $data{current}{$_}, 'last-'.$_ => $data{current}{$_}} keys %{$data{current}}),
255 0 (map {'final-'.$_ => $data{final}{$_}} keys %{$data{final}}),
256 'pool-name-suffix' => $pool_name_suffix,
257 );
258  
259 # Fixup:
260 0 foreach my $c (keys %info) {
261 0 ▶ delete($info{$c}) unless defined $info{$c};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $info{$c} 0 0 0
262 }
263  
264 0 foreach my $base_key (qw(writemode mediatype finalmode)) {
265 0 my $uuid = $inode->get($base_key, as => 'uuid', default => undef);
266 0 ▶ next unless $uuid;
Branch: 1 branch
BranchTrueFalseTotal
unless $uuid 0 0 0
267 0 $tags{$uuid} = undef;
268 }
269  
270 0 warn $uuid;
271  
272 0 ▶ link($file->{path}, $self->_catfile('data', $pool_name_suffix)) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
link $file->{"path"}, $self->_catfile("data", $pool_name_suffix) or die $! 0 0 0
273  
274 0 $writer = File::ValueFile::Simple::Writer->new($self->_catfile('data', 'info.'.$uuid));
275 0 $writer->write_hash(\%info);
276  
277 0 $writer = File::ValueFile::Simple::Writer->new($self->_catfile('data', 'tags.'.$uuid));
278 0 $writer->write('tagged-as', $_) foreach keys %tags;
279  
280 0 $sysfile_cache->{$key} = $pool_name_suffix;
281 0 $local_cache->{$key} = $pool_name_suffix;
282 }
283 }
284  
285 # ----------------
286  
287 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=5 SCAR=34.0
288 0 my ($self) = @_;
289  
290 0 ▶ if (defined($self->{locks}) && scalar(keys %{$self->{locks}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"locks"} and scalar keys %{$$self{"locks"};}) 0 0 0
Condition0%0/2
defined $self->{"locks"} and scalar keys %{$$self{"locks"};}
!ll
00
MC/DC0%0/1
defined $self->{"locks"} and scalar keys %{$$self{"locks"};}
defined $self->{"locks"}
Truth table0%0/2
A
A= defined $self->{"locks"}
Aresult
00
11
291 0 warn 'DESTROY on locked pool. BUG.';
292 0 ▶ warn sprintf('LOCK: %s -> %s', $_, $self->{locks}{$_} // '<undef>') foreach keys %{$self->{locks}};
Condition0%0/2
$self->{"locks"}{$_} // "<undef>"
l!l
00
MC/DC0%0/1
$self->{"locks"}{$_} // "<undef>"
$self->{"locks"}{$_}
Truth table0%0/2
A
A= $self->{"locks"}{$_}
Aresult
11
00
293 0 warn 'END OF LOCK LIST';
294 }
295 }
296  
297 0 ▶sub _catfile {
Subroutine _catfile: not called CC=1 SCAR=6.9
298 0 my ($self, @c) = @_;
299 0 File::Spec->catfile($self->{path}, @c);
300 }
301  
302 0 ▶sub _catdir {
Subroutine _catdir: not called CC=1 SCAR=6.9
303 0 my ($self, @c) = @_;
304 0 File::Spec->catdir($self->{path}, @c);
305 }
306  
307 0 ▶sub _tempfile {
Subroutine _tempfile: not called CC=3 SCAR=24.8
308 0 my ($self, $task, $instance) = @_;
309  
310 0 ▶ $task ||= 'UNKNOWN';
Condition0%0/2
$task ||= "UNKNOWN"
l!l
00
MC/DC0%0/1
$task ||= "UNKNOWN"
$task
Truth table0%0/2
A
A= $task
Aresult
11
00
311 0 ▶ $instance ||= int($self);;
Condition0%0/3
$instance ||= int $self
l!l&&r!l&&!r
000
MC/DC0%0/2
$instance ||= int $self
$instance int $self
Truth table0%0/3
A ||= B
A= $instanceB= int $self
ABresult
1X1
011
000
312  
313 0 return $self->_catfile('temp', sprintf('%s.%i.%s.%s', Sys::Hostname::hostname(), $$, $task, $instance));
314 }
315  
316 0 ▶sub _unlock {
Subroutine _unlock: not called CC=4 SCAR=30.0
317 0 my ($self, $lock) = @_;
318 0 my $locks = $self->{locks};
319  
320 0 delete $locks->{$lock};
321  
322 0 ▶ unless (scalar keys %{$locks}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %{$locks;}) 0 0 0
323 0 ▶ unlink($self->{lockfile}) if defined $self->{lockfile};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"lockfile"} 0 0 0
324 0 ▶ unlink($self->{lockname}) if defined $self->{lockname};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"lockname"} 0 0 0
325 0 $self->{lockfile} = undef;
326 0 $self->{lockname} = undef;
327 0 $self->{sysfile_cache} = undef;
328 }
329 }
330  
331 0 ▶sub _load_tagpool {
Subroutine _load_tagpool: not called CC=8 SCAR=42.8
332 0 my ($self, $key, %opts) = @_;
333 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
334 0 my $config;
335  
336 0 ▶ return if $self->{_loaded_tagpool_pool};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loaded_tagpool_pool"} 0 0 0
337 0 $self->{_loaded_tagpool_pool} = 1;
338  
339 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
340 0 $pv->{current}{tagpool_pool_path} = {raw => $self->{path}};
341  
342 0 ▶ return unless $HAVE_FILE_VALUEFILE;
Branch: 1 branch
BranchTrueFalseTotal
unless $HAVE_FILE_VALUEFILE 0 0 0
343  
344 0 eval {
345 0 my $path = $self->_catfile('config');
346 0 my $reader = File::ValueFile::Simple::Reader->new($path, supported_formats => undef, supported_features => []);
347 0 $config = $reader->read_as_hash;
348 };
349  
350 0 ▶ return unless defined $config;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $config 0 0 0
351  
352 0 ▶ $pv->{current}{tagpool_pool_uuid} = {raw => $config->{'pool-uuid'}} if defined($config->{'pool-uuid'}) && length($config->{'pool-uuid'}) == 36;
Branch: 1 branch
BranchTrueFalseTotal
if defined $config->{"pool-uuid"} and length $config->{"pool-uuid"} == 36 0 0 0
Condition0%0/3
defined $config->{"pool-uuid"} and length $config->{"pool-uuid"} == 36
!ll&&!rl&&r
000
MC/DC0%0/2
defined $config->{"pool-uuid"} and length $config->{"pool-uuid"} == 36
defined $config->{"pool-uuid"} length $config->{"pool-uuid"} == 36
Truth table0%0/3
A and B
A= defined $config->{"pool-uuid"}B= length $config->{"pool-uuid"} == 36
ABresult
0X0
100
111
353 }
354  
355 3 1;
356  
357 __END__
« lib/File/Information/Base.pm ↑ Summary lib/File/Information/Inode.pm »