Fuse-PDF
view release on metacpan or search on metacpan
lib/Fuse/PDF/ContentFS.pm view on Meta::CPAN
},
};
}
sub _file {
my ($self, $path) = @_;
my $nsymlinks = 0;
my @dirs = ($self->_root);
my @path = split m{/}xms, $path;
for (my $i = 0; $i < @path; ++$i) { ##no critic(ProhibitCStyleForLoops)
my $entry = $path[$i];
next if q{} eq $entry;
my $type = $dirs[-1]->{type};
return ENOTDIR() if 'd' ne $type;
next if q{.} eq $entry;
if (q{..} eq $entry) {
pop @dirs;
lib/Fuse/PDF/ContentFS.pm view on Meta::CPAN
my $f = $next;
if ('l' eq $f->{type}) {
if ($i != $#path) {
return ELOOP() if ++$nsymlinks >= $ELOOP_LIMIT;
my $linkpath = $f->{content};
# cannot leave the filesystem; must be relative
return EACCESS() if $linkpath =~ m{\A /}xms;
splice @path, $i + 1, 0, split m{/}xms, $linkpath;
}
}
push @dirs, $f;
}
return $dirs[-1] || ENOENT();
}
1;
lib/Fuse/PDF/FS.pm view on Meta::CPAN
return $dirs->[-1];
}
sub _readpath {
my ($self, $path, $parent, $nsymlinks) = @_;
$nsymlinks ||= 0;
my @dirs = ($self->{fs}->{root}->{value});
my @path = split m{/}xms, $path;
my @realpath;
for (my $i = 0; $i < @path; ++$i) { ##no critic(ProhibitCStyleForLoops)
my $entry = $path[$i];
next if q{} eq $entry;
my $type = $dirs[-1]->{type}->{value};
return ENOTDIR() if 'd' ne $type;
next if q{.} eq $entry;
if (q{..} eq $entry) {
lib/Fuse/PDF/FS.pm view on Meta::CPAN
}
my $f = $next->{value};
if ('l' eq $f->{type}->{value}) {
if ($i != $#path) {
return ELOOP() if ++$nsymlinks >= $ELOOP_LIMIT;
my $linkpath = $f->{content}->{value};
# cannot leave the filesystem
return EACCESS() if $linkpath =~ m{\A /}xms;
splice @path, $i, 1, split m{/}xms, $linkpath;
return $self->_readpath((join q{/}, @path), $parent, $nsymlinks);
}
}
push @dirs, $f;
}
return 0, \@dirs, \@realpath;
}
sub _newfile {
( run in 1.295 second using v1.01-cache-2.11-cpan-71847e10f99 )