File Coverage

blib/lib/Archive/Tar/Builder/HardlinkCache.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package Archive::Tar::Builder::HardlinkCache;
2              
3             # Copyright (c) 2019, cPanel, L.L.C.
4             # All rights reserved.
5             # http://cpanel.net/
6             #
7             # This is free software; you can redistribute it and/or modify it under the same
8             # terms as Perl itself. See the LICENSE file for further details.
9              
10 8     8   516 use strict;
  8         17  
  8         223  
11 8     8   40 use warnings;
  8         17  
  8         959  
12              
13             =head1 NAME
14              
15             Archive::Tar::Builder::HardlinkCache - Index of hardlinked files
16              
17             =head1 DESCRIPTION
18              
19             L is a cache of hardlinked files, indexed
20             by device and inode number, containing the first paths encountered of
21             hardlinked files.
22              
23             This module is intended for internal use.
24              
25             =cut
26              
27             sub new {
28 11     11 0 712 my ($class) = @_;
29              
30 11         87 return bless {}, $class;
31             }
32              
33             sub lookup {
34 9     9 0 113 my ($self, $dev, $ino, $path) = @_;
35              
36 9 100       288 if (exists $self->{$dev}->{$ino}) {
37 5         70 return $self->{$dev}->{$ino};
38             }
39              
40 4         78 $self->{$dev}->{$ino} = $path;
41              
42 4         73 return;
43             }
44              
45             =head1 COPYRIGHT
46              
47             Copyright (c) 2019, cPanel, L.L.C.
48             All rights reserved.
49             http://cpanel.net/
50              
51             This is free software; you can redistribute it and/or modify it under the same
52             terms as Perl itself. See L for further details.
53              
54             =cut
55              
56             1;