| 1 | 18 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 2 | 18 | ▶ | use 5.010; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||
| 4 | package FusqlFS::Entry; | ||||||||||||||||||||||||||||||
| 5 | 18 | ▶ | use FusqlFS::Version; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | 18 | our $VERSION = $FusqlFS::Version::VERSION; | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||
| 10 | FusqlFS::Entry - abstract fusqlfs file system entry class | ||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||
| 14 | use FusqlFS::Entry; | ||||||||||||||||||||||||||||||
| 15 | use FusqlFS::Backend; | ||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | my $fs = FusqlFS::Backend->new(engine => 'PgSQL', user => 'postgres', database => 'dbname'); | ||||||||||||||||||||||||||||||
| 18 | my $entry = FusqlFS::Entry->new($fs, "/tables/sometable/struct/field"); | ||||||||||||||||||||||||||||||
| 19 | print $entry->get(); | ||||||||||||||||||||||||||||||
| 20 | print $entry->read(0, 10); | ||||||||||||||||||||||||||||||
| 21 | $entry->write($newdata, 0); | ||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||
| 25 | This class represents file system object in FusqlFS, i.e. all files, | ||||||||||||||||||||||||||||||
| 26 | directories, symlinks etc. are instances of this class. | ||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||
| 28 | This class defines thin convenience layer between database backend and fuse | ||||||||||||||||||||||||||||||
| 29 | subsystem, providing file path to database artifact resolution and interface | ||||||||||||||||||||||||||||||
| 30 | between fuse subsystem hooks and actual backend database operations, | ||||||||||||||||||||||||||||||
| 31 | translating database artifacts storing/dropping/renaming/etc. to correspondent | ||||||||||||||||||||||||||||||
| 32 | file system operations. | ||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||
| 34 | You should never work with this class directly, as it's abstracts from database | ||||||||||||||||||||||||||||||
| 35 | backend nicely, so you should implement database backends most of time, but | ||||||||||||||||||||||||||||||
| 36 | this document can be useful if you want to understand what happens behind the | ||||||||||||||||||||||||||||||
| 37 | scene when file names are converted to real database backend object instances. | ||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||
| 39 | Every entry instance keeps following data about file system entry: | ||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||
| 41 | =over | ||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||
| 43 | =item 1 | ||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||
| 45 | Last L<FusqlFS::Artifact> instance found in entry lookup process (see L</new> | ||||||||||||||||||||||||||||||
| 46 | description for more info about entry lookup). This instance is called entry's | ||||||||||||||||||||||||||||||
| 47 | "package" or "pkg" for short. | ||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||
| 49 | =item 2 | ||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||
| 51 | All path elements used to lookup next entries with L<FusqlFS::Artifact/get> | ||||||||||||||||||||||||||||||
| 52 | calls. Number of such elements is called entry's "depth". | ||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||
| 54 | =item 3 | ||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||
| 56 | Cached data about entry contents. | ||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||
| 58 | =item 4 | ||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||
| 60 | All path elements seen after last L<FusqlFS::Artifact> instance met in lookup | ||||||||||||||||||||||||||||||
| 61 | process. Number of such elements is called entry's "height". | ||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||
| 63 | =back | ||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||
| 65 | Beside these data each kind of entry can contain some additional kind-specific | ||||||||||||||||||||||||||||||
| 66 | data. | ||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||
| 68 | =head1 METHODS | ||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||
| 70 | =over | ||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||
| 72 | =item new | ||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||
| 74 | File system entry constructor. | ||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||
| 76 | Input: $fs, $path, $leaf_absent=undef. | ||||||||||||||||||||||||||||||
| 77 | Output: $entry_instance. | ||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||
| 79 | This constructor is the heart of full file path to actual database artifact | ||||||||||||||||||||||||||||||
| 80 | object translation. Understanding of this method is the key to understanding | ||||||||||||||||||||||||||||||
| 81 | the process of finding different database artifacts in file system tree and | ||||||||||||||||||||||||||||||
| 82 | defining kind of found file system entry (i.e. if it is a plain file, | ||||||||||||||||||||||||||||||
| 83 | subdirectory, symlink or a pseudopipe). | ||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||
| 85 | C<$fs> is the L<FusqlFS::Backend::Base> instance, which represents file system | ||||||||||||||||||||||||||||||
| 86 | "root". This is an entry point where the search begins. C<$path> is the full | ||||||||||||||||||||||||||||||
| 87 | path to subject file system object passed to every fuse hook subroutine as | ||||||||||||||||||||||||||||||
| 88 | first argument. | ||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||
| 90 | At first C<$path> is cleaned up from spare /-es and is splitted into path | ||||||||||||||||||||||||||||||
| 91 | elements. And then it is walked through from head to tail, resolving every path | ||||||||||||||||||||||||||||||
| 92 | element one by one. If any of elements in the path is absent (except for the | ||||||||||||||||||||||||||||||
| 93 | last one, which is a special case reviewed a little later), undef is returned, | ||||||||||||||||||||||||||||||
| 94 | which means file is absent and usually translated to -ENOENT error by hooks in | ||||||||||||||||||||||||||||||
| 95 | L<FusqlFS>. | ||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||
| 97 | The first path element is looked for in C<$fs-E<gt>{subpackages}>, and any | ||||||||||||||||||||||||||||||
| 98 | subsequent element is looked for in the last found entry. | ||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||
| 100 | Every entry is searched for subsequent path element according following simple | ||||||||||||||||||||||||||||||
| 101 | rules: | ||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||
| 103 | =over | ||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||
| 105 | =item * | ||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||
| 107 | If the entry is a hashref or an arrayref, it is a directory, and it must have | ||||||||||||||||||||||||||||||
| 108 | key (or index) equal to currently parsed path element. If it isn't, undef is | ||||||||||||||||||||||||||||||
| 109 | returned immediately, otherwise the next entry is found and equal to this | ||||||||||||||||||||||||||||||
| 110 | hashref's (or arrayref's) value by given key name (or index). | ||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||
| 112 | =item * | ||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||
| 114 | If the entry is an L<FusqlFS::Artifact> instance, L<FusqlFS::Artifact/get> is | ||||||||||||||||||||||||||||||
| 115 | called with all gathered path elements used in C<FusqlFS::Artifact> lookup up | ||||||||||||||||||||||||||||||
| 116 | to this point, and entry is equal to the returned result. If the result is | ||||||||||||||||||||||||||||||
| 117 | undefined, undef is returned immediately. | ||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||
| 119 | For every C<FusqlFS::Artifact> instance met, path element used to lookup next | ||||||||||||||||||||||||||||||
| 120 | entry is remembered in a special C<@names> array, so for example | ||||||||||||||||||||||||||||||
| 121 | F</tables/sometable> lookup will lead to | ||||||||||||||||||||||||||||||
| 122 | C<$fs-E<gt>{subpackages}-E<gt>{tables}-E<gt>get('sometable')> invocation, while | ||||||||||||||||||||||||||||||
| 123 | F</tables/sometable/indices/someindex> lookup will result in the following | ||||||||||||||||||||||||||||||
| 124 | chain of calls: | ||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||
| 126 | $fs->{subpackages}->{tables}->get('sometable')->{indices}->get('sometable', 'someindex'); | ||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||
| 128 | =item * | ||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||
| 130 | If at any iteration except for the last one entry is not a directory, undef is | ||||||||||||||||||||||||||||||
| 131 | returned, as you can't lookup next path element in anything except | ||||||||||||||||||||||||||||||
| 132 | subdirectory. | ||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||
| 134 | =item * | ||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||
| 136 | On the last iteration the resulting entry type is defined. If the last found | ||||||||||||||||||||||||||||||
| 137 | entry is a hashref or an arrayref, it will be L<FusqlFS::Entry::Dir> instance | ||||||||||||||||||||||||||||||
| 138 | and is represented with directory, if it is a scalarref it will be | ||||||||||||||||||||||||||||||
| 139 | L<FusqlFS::Entry::Symlink> instance and will be visible as symlink, if it is a | ||||||||||||||||||||||||||||||
| 140 | coderef it will be L<FusqlFS::Entry::Pipe> instance and will be represented | ||||||||||||||||||||||||||||||
| 141 | with pseudopipe, and if it is a simple scalar it will be | ||||||||||||||||||||||||||||||
| 142 | L<FusqlFS::Entry::File> instance and will be represented with plain file. | ||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||
| 144 | If the last found entry is an L<FusqlFS::Artifact> instance, its C<list()> | ||||||||||||||||||||||||||||||
| 145 | method will be called and if its result is not an undef, the entry will be | ||||||||||||||||||||||||||||||
| 146 | visible as directory, otherwise C<get()> method will be called and the | ||||||||||||||||||||||||||||||
| 147 | resulting value will be interpreted as described in previous paragraph (but it | ||||||||||||||||||||||||||||||
| 148 | won't be interpreted as directory anymore). | ||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||
| 150 | If this last entry is undef, undef will be returned unless C<$leaf_absent> | ||||||||||||||||||||||||||||||
| 151 | argument is given. If it is given and it is not undef, then this entry will be | ||||||||||||||||||||||||||||||
| 152 | assigned to its value and interpreted as described above. This way you can | ||||||||||||||||||||||||||||||
| 153 | create new files/directories/etc. | ||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||
| 155 | =back | ||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||
| 157 | =cut | ||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||
| 159 | 18 | our %SUBCLASSES = ( | |||||||||||||||||||||||||||||
| 160 | ARRAY => '::Dir', | ||||||||||||||||||||||||||||||
| 161 | HASH => '::Dir', | ||||||||||||||||||||||||||||||
| 162 | SCALAR => '::Symlink', | ||||||||||||||||||||||||||||||
| 163 | CODE => '::Code', | ||||||||||||||||||||||||||||||
| 164 | '', '::File', | ||||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||
| 167 | sub new | ||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||
| 169 | 0 | my ($class, $fs, $path, $leaf_absent) = @_; | |||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||
| 171 | 0 | my $subclass = ''; | |||||||||||||||||||||||||||||
| 172 | 0 | $path =~ s{^/}{}; | |||||||||||||||||||||||||||||
| 173 | 0 | $path =~ s{/$}{}; | |||||||||||||||||||||||||||||
| 174 | 0 | my @path = split /\//, $path; | |||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||
| 176 | 0 | my $entry = $fs->{subpackages}; | |||||||||||||||||||||||||||||
| 177 | 0 | my $pkg = $fs; | |||||||||||||||||||||||||||||
| 178 | 0 | my @names = (); | |||||||||||||||||||||||||||||
| 179 | 0 | my @tail = (); | |||||||||||||||||||||||||||||
| 180 | 0 | foreach my $p (@path) | |||||||||||||||||||||||||||||
| 181 | { | ||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | return unless defined $entry; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if (UNIVERSAL::isa($entry, 'FusqlFS::Artifact')) | ||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||
| 185 | 0 | @tail = (); | |||||||||||||||||||||||||||||
| 186 | 0 | $pkg = $entry; | |||||||||||||||||||||||||||||
| 187 | 0 | push @names, $p; | |||||||||||||||||||||||||||||
| 188 | 0 | $entry = $pkg->get(@names); | |||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||
| 190 | elsif (my $ref = ref $entry) | ||||||||||||||||||||||||||||||
| 191 | { | ||||||||||||||||||||||||||||||
| 192 | 0 | given ($ref) | |||||||||||||||||||||||||||||
| 193 | { | ||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | when ('HASH') { $entry = defined $entry->{$p}? $entry->{$p}: undef } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | when ('ARRAY') { $entry = defined $entry->[$p]? $entry->[$p]: undef } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 196 | 0 | default { undef $entry } | |||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||
| 198 | 0 | push @tail, $p; | |||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $entry = $leaf_absent unless defined $entry; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | return unless defined $entry; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 204 | 0 | my $list; | |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if (UNIVERSAL::isa($entry, 'FusqlFS::Artifact')) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 206 | { | ||||||||||||||||||||||||||||||
| 207 | 0 | $pkg = $entry; | |||||||||||||||||||||||||||||
| 208 | 0 | $list = $pkg->list(@names); | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if ($list) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 210 | 0 | $subclass = '::Dir'; | |||||||||||||||||||||||||||||
| 211 | } else { | ||||||||||||||||||||||||||||||
| 212 | 0 | $entry = $pkg->get(@names); | |||||||||||||||||||||||||||||
| 213 | 0 | $subclass = $SUBCLASSES{ref $entry}; | |||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||
| 215 | } else { | ||||||||||||||||||||||||||||||
| 216 | 0 | $subclass = $SUBCLASSES{ref $entry}; | |||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||
| 219 | 0 | my $self = [ $pkg, \@names, $entry, $list, \@tail, undef ]; | |||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||
| 221 | 0 | bless $self, $class.$subclass; | |||||||||||||||||||||||||||||
| 222 | 0 | $self->init(@path); | |||||||||||||||||||||||||||||
| 223 | 0 | return $self; | |||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||
| 226 | =item init | ||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||
| 228 | I<Abstract method> called on entry initialization. | ||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||
| 230 | Input: @path. | ||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||
| 232 | This method is called every time after new entry instance is blessed into its | ||||||||||||||||||||||||||||||
| 233 | class, i.e. just after instance construction. | ||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||
| 235 | The C<@path> is the cleaned up and splitted into elements version of C<$path> | ||||||||||||||||||||||||||||||
| 236 | argument to L</new> constructor method. It can be used by this method anyway | ||||||||||||||||||||||||||||||
| 237 | it might be useful. The return value of this method is ignored. | ||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||
| 239 | =item get | ||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||
| 241 | Returns cached entry's content. | ||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||
| 243 | Output: $entry_content. | ||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||
| 245 | =item size | ||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||
| 247 | Returns size of entry's content. | ||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||
| 249 | Output: $entry_length. | ||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||
| 251 | =item list | ||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||
| 253 | Returns list of items contained in entry if the entry is a directory, undef | ||||||||||||||||||||||||||||||
| 254 | otherwise. | ||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||
| 256 | Output: $entry_items|undef. | ||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||
| 258 | =item move | ||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||
| 260 | Moves entry from one position in files tree to another. | ||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||
| 262 | Input: $target. | ||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||
| 264 | C<$target> is another target C<FusqlFS::Entry> instance. The original entry is | ||||||||||||||||||||||||||||||
| 265 | destroyed in process, and target entry becomes identical to original one. | ||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||
| 267 | This method is used in rename fuse hook. It is recommended to construct new | ||||||||||||||||||||||||||||||
| 268 | target entry with defined C<$leaf_absent> argument to L</new>, as this operation | ||||||||||||||||||||||||||||||
| 269 | on already existing entry backed up with real database object can be unpredictable | ||||||||||||||||||||||||||||||
| 270 | or even destructive. | ||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||
| 272 | =item drop | ||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||
| 274 | Removes entry from database. | ||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||
| 276 | =item create | ||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||
| 278 | Creates new file entry. | ||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||
| 280 | =item store | ||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||
| 282 | Stores new data into entry. | ||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||
| 284 | Input: $data. | ||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||
| 286 | =cut | ||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub init { } | ||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub get { $_[0]->[2] } | ||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub size { length $_[0]->[2] } | ||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub list { } | ||||||||||||||||||||||||||||
|
Subroutine
list: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 291 | sub move | ||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
move: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 293 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 294 | 0 | my $target = shift; | |||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | unless ($self->depth()) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 297 | { | ||||||||||||||||||||||||||||||
| 298 | 0 | $self->pkg()->rename($self->names(), $target->name()); | |||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||
| 300 | else | ||||||||||||||||||||||||||||||
| 301 | { | ||||||||||||||||||||||||||||||
| 302 | 0 | my $entry = $target->tailref(); | |||||||||||||||||||||||||||||
| 303 | 0 | $entry = $self->tailref($entry, undef); | |||||||||||||||||||||||||||||
| 304 | 0 | $self->pkg()->store($self->names(), $entry); | |||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | sub drop { $_[0]->put(undef) or $_[0]->[0]->drop(@{$_[0]->[1]}); } | ||||||||||||||||||||||||||||
|
Subroutine
drop: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub create { $_[0]->put('') or $_[0]->[0]->create(@{$_[0]->[1]}); } | ||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub store { my $data = $_[1]||$_[0]->[2]; $_[0]->put($data) or $_[0]->[0]->store(@{$_[0]->[1]}, $data); } | ||||||||||||||||||||||||||||
|
Subroutine
store: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
Condition0%0/3
$_[1] || $_[0][2]
MC/DC0%0/2
$_[1] || $_[0][2]
$_[1]
$_[0][2]
Truth table0%0/3
A || B
A= $_[1]B= $_[0][2]
| |||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||
| 311 | =item put | ||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||
| 313 | Modifies data, returned by L<FusqlFS::Artifact> instance in given tail point. | ||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||
| 315 | Input: $data. | ||||||||||||||||||||||||||||||
| 316 | Output: $success. | ||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||
| 318 | The problem this method is to solve is entry instance doesn't always correspond | ||||||||||||||||||||||||||||||
| 319 | to real C<FusqlFS::Artifact> instance directly, but to some substructure in | ||||||||||||||||||||||||||||||
| 320 | "subtree" exposed by this instance. But all modification operations are handled | ||||||||||||||||||||||||||||||
| 321 | by C<FusqlFS::Artifact>, so it is necessary to get whole structure from | ||||||||||||||||||||||||||||||
| 322 | entry's package, modify it in necessary place and store it back with | ||||||||||||||||||||||||||||||
| 323 | L<FusqlFS::Artifact/store> method call. | ||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||
| 325 | And that's what this method does. | ||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||
| 327 | It returns true if such complex modification/storage process is required and done, | ||||||||||||||||||||||||||||||
| 328 | undef otherwise. | ||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||
| 330 | =cut | ||||||||||||||||||||||||||||||
| 331 | sub put | ||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 333 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 334 | 0 | my $data = shift; | |||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | unless ($self->depth()) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||
| 338 | 0 | return; | |||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||
| 340 | else | ||||||||||||||||||||||||||||||
| 341 | { | ||||||||||||||||||||||||||||||
| 342 | 0 | my $entry = $self->tailref(undef, $data); | |||||||||||||||||||||||||||||
| 343 | 0 | $self->pkg()->store($self->names(), $entry); | |||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||
| 345 | 0 | return 1; | |||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||
| 348 | =item tailref | ||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||
| 350 | Backbone of different complex entry operations, such as L</put> and L</move>. | ||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||
| 352 | Input: $entry=undef, $data=undef. | ||||||||||||||||||||||||||||||
| 353 | Output: $entry. | ||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||
| 355 | This method gets full entry structure, returned by L<FusqlFS::Artifact/get> | ||||||||||||||||||||||||||||||
| 356 | call (defaults to current entry's structure returned with L</entry> method), | ||||||||||||||||||||||||||||||
| 357 | traverses it down to the last tail piece of data, correspondent to the entry | ||||||||||||||||||||||||||||||
| 358 | instance, modifies it with given data (or removes it altogether if the data | ||||||||||||||||||||||||||||||
| 359 | is undefined) and returns this modified entry structure back, ready to be | ||||||||||||||||||||||||||||||
| 360 | passed to L<FusqlFS::Artifact/store> method. | ||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||
| 362 | =cut | ||||||||||||||||||||||||||||||
| 363 | sub tailref | ||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
tailref: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||
| 365 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 366 | 0 | my @tail = $self->tail(); | |||||||||||||||||||||||||||||
| 367 | 0 | my $tail = pop @tail; | |||||||||||||||||||||||||||||
| 368 | 0 | ▶ | my $entry = shift || $self->entry(); | ||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $self->entry
MC/DC0%0/2
shift() || $self->entry
shift()
$self->entry
Truth table0%0/3
A || B
A= shift()B= $self->entry
| |||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | my $data = @_? shift: $self->get(); | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 370 | 0 | my $tailref = $entry; | |||||||||||||||||||||||||||||
| 371 | 0 | ▶ | $tailref = ref $tailref eq 'HASH'? $tailref->{$_}: $tailref->[$_] foreach (@tail); | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 372 | 0 | given (ref $tailref) | |||||||||||||||||||||||||||||
| 373 | { | ||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | when ('HASH') { if (defined $data) { $tailref->{$tail} = $data } else { delete $tailref->{$tail} } } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | when ('ARRAY') { if (defined $data) { $tailref->[$tail] = $data } else { delete $tailref->[$tail] } } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||
| 377 | 0 | return $entry; | |||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||
| 380 | =item isdir, islink, isfile, ispipe | ||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||
| 382 | These are entry type identification methods and return true if the entry | ||||||||||||||||||||||||||||||
| 383 | implements correspondent behavior (i.e. if the entry is directory, symlink, | ||||||||||||||||||||||||||||||
| 384 | plain file or pseudopipe). Usually only one of these methods returns true, | ||||||||||||||||||||||||||||||
| 385 | and all the others return undef. | ||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||
| 387 | =cut | ||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | sub isdir { } | ||||||||||||||||||||||||||||
|
Subroutine
isdir: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub islink { } | ||||||||||||||||||||||||||||
|
Subroutine
islink: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | sub isfile { } | ||||||||||||||||||||||||||||
|
Subroutine
isfile: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | sub ispipe { } | ||||||||||||||||||||||||||||
|
Subroutine
ispipe: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||
| 393 | =item writable | ||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||
| 395 | Returns true if the entry is writable. | ||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||
| 397 | =cut | ||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | sub writable { !UNIVERSAL::isa($_[0]->[2], 'FusqlFS::Artifact') } | ||||||||||||||||||||||||||||
|
Subroutine
writable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||
| 400 | =item pkg, names, tail, name, depth | ||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||
| 402 | These are properties accessor methods (see L</DESCRIPTION> for full list of | ||||||||||||||||||||||||||||||
| 403 | data kept in entry instance, L</new> for description of file path resolution | ||||||||||||||||||||||||||||||
| 404 | process). | ||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||
| 406 | C<pkg> returns last L<FusqlFS::Artifact> instance met in file path traversion | ||||||||||||||||||||||||||||||
| 407 | (i.e. entry's "package"), C<names> returns list of all path elements used to | ||||||||||||||||||||||||||||||
| 408 | lookup next entry with L<FusqlFS::Artifact/get> call during file path | ||||||||||||||||||||||||||||||
| 409 | resolution, C<tail> returns list of all path elements met after the last | ||||||||||||||||||||||||||||||
| 410 | L<FusqlFS::Artifact> instance met, C<depth> and C<height> return number of | ||||||||||||||||||||||||||||||
| 411 | elements in lists, returned with C<names> and C<tail> methods correspondingly | ||||||||||||||||||||||||||||||
| 412 | (i.e. entry's "depth" and "height"). | ||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||
| 414 | =cut | ||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub pkg { $_[0]->[0] } | ||||||||||||||||||||||||||||
|
Subroutine
pkg: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | sub names { @{$_[0]->[1]} } | ||||||||||||||||||||||||||||
|
Subroutine
names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | sub tail { @{$_[0]->[4]} } | ||||||||||||||||||||||||||||
|
Subroutine
tail: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub name { $_[0]->[4]->[-1] || $_[0]->[1]->[-1] } | ||||||||||||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub depth { scalar @{$_[0]->[4]} } | ||||||||||||||||||||||||||||
|
Subroutine
depth: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub height { scalar @{$_[0]->[1]} } | ||||||||||||||||||||||||||||
|
Subroutine
height: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||
| 422 | =item entry | ||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||
| 424 | Returns not cached entry contents, got with direct call to entry's package | ||||||||||||||||||||||||||||||
| 425 | C<get> call. | ||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||
| 427 | Please mention it can be quite different with what L</get> entry's method returns, | ||||||||||||||||||||||||||||||
| 428 | as C<get> returns only tail file object itself, while C<entry> method returns | ||||||||||||||||||||||||||||||
| 429 | full data structure got from original L<FusqlFS::Artifact> instance. | ||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||
| 431 | For example if you have role's struct entry instance for path | ||||||||||||||||||||||||||||||
| 432 | F</roles/somerole/struct> C<$entry-E<gt>get()> call will give you only | ||||||||||||||||||||||||||||||
| 433 | F<struct> file content, while C<$entry-E<gt>entry()> call will bring you full | ||||||||||||||||||||||||||||||
| 434 | raw role's structure, including all subroles symlinks, "struct" file itself | ||||||||||||||||||||||||||||||
| 435 | etc. | ||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||
| 437 | =cut | ||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | sub entry { $_[0]->[0]->get(@{$_[0]->[1]}) } | ||||||||||||||||||||||||||||
|
Subroutine
entry: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||
| 440 | =item read, write | ||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||
| 442 | I<Abstract methods> implemented primarily for plain files to handle read and | ||||||||||||||||||||||||||||||
| 443 | write calls. | ||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||
| 445 | Read accepts offset and length arguments and returns data part stored in the | ||||||||||||||||||||||||||||||
| 446 | entry by given coordinates. | ||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||
| 448 | Write accepts offset and scalar data buffer and modifies and stores the entry | ||||||||||||||||||||||||||||||
| 449 | immediately. | ||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||
| 451 | All cached write operations must be (and they really are) handled by upper | ||||||||||||||||||||||||||||||
| 452 | fuse subsystem layer in L<FusqlFS>. | ||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||
| 454 | =cut | ||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | sub read { } | ||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | sub write { } | ||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||
| 458 | 18 | 1; | |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||
| 460 | package FusqlFS::Entry::File; | ||||||||||||||||||||||||||||||
| 461 | 18 | ▶ | use FusqlFS::Version; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 462 | 18 | our $VERSION = $FusqlFS::Version::VERSION; | |||||||||||||||||||||||||||||
| 463 | 18 | ▶ | use parent 'FusqlFS::Entry'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | sub isfile { 1 } | ||||||||||||||||||||||||||||
|
Subroutine
isfile: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | sub write { substr($_[0]->[2], $_[1], length($_[2]||$_[0]->[2])) = $_[2]||''; $_[0]->store($_[0]->[2]) } | ||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=3 SCAR=24.8
Condition0%0/5
$_[2] || ''
$_[2] || $_[0][2]
MC/DC0%0/1
$_[2] || ''
$_[2]
MC/DC0%0/2
$_[2] || $_[0][2]
$_[2]
$_[0][2]
Truth table0%0/2
A
A= $_[2]
Truth table0%0/3
A || B
A= $_[2]B= $_[0][2]
| |||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | sub read { substr($_[0]->[2], $_[1], $_[2]) } | ||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||
| 470 | 18 | 1; | |||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||
| 472 | package FusqlFS::Entry::Pipe; | ||||||||||||||||||||||||||||||
| 473 | 18 | ▶ | use FusqlFS::Version; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 474 | 18 | our $VERSION = $FusqlFS::Version::VERSION; | |||||||||||||||||||||||||||||
| 475 | 18 | ▶ | use parent 'FusqlFS::Entry'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||
| 477 | sub init | ||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 479 | # 0=pkg, 1=names, 2=output buffer, 3=filter sub, 4=tail | ||||||||||||||||||||||||||||||
| 480 | 0 | ($_[0]->[3], $_[0]->[2]) = ($_[0]->[2], $_[0]->[2]->()); | |||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | sub ispipe { 1 } | ||||||||||||||||||||||||||||
|
Subroutine
ispipe: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub isfile { 1 } | ||||||||||||||||||||||||||||
|
Subroutine
isfile: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | sub size { length $_[0]->[2] } | ||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | sub get { $_[0]->[3] } | ||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub read { substr($_[0]->[2], $_[1], $_[2]) } | ||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | sub write { $_[0]->[2] = $_[0]->[3]->($_[2]); } | ||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||
| 491 | 18 | 1; | |||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||
| 493 | package FusqlFS::Entry::Dir; | ||||||||||||||||||||||||||||||
| 494 | 18 | ▶ | use FusqlFS::Version; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 495 | 18 | our $VERSION = $FusqlFS::Version::VERSION; | |||||||||||||||||||||||||||||
| 496 | 18 | ▶ | use parent 'FusqlFS::Entry'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||
| 498 | sub init | ||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||
| 500 | # 0=pkg, 1=names, 2=dir entry, 3=list buffer, 4=tail | ||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | return if defined $_[0]->[3]; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | $_[0]->[3] = ref $_[0]->[2] eq 'HASH'? [ keys %{$_[0]->[2]} ]: [ 0..$#{$_[0]->[2]} ]; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub size { scalar @{$_[0]->[3]} } | ||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | sub isdir { 1 } | ||||||||||||||||||||||||||||
|
Subroutine
isdir: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | sub list { $_[0]->[3] } | ||||||||||||||||||||||||||||
|
Subroutine
list: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||
| 509 | 18 | 1; | |||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||
| 511 | package FusqlFS::Entry::Symlink; | ||||||||||||||||||||||||||||||
| 512 | 18 | ▶ | use FusqlFS::Version; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 513 | 18 | our $VERSION = $FusqlFS::Version::VERSION; | |||||||||||||||||||||||||||||
| 514 | 18 | ▶ | use parent 'FusqlFS::Entry'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | sub init { $_[0]->[3] = ('../' x (scalar(@_)-2)).${$_[0]->[2]} } | ||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | sub read { $_[0]->[3] } | ||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | sub size { length $_[0]->[3] } | ||||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | sub islink { 1 } | ||||||||||||||||||||||||||||
|
Subroutine
islink: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||
| 521 | 18 | 1; | |||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||