NAME
File::Information::Inode - generic module for extracting information from filesystems
VERSION
version v0.03
SYNOPSIS
use File::Information;
my File::Information $instance = File::Information->new(%config);
my File::Information::Inode $inode = $instance->for_handle($handle);
my File::Information::Inode $inode = $instance->for_link($path)->inode;
Note: This package inherits from File::Information::Base.
This module represents an inode on a filesystem. An inode contains basic file metadata (such as type and size) and the file's content. Inodes are commonly represented by an inode number (but this is subject to filesystem implementation and limitations). In order to access inodes they most commonly need to have at least one hardlink pointing to them. See also File::Information::Link.
METHODS
filesystem
my File::Information::Filesystem $filesystem = $inode->filesystem([ %opts ]);
Provides access to the filesystem object for the filesystem this inode is on. Dies if no filesystem could be found.
Takes the following options (all optional):
default
-
The value to be returned when no filesystem could be found. This can also be
undef
which switches fromdie
-ing when no value is available to returningundef
.
tagpool
my File::Information::Tagpool $tagpool = $inode->tagpool;
# or:
my @tagpool = $inode->tagpool;
This method returns any tagpool instances this file is part of. If called in scalar context only one is returned and if none have been found this function die
s. If called in list context the list is returned and an empty list is returned in case none have been found.
If called in scalar context it is not clear which is returned in case the file is part of multiple pools. However the result is cached and for the same instance of this object always the same tagpool instance is returned.
peek
my $data = $inode->peek( [ %opts ] );
Peeks the first few bytes of a file. The main usage of this method is to check for magic numbers.
The following options (all optional) are supported:
wanted
-
The number of bytes wanted. If this number of bytes can't be provided less is returned.
required
-
The number of bytes that are needed. If this number of bytes can't be provided the method
die
s.
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2024 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)