NAME
D64::Disk::Dir - Handling entire Commodore (D64/D71/D81) disk image directories (using Per Olofsson's "diskimage.c" library)
SYNOPSIS
use D64::Disk::Dir;
# Read entire D64/D71/D81 disk image directory from file on disk in one step:
my $d64DiskDirObj = D64::Disk::Dir->new($filename);
# Read entire D64/D71/D81 disk image directory from file on disk in two steps:
my $d64DiskDirObj = D64::Disk::Dir->new();
my $readOK = $d64DiskDirObj->read_dir($filename);
# Read new D64/D71/D81 disk directory replacing currently loaded dir with it:
my $readOK = $d64DiskDirObj->read_dir($filename);
# Get disk directory title converted to ASCII string:
my $convert2ascii = 1;
my $title = $d64DiskDirObj->get_title($convert2ascii);
# Get disk directory ID converted to ASCII string:
my $convert2ascii = 1;
my $diskID = $d64DiskDirObj->get_id($convert2ascii);
# Get number of blocks free:
my $blocksFree = $d64DiskDirObj->get_blocks_free();
# Get number of directory entries:
my $num_entries = $d64DiskDirObj->num_entries();
# Get directory entry at the specified position:
my $entryObj = $d64DiskDirObj->get_entry($index);
# Get binary file data from a directory entry at the specified position:
my $data = $d64DiskDirObj->get_file_data($index);
# Print out the entire directory content to the standard output:
$d64DiskDirObj->print_dir();
DESCRIPTION
This package provides an abstract layer above D64::Disk::Image module, enabling user to handle D64 disk image directories in a higher-level object-oriented way.
METHODS
new
Create empty D64::Disk::Dir
object without loading disk image directory yet:
my $d64DiskDirObj = D64::Disk::Dir->new();
Create new D64::Disk::Dir
object and read entire D64/D71/D81 disk image directory from file on disk for further access.
my $d64DiskDirObj = D64::Disk::Dir->new($filename);
A valid D64::Disk::Dir
object is returned upon success, an undefined value otherwise.
read_dir
Read entire D64/D71/D81 disk image directory from file on disk, replacing currently loaded directory (if any).
$d64DiskDirObj->read_dir($filename);
Returns true value upon success, and false otherwise.
get_title
Get 16 character disk directory title (PETSCII string):
my $convert2ascii = 0;
my $title = $d64DiskDirObj->get_title($convert2ascii);
Get disk directory title converted to ASCII string:
my $convert2ascii = 1;
my $title = $d64DiskDirObj->get_title($convert2ascii);
get_id
Get 5 character disk directory ID (PETSCII string):
my $convert2ascii = 0;
my $diskID = $d64DiskDirObj->get_id($convert2ascii);
Get disk directory ID converted to ASCII string:
my $convert2ascii = 1;
my $diskID = $d64DiskDirObj->get_id($convert2ascii);
get_blocks_free
Get number of blocks free:
my $blocksFree = $d64DiskDirObj->get_blocks_free();
num_entries
Get number of directory entries:
my $num_entries = $d64DiskDirObj->num_entries();
get_entry
Get directory entry at the specified position (index value must be a valid position equal or greater than 0 and less than number of directory entries):
my $entryObj = $d64DiskDirObj->get_entry($index);
Returns a valid D64::Disk::Dir::Entry object upon success, and false otherwise.
get_file_data
Get binary file data from a directory entry at the specified position:
my $data = $d64DiskDirObj->get_file_data($index);
Reads data from a file at the specified directory index position (index value must be a valid position equal or greater than 0 and less than number of directory entries). Returns binary file data (including its loading address) upon success, and an undefined value otherwise.
print_dir
Print out the entire directory content to any opened file handle (the standard output by default):
$d64DiskDirObj->print_dir($fh, { verbose => $verbose });
verbose
defaults to false (changing it to true will additionally print out all files' track, sector, and loading address values).
BUGS
There are no known bugs at the moment. Please report any bugs or feature requests.
EXPORT
None. No method is exported into the caller's namespace either by default or explicitly.
SEE ALSO
D64::Disk::Dir::Entry, D64::Disk::Dir::Iterator, D64::Disk::Image
AUTHOR
Pawel Krol, <pawelkrol@cpan.org>.
VERSION
Version 0.06 (2023-08-28)
COPYRIGHT AND LICENSE
This module is licensed under a slightly modified BSD license, the same terms as Per Olofsson's "diskimage.c" library and D64::Disk::Image Perl package it is based on, license contents are repeated below.
Copyright (c) 2003-2006, Per Olofsson All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diskimage.c website: https://paradroid.automac.se/diskimage/