NAME
Archive::SCS::InMemory - In-memory SCS archive handler
SYNOPSIS
my $mem = Archive::SCS::InMemory->new;
# Add regular files:
$mem->add_entry('manifest.sii' => $manifest);
$mem->add_entry('def/env_data.sii' => $env_data);
# Add directory listing for the root dir:
$mem->add_entry( '' => {
dirs => [ 'def' ],
files => [ 'manifest.sii' ],
});
my $scs = Archive::SCS->new;
$scs->mount($mem);
DESCRIPTION
Represents a virtual SCS archive file entirely contained in memory. Use cases:
CI testing (this is why it exists, really)
Inject missing files or directory listings into an archive environment. Allows adding file names to orphans (if you know their names, that is).
Create archive files on disk from scratch. This assumes there is a way to create a new archive file from an Archive::SCS object.
Hash values used with this module must be in the internal format (currently, an 8-byte scalar PV in network byte order).
METHODS
add_entry
# Regular file:
$mem = $mem->add_entry($path => $file_contents);
# Directory listing:
$mem = $mem->add_entry($path => {
dirs => [ @subdirs ],
files => [ @filenames ],
});
entries
$entry_hashes = $mem->entries;
is_mounted
$bool = $mem->is_mounted;
list_dirs
@directories = $mem->list_dirs;
list_files
@files = $mem->list_files;
mount
$archive = $mem->mount;
new
$mem = Archive::SCS::InMemory->new;
read_dir_tree
$mem->read_dir_tree;
read_entry
$data = $mem->read_entry($hash);
unmount
$mem->unmount;
AUTHOR
COPYRIGHT
This software is copyright (c) 2024 by nautofon.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.