| 1 | package D64::Disk::Dir::Item; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | D64::Disk::Dir::Item - Handling individual Commodore (D64/D71/D81) disk image directory items in pure Perl | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | use D64::Disk::Dir::Item qw(:all); | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | # Create a new disk image directory item instance: | ||||||||||||||||||||||||||||||||||||||||||
| 12 | my $item = D64::Disk::Dir::Item->new($data); | ||||||||||||||||||||||||||||||||||||||||||
| 13 | my $item = D64::Disk::Dir::Item->new(@data); | ||||||||||||||||||||||||||||||||||||||||||
| 14 | my $item = D64::Disk::Dir::Item->new(\@data); | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Fetch item data as a scalar of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 17 | my $data = $item->data(); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # Fetch item data as an array of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 19 | my @data = $item->data(); | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # Update item providing 30 bytes of scalar data: | ||||||||||||||||||||||||||||||||||||||||||
| 22 | $item->data($data); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # Update item given array with 30 bytes of data: | ||||||||||||||||||||||||||||||||||||||||||
| 24 | $item->data(@data); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | $item->data(\@data); | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Get/set the actual file type: | ||||||||||||||||||||||||||||||||||||||||||
| 28 | my $type = $item->type(); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | $item->type($type); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # Get/set "closed" flag (when not set produces "*", or "splat" files): | ||||||||||||||||||||||||||||||||||||||||||
| 32 | my $is_closed = $item->closed(); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | $item->closed($is_closed); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | # Get/set "locked" flag (when set produces ">" locked files): | ||||||||||||||||||||||||||||||||||||||||||
| 36 | my $is_locked = $item->locked(); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | $item->locked($is_locked); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | # Get/set track location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 40 | my $track = $item->track(); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | $item->track($track); | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # Get/set sector location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 44 | my $sector = $item->sector(); | ||||||||||||||||||||||||||||||||||||||||||
| 45 | $item->sector($sector); | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # Get/set 16 character filename (in CBM ASCII, padded with $A0): | ||||||||||||||||||||||||||||||||||||||||||
| 48 | my $name = $item->name(); | ||||||||||||||||||||||||||||||||||||||||||
| 49 | $item->name($name); | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # Get/set track location of first side-sector block (REL file only): | ||||||||||||||||||||||||||||||||||||||||||
| 52 | my $side_track = $item->side_track(); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | $item->side_track($side_track); | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | # Get/set sector location of first side-sector block (REL file only): | ||||||||||||||||||||||||||||||||||||||||||
| 56 | my $side_sector = $item->side_sector(); | ||||||||||||||||||||||||||||||||||||||||||
| 57 | $item->side_sector($side_sector); | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | # Get/set relative file record length (REL file only): | ||||||||||||||||||||||||||||||||||||||||||
| 60 | my $record_length = $item->record_length(); | ||||||||||||||||||||||||||||||||||||||||||
| 61 | $item->record_length($record_length); | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | # Get/set file size in sectors: | ||||||||||||||||||||||||||||||||||||||||||
| 64 | my $size = $item->size(); | ||||||||||||||||||||||||||||||||||||||||||
| 65 | $item->size($size); | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | # Print out formatted disk image directory item: | ||||||||||||||||||||||||||||||||||||||||||
| 68 | $item->print(); | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | # Validate item data against all possible errors: | ||||||||||||||||||||||||||||||||||||||||||
| 71 | my $is_valid = $item->validate(); | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # Check if directory item contains information about the actual disk file: | ||||||||||||||||||||||||||||||||||||||||||
| 74 | my $is_empty = $item->empty(); | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | # Check if directory item is writable and can be replaced by any new file: | ||||||||||||||||||||||||||||||||||||||||||
| 77 | my $is_writable = $item->writable(); | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # Clone disk directory item: | ||||||||||||||||||||||||||||||||||||||||||
| 80 | my $clone = $item->clone(); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # Check if filename matches given CBM ASCII pattern: | ||||||||||||||||||||||||||||||||||||||||||
| 83 | my $is_matched = $item->match_name($petscii_pattern); | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # Convert any given file type into its three-letter printable string representation: | ||||||||||||||||||||||||||||||||||||||||||
| 86 | my $string = D64::Disk::Dir::Item->type_to_string($type); | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | C<D64::Disk::Dir::Item> provides a helper class for C<D64::Disk::Layout> module, enabling users to manipulate individual directory entries in an object oriented way without the hassle of worrying about the meaning of individual bits and bytes describing each entry in a disk directory. The whole family of C<D64::Disk::Layout> modules has been implemented in pure Perl as an alternative to Per Olofsson's "diskimage.c" library originally written in an ANSI C. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 8 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 8 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | our $VERSION = '0.08'; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 8 | ▶ | use parent 'Clone'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 8 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 8 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 8 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 8 | ▶ | use Text::Convert::PETSCII qw(:convert); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 8 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 8 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | XSLoader::load(__PACKAGE__, $VERSION); | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | # Setup package constant names: | ||||||||||||||||||||||||||||||||||||||||||
| 115 | our ( | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # File type constant names: | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 8 | $T_DEL, $T_SEQ, $T_PRG, $T_USR, $T_REL, $T_CBM, $T_DIR, | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | # Data offset constant names: | ||||||||||||||||||||||||||||||||||||||||||
| 120 | $I_TYPE, $I_NAME, $I_CLOSED, $I_LOCKED, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | $I_TRACK, $I_SECTOR, $I_SIZE_LO, $I_SIZE_HI, | ||||||||||||||||||||||||||||||||||||||||||
| 122 | $I_SIDE_TRACK, $I_SIDE_SECTOR, $I_RECORD_LENGTH, | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | # Other package constant names: | ||||||||||||||||||||||||||||||||||||||||||
| 125 | $ITEM_SIZE, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | # File type constant values: | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 8 | my %file_type_constants = ( | |||||||||||||||||||||||||||||||||||||||||
| 130 | T_DEL => 0b000, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | T_SEQ => 0b001, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | T_PRG => 0b010, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | T_USR => 0b011, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | T_REL => 0b100, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | T_CBM => 0b101, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | T_DIR => 0b110, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # Data offset constant values: | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 8 | my %data_offset_constants = ( | |||||||||||||||||||||||||||||||||||||||||
| 141 | I_TYPE => 0x00, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | I_CLOSED => 0x00, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | I_LOCKED => 0x00, | ||||||||||||||||||||||||||||||||||||||||||
| 144 | I_TRACK => 0x01, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | I_SECTOR => 0x02, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | I_NAME => 0x03, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | I_SIDE_TRACK => 0x13, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | I_SIDE_SECTOR => 0x14, | ||||||||||||||||||||||||||||||||||||||||||
| 149 | I_RECORD_LENGTH => 0x15, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | I_SIZE_LO => 0x1c, | ||||||||||||||||||||||||||||||||||||||||||
| 151 | I_SIZE_HI => 0x1d, | ||||||||||||||||||||||||||||||||||||||||||
| 152 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | # Other package constant values: | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 8 | my %other_package_constants = ( | |||||||||||||||||||||||||||||||||||||||||
| 156 | ITEM_SIZE => 0x1e, | ||||||||||||||||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | # Setup package constant values: | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 8 | my %all_constants = (%file_type_constants, %data_offset_constants, %other_package_constants); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 8 | ▶ | while (my ($name, $value) = each %all_constants) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 152 | ▶ | if ($] < 5.008) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | eval sprintf q{ | |||||||||||||||||||||||||||||||||||||||||
| 164 | Readonly \\$%s => %d; | ||||||||||||||||||||||||||||||||||||||||||
| 165 | }, $name, $value; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 152 | eval sprintf q{ | |||||||||||||||||||||||||||||||||||||||||
| 169 | Readonly $%s => %d; | ||||||||||||||||||||||||||||||||||||||||||
| 170 | }, $name, $value; | ||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 8 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 8 | our %EXPORT_TAGS = (); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 8 | $EXPORT_TAGS{'types'} = [ qw($T_DEL $T_SEQ $T_PRG $T_USR $T_REL $T_CBM $T_DIR) ]; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 8 | $EXPORT_TAGS{'all'} = [ @{$EXPORT_TAGS{'types'}} ]; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 8 | our @EXPORT_OK = ( @{$EXPORT_TAGS{'all'}} ); | |||||||||||||||||||||||||||||||||||||||||
| 179 | 8 | our @EXPORT = qw(); | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | Create an instance of a C<D64::Disk::Dir::Item> class as an empty directory entry: | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | my $item = D64::Disk::Dir::Item->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | Create an instance of a C<D64::Disk::Dir::Item> class providing 30 bytes of data retrieved from a disk directory: | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | my $item = D64::Disk::Dir::Item->new(data => $data); | ||||||||||||||||||||||||||||||||||||||||||
| 190 | my $item = D64::Disk::Dir::Item->new(data => \@data); | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 149 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 149 | my ($this) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 149 | ▶ | my $class = ref ($this) || $this; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table66%2/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 149 | my $object = $class->_init(); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 149 | my $self = bless $object, $class; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 149 | ▶ | $self->data(@_) if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 143 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 149 | ▶ | sub _init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 149 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 149 | my @object = map { chr 0x00 } (0x01 .. $ITEM_SIZE); | |||||||||||||||||||||||||||||||||||||||||
| 206 | 149 | return \@object; | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head2 data | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | Fetch item data as a scalar of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | my $data = $item->data(); | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | Fetch item data as an array of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | my @data = $item->data(); | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | Update item providing 30 bytes of scalar data retrieved from a disk directory: | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | $item->data($data); | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | Update item given array with 30 bytes of data retrieved from a disk directory: | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | $item->data(@data); | ||||||||||||||||||||||||||||||||||||||||||
| 226 | $item->data(\@data); | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 134 | ▶ | sub data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 134 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 134 | ▶ | if (scalar @args > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 114 | ▶ | if (scalar @args == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 17 | my ($arg) = @args; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 17 | ▶ | if (ref $arg eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 6 | @args = @{$arg}; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 114 | ▶ | if (scalar @args == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 11 | my ($arg) = @args; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 11 | ▶ | unless (ref $arg) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 11 | ▶ | unless (length $arg == 30) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 4 | die q{Unable to set directory item data: Invalid length of data}; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 7 | @{$self} = split //, $arg; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | die q{Unable to set directory item data: Invalid arguments given}; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | elsif (scalar @args == 30) { | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 99 | ▶ | for (my $i = 0; $i < @args; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2892 | my $byte_value = $args[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 2892 | ▶ | unless ($self->_is_valid_data_type($byte_value)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 2 | die sprintf q{Invalid data type at offset %d (%s)}, $i, ref $args[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 2890 | ▶ | unless ($self->_is_valid_byte_value($byte_value)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | die sprintf q{Invalid byte value at offset %d ($%x)}, $i, $byte_value; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 95 | @{$self} = @args; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 4 | die q{Unable to set directory item data: Invalid amount of data}; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 122 | ▶ | return unless defined wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 23 | ▶ | return wantarray ? @{$self} : join '', @{$self}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 2943 | ▶ | sub _is_valid_data_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_data_type: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 2943 | my ($self, $byte_value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 2943 | ▶ | unless (ref $byte_value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 2935 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 8 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 2890 | ▶ | sub _is_valid_byte_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_byte_value: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 2890 | my ($self, $byte_value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 2890 | ▶ | if (length ($byte_value) == 1 && ord ($byte_value) >= 0x00 && ord ($byte_value) <= 0xff) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
length $byte_value == 1 and ord $byte_value >= 0 and ord $byte_value <= 255
length $byte_value == 1 and ord $byte_value >= 0
MC/DC33%1/3
length $byte_value == 1 and ord $byte_value >= 0 and ord $byte_value <= 255
length $byte_value == 1
ord $byte_value >= 0
ord $byte_value <= 255
Truth table50%2/4
A and B and C
A= length $byte_value == 1B= ord $byte_value >= 0C= ord $byte_value <= 255
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 2888 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 33 | ▶ | sub _is_valid_number_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_number_value: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 33 | my ($self, $number_value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 33 | ▶ | if ($self->is_int($number_value) && $number_value >= 0x00 && $number_value <= 0xff) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$self->is_int($number_value) and $number_value >= 0 and $number_value <= 255
$self->is_int($number_value) and $number_value >= 0
MC/DC66%2/3
$self->is_int($number_value) and $number_value >= 0 and $number_value <= 255
$self->is_int($number_value)
$number_value >= 0
$number_value <= 255
Truth table75%3/4
A and B and C
A= $self->is_int($number_value)B= $number_value >= 0C= $number_value <= 255
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 23 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 10 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 24 | ▶ | sub is_valid_string_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_valid_string_value: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 24 | my ($self, $string_value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 8 | ▶ | no bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 24 | ▶ | unless (grep { ord ($_) < 0x00 || ord ($_) > 0xff } split //, $string_value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ord $_ < 0 || ord $_ > 255
MC/DC50%1/2
ord $_ < 0 || ord $_ > 255
ord $_ < 0
ord $_ > 255
Truth table66%2/3
A || B
A= ord $_ < 0B= ord $_ > 255
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 23 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =head2 bytes | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | C<bytes> is simply a convenient alias for C<data>. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Fetch item data as a scalar of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | my $bytes = $item->bytes(); | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | Fetch item data as an array of 30 bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | my @bytes = $item->bytes(); | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | Update item providing 30 bytes of scalar data retrieved from a disk directory: | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | $item->bytes($bytes); | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | Update item given array with 30 bytes of data retrieved from a disk directory: | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | $item->bytes(@bytes); | ||||||||||||||||||||||||||||||||||||||||||
| 334 | $item->bytes(\@bytes); | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 8 | *bytes = \&data; | |||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | =head2 type | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | Get the actual file type: | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | my $type = $item->type(); | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | Set the actual file type: | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | $item->type($type); | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | The following file type constants are the only valid values that may be used to update current item type: C<$T_DEL>, C<$T_SEQ>, C<$T_PRG>, C<$T_USR>, C<$T_REL>, C<$T_CBM>, and C<$T_DIR>. | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 111 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 111 | my ($self, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 111 | ▶ | if (defined $type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 42 | ▶ | if (ref $type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | die q{Invalid file type constant (scalar value expected)}; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 41 | ▶ | unless ($self->is_int($type)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | die q{Invalid file type constant (type constant expected)}; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 40 | ▶ | if ($type - ($type & 0b1111)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | die q{Invalid file type constant (only bits 0-3 can be set)}; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 39 | my @valid_values = (0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110); | |||||||||||||||||||||||||||||||||||||||||
| 368 | 39 | ▶ | unless (grep { $_ == $type } @valid_values) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | die q{Illegal file type constant}; | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 37 | $self->[$I_TYPE] = chr ((ord ($self->[$I_TYPE]) & 0b11110000) | $type); | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 106 | return ord ($self->[$I_TYPE]) & 0b1111; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | =head2 closed | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | Get "closed" flag: | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | my $is_closed = $item->closed(); | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | Returns true when "closed" flag is set, and false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | Set "closed" flag: | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | $item->closed($is_closed); | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | When "closed" flag is not set, it produces "*", or "splat" files. | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 31 | ▶ | sub closed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
closed: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 31 | my ($self, $is_closed) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 31 | ▶ | if (defined $is_closed) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 13 | ▶ | if (ref $is_closed) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | die q{Invalid "closed" flag}; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 12 | ▶ | my $closed_bit = $is_closed ? 0b10000000 : 0b00000000; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 12 | $self->[$I_CLOSED] = chr ((ord ($self->[$I_CLOSED]) & 0b01111111) | $closed_bit); | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 30 | return (ord ($self->[$I_CLOSED]) & 0b10000000) == 0b10000000; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | =head2 locked | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | Get "locked" flag: | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | my $is_locked = $item->locked(); | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | Returns true when "locked" flag is set, and false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | Set "locked" flag: | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | $item->locked($is_locked); | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | When "locked" flag is set, it produces ">" locked files. | ||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 25 | ▶ | sub locked { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
locked: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 25 | my ($self, $is_locked) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 25 | ▶ | if (defined $is_locked) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 11 | ▶ | if (ref $is_locked) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 1 | die q{Invalid "locked" flag}; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 10 | ▶ | my $locked_bit = $is_locked ? 0b01000000 : 0b00000000; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 10 | $self->[$I_LOCKED] = chr ((ord ($self->[$I_LOCKED]) & 0b10111111) | $locked_bit); | |||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 24 | return (ord ($self->[$I_LOCKED]) & 0b01000000) == 0b01000000; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | =head2 track | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | Get track location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | my $track = $item->track(); | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | Set track location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | $item->track($track); | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 21 | ▶ | sub track { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
track: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 21 | my ($self, $track) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 21 | ▶ | if (defined $track) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 9 | ▶ | unless ($self->_is_valid_data_type($track)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 1 | die sprintf q{Invalid type (%s) of track location of first sector of file (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 8 | ▶ | unless ($self->_is_valid_number_value($track)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | die sprintf q{Invalid value (%s) of track location of first sector of file (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 6 | $self->[$I_TRACK] = pack 'C', $track; | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 18 | return unpack 'C', $self->[$I_TRACK]; | |||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | =head2 sector | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | Get sector location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | my $sector = $item->sector(); | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | Set sector location of first sector of file: | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | $item->sector($sector); | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 21 | ▶ | sub sector { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sector: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | 21 | my ($self, $sector) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 21 | ▶ | if (defined $sector) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 9 | ▶ | unless ($self->_is_valid_data_type($sector)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | die sprintf q{Invalid type (%s) of sector location of first sector of file (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | 8 | ▶ | unless ($self->_is_valid_number_value($sector)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | die sprintf q{Invalid value (%s) of sector location of first sector of file (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 6 | $self->[$I_SECTOR] = pack 'C', $sector; | |||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 18 | return unpack 'C', $self->[$I_SECTOR]; | |||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | =head2 name | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | Get 16 character filename: | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | my $name = $item->name(); | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | Returned value is a CBM ASCII string. Unless specified otherwise, it will be padded with C<$A0>. | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | Get filename (without C<$A0> padding): | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | my $name = $item->name(padding_with_a0 => 0); | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | C<padding_with_a0> input parameter defaults to C<1>. That means every time filename is fetched from a C<D64::Disk::Dir::Item> object, length of a retrieved string will be 16 characters. | ||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | Set 16 character filename: | ||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | $item->name($name); | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | Input name parameter is expected to be CBM ASCII string. Unless specified otherwise, it will be padded with C<$A0>. | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | Set 16 character filename (without C<$A0> padding): | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | $item->name($name, padding_with_a0 => 0); | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | C<padding_with_a0> input parameter defaults to C<1>. That means every time filename is written into a C<D64::Disk::Dir::Item> object, it gets complemented with additional C<$A0> bytes up to the maximum length of a filename, which is 16 bytes. Thus by default 16 characters of filename data are always stored in a disk directory item. | ||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | In order to convert a PETSCII string to an ASCII string and vice versa, use the following subroutines provided by C<Text::Convert::PETSCII> module: | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | use Text::Convert::PETSCII qw/:all/; | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | my $ascii_name = petscii_to_ascii($petscii_name); | ||||||||||||||||||||||||||||||||||||||||||
| 524 | my $petscii_name = ascii_to_petscii($ascii_name); | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | See L<Text::Convert::PETSCII> module description for more details on ASCII/PETSCII text conversion. | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 100 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 100 | my ($self, @options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 100 | my $name; | |||||||||||||||||||||||||||||||||||||||||
| 534 | 100 | ▶ | if (scalar (@options) % 2 == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 27 | $name = shift @options; | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 100 | my %options = @options; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 100 | ▶ | $options{padding_with_a0} = 1 if not exists $options{padding_with_a0}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | 100 | ▶ | if (defined $name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 27 | ▶ | unless ($self->is_str($name)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 2 | die sprintf q{Invalid type (%s) of filename (string value expected)}, $self->_dump($name); | |||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 25 | ▶ | if (length $name > 16) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 1 | die sprintf q{Too long (%s) filename (maximum 16 PETSCII characters allowed)}, $self->_dump($name); | |||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | 24 | ▶ | unless ($self->is_valid_string_value($name)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | die sprintf q{Invalid string (%s) of filename (PETSCII string expected)}, $self->_dump($name); | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | 23 | ▶ | if ($options{padding_with_a0}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 14 | $self->[$I_NAME + $_] = chr 0xa0 for (0 .. 15); | |||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | 23 | ▶ | for (my $i = 0; $i < length $name; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 554 | 248 | $self->[$I_NAME + $i] = substr $name, $i, 1; | |||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 96 | my $name_length = $I_NAME + 15; | |||||||||||||||||||||||||||||||||||||||||
| 559 | 96 | ▶ | unless ($options{padding_with_a0}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 62 | ▶ | while (ord ($self->[$name_length]) == 0xa0 && $name_length >= $I_NAME) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ord $self->[$name_length] == 160 and $name_length >= $D64::Disk::Dir::Item::I_NAME
MC/DC50%1/2
ord $self->[$name_length] == 160 and $name_length >= $D64::Disk::Dir::Item::I_NAME
ord $self->[$name_length] == 160
$name_length >= $D64::Disk::Dir::Item::I_NAME
Truth table66%2/3
A and B
A= ord $self->[$name_length] == 160B= $name_length >= $D64::Disk::Dir::Item::I_NAME
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 592 | $name_length--; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 96 | $name = join '', @{$self}[$I_NAME..$name_length]; | |||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | 96 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | =head2 side_track | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | Get track location of first side-sector block: | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | my $side_track = $item->side_track(); | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | A track location of first side-sector block is returned for relative files only, an undefined value otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | Set track location of first side-sector block: | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | $item->side_track($side_track); | ||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | When attempting to assign track location of first side-sector block for a non-relative file, an exception will be thrown. | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | 12 | ▶ | sub side_track { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
side_track: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | 12 | my ($self, $side_track) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 12 | ▶ | if (defined $side_track) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | 7 | ▶ | unless ($self->type() eq $T_REL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | die sprintf q{Illegal file type ('%s') encountered when attempting to set track location of first side-sector block ('rel' files only)}, $self->type_to_string($self->type()); | |||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | 6 | ▶ | unless ($self->_is_valid_data_type($side_track)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | die sprintf q{Invalid type (%s) of track location of first side-sector block of file (single byte expected)}, $self->_dump($side_track); | |||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 5 | ▶ | unless ($self->_is_valid_number_value($side_track)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 2 | die sprintf q{Invalid value (%s) of track location of first side-sector block of file (single byte expected)}, $self->_dump($side_track); | |||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 3 | $self->[$I_SIDE_TRACK] = pack 'C', $side_track; | |||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 8 | ▶ | return unless $self->type() eq $T_REL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 7 | return unpack 'C', $self->[$I_SIDE_TRACK]; | |||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | =head2 side_sector | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | Get sector location of first side-sector block: | ||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | my $side_sector = $item->side_sector(); | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | A sector location of first side-sector block is returned for relative files only, an undefined value otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | Set sector location of first side-sector block: | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | $item->side_sector($side_sector); | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | When attempting to assign sector location of first side-sector block for a non-relative file, an exception will be thrown. | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 12 | ▶ | sub side_sector { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
side_sector: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 12 | my ($self, $side_sector) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 12 | ▶ | if (defined $side_sector) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | 7 | ▶ | unless ($self->type() eq $T_REL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 1 | die sprintf q{Illegal file type ('%s') encountered when attempting to set sector location of first side-sector block ('rel' files only)}, $self->type_to_string($self->type()); | |||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||
| 629 | 6 | ▶ | unless ($self->_is_valid_data_type($side_sector)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | die sprintf q{Invalid type (%s) of sector location of first side-sector block of file (single byte expected)}, $self->_dump($side_sector); | |||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||
| 632 | 5 | ▶ | unless ($self->_is_valid_number_value($side_sector)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 2 | die sprintf q{Invalid value (%s) of sector location of first side-sector block of file (single byte expected)}, $self->_dump($side_sector); | |||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||
| 635 | 3 | $self->[$I_SIDE_SECTOR] = pack 'C', $side_sector; | |||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 8 | ▶ | return unless $self->type() eq $T_REL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 7 | return unpack 'C', $self->[$I_SIDE_SECTOR]; | |||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||
| 643 | =head2 record_length | ||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | Get relative file record length: | ||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | my $record_length = $item->record_length(); | ||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | A relative file record length is returned for relative files only, an undefined value otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | Get relative file record length (relative file only, maximum value 254): | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | $item->record_length($record_length); | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | When attempting to assign relative file record length for a non-relative file or a record length greater than 254, an exception will be thrown. | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | 15 | ▶ | sub record_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
record_length: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | 15 | my ($self, $record_length) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | 15 | ▶ | if (defined $record_length) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 9 | ▶ | unless ($self->type() eq $T_REL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | die sprintf q{Illegal file type ('%s') encountered when attempting to set record length ('rel' files only)}, $self->type_to_string($self->type()); | |||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 8 | ▶ | unless ($self->_is_valid_data_type($record_length)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 667 | 1 | die sprintf q{Invalid type (%s) of relative file record length (single byte expected)}, $self->_dump($record_length); | |||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | 7 | ▶ | unless ($self->_is_valid_number_value($record_length)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | die sprintf q{Invalid value (%s) of relative file record length (single byte expected)}, $self->_dump($record_length); | |||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||
| 672 | 5 | ▶ | unless ($record_length >= 0x00 && $record_length < 0xff) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$record_length >= 0 and $record_length < 255
MC/DC50%1/2
$record_length >= 0 and $record_length < 255
$record_length >= 0
$record_length < 255
Truth table66%2/3
A and B
A= $record_length >= 0B= $record_length < 255
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | die sprintf q{Invalid value (%s) of relative file record length (maximum allowed value 254)}, $self->_dump($record_length); | |||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 4 | $self->[$I_RECORD_LENGTH] = pack 'C', $record_length; | |||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 10 | ▶ | return unless $self->type() eq $T_REL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||
| 680 | 9 | return unpack 'C', $self->[$I_RECORD_LENGTH]; | |||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | =head2 size | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | Get file size in sectors: | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | my $size = $item->size(); | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | The approximate file size in bytes is <= number_of_sectors * 254. | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | Set file size in sectors: | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | $item->size($size); | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | 27 | ▶ | sub size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 27 | my ($self, $size) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | 27 | ▶ | if (defined $size) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 701 | 13 | ▶ | unless ($self->_is_valid_data_type($size) && $self->is_int($size)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->_is_valid_data_type($size) and $self->is_int($size)
MC/DC100%2/2
$self->_is_valid_data_type($size) and $self->is_int($size)
$self->_is_valid_data_type($size)
$self->is_int($size)
Truth table100%3/3
A and B
A= $self->_is_valid_data_type($size)B= $self->is_int($size)
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | 2 | die sprintf q{Invalid type (%s) of file size (integer value expected)}, $self->_dump($size); | |||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 704 | 11 | ▶ | unless ($size >= 0x0000 && $size <= 0xffff) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$size >= 0 and $size <= 65535
MC/DC50%1/2
$size >= 0 and $size <= 65535
$size >= 0
$size <= 65535
Truth table66%2/3
A and B
A= $size >= 0B= $size <= 65535
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | die sprintf q{Invalid value (%s) of file size (maximum allowed value %d)}, $self->_dump($size), 0xffff; | |||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 10 | my $size_lo = $size % 0x0100; | |||||||||||||||||||||||||||||||||||||||||
| 709 | 10 | my $size_hi = int($size / 0x0100); | |||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 10 | $self->[$I_SIZE_LO] = pack 'C', $size_lo; | |||||||||||||||||||||||||||||||||||||||||
| 712 | 10 | $self->[$I_SIZE_HI] = pack 'C', $size_hi; | |||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 24 | my $size_lo = unpack 'C', $self->[$I_SIZE_LO]; | |||||||||||||||||||||||||||||||||||||||||
| 716 | 24 | my $size_hi = unpack 'C', $self->[$I_SIZE_HI]; | |||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | # Since a scalar value of a double type (NV) will always be loaded as the result | ||||||||||||||||||||||||||||||||||||||||||
| 719 | # of multiplication in Perl 5.6.2, we need to force an integer value into an SV: | ||||||||||||||||||||||||||||||||||||||||||
| 720 | 24 | return $self->set_iok($size_lo + 256 * $size_hi); | |||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | =head2 exact_size | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | Get exact file size in bytes: | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | my $exact_size = $item->exact_size(disk_image => $disk_image_ref); | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | Warning! Do not use! This method has not been implemented (yet)! | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | sub exact_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exact_size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | # TODO: add another input parameter: required provision of a D64 disk image data... | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | die q{Not yet implemented}; | |||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | =head2 print | ||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | Print out formatted disk image directory item: | ||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||
| 745 | $item->print(fh => $fh, as_petscii => $as_petscii, verbose => $verbose); | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | C<fh> defaults to the standard output. C<as_petscii> defaults to false (meaning that ASCII characters will be printed out by default). C<verbose> defaults to false (changing it to true will additionally print out file's track and sector values). | ||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 6 | ▶ | sub print { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | 6 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 6 | my $fh = $args{fh}; | |||||||||||||||||||||||||||||||||||||||||
| 755 | 6 | my $as_petscii = $args{as_petscii}; | |||||||||||||||||||||||||||||||||||||||||
| 756 | 6 | my $verbose = $args{verbose}; | |||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | 6 | ▶ | $fh ||= *STDOUT; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$fh ||= *STDOUT
MC/DC0%0/2
$fh ||= *STDOUT
$fh
*STDOUT
Truth table33%1/3
A ||= B
A= $fhB= *STDOUT
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 6 | $fh->binmode(':bytes'); | |||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | 6 | my $stdout = select $fh; | |||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | 6 | ▶ | if ($as_petscii) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 764 | 2 | my $type = $self->type_to_string($self->type(), 1); | |||||||||||||||||||||||||||||||||||||||||
| 765 | 2 | ▶ | my $closed = $self->closed() ? 0x20 : 0x2a; # "*" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 2 | ▶ | my $locked = $self->locked() ? 0x3c : 0x20; # "<" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | 2 | my $track = sprintf "%2d", $self->track(); | |||||||||||||||||||||||||||||||||||||||||
| 768 | 2 | my $sector = sprintf "%2d", $self->sector(); | |||||||||||||||||||||||||||||||||||||||||
| 769 | 2 | my $size = ascii_to_petscii($self->size()); | |||||||||||||||||||||||||||||||||||||||||
| 770 | 2 | my $name = sprintf "\"%s\"", $self->name(padding_with_a0 => 0); | |||||||||||||||||||||||||||||||||||||||||
| 771 | 2 | $name =~ s/\x00//g; # align file type string to the right column | |||||||||||||||||||||||||||||||||||||||||
| 772 | 2 | ▶ | if ($verbose) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | printf "%-4d %-18s%c%s%c %s %s\n", $size, $name, $closed, $type, $locked, $track, $sector; | |||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||
| 775 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 776 | 2 | printf "%-4d %-18s%c%s%c\n", $size, $name, $closed, $type, $locked; | |||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||
| 779 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 780 | 4 | my $type = $self->type_to_string($self->type()); | |||||||||||||||||||||||||||||||||||||||||
| 781 | 4 | ▶ | my $closed = $self->closed() ? ord ' ' : ord '*'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 782 | 4 | ▶ | my $locked = $self->locked() ? ord '<' : ord ' '; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | 4 | my $track = sprintf "%2d", petscii_to_ascii $self->track(); | |||||||||||||||||||||||||||||||||||||||||
| 784 | 4 | my $sector = sprintf "%2d", petscii_to_ascii $self->sector(); | |||||||||||||||||||||||||||||||||||||||||
| 785 | 4 | my $size = $self->size(); | |||||||||||||||||||||||||||||||||||||||||
| 786 | 4 | my $name = sprintf "\"%s\"", petscii_to_ascii($self->name(padding_with_a0 => 0)); | |||||||||||||||||||||||||||||||||||||||||
| 787 | 4 | $name =~ s/\x00//g; # align file type string to the right column | |||||||||||||||||||||||||||||||||||||||||
| 788 | 4 | ▶ | if ($verbose) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | 2 | printf "%-4d %-18s%c%s%c %s %s\n", $size, $name, $closed, $type, $locked, $track, $sector; | |||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 791 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 792 | 2 | printf "%-4d %-18s%c%s%c\n", $size, $name, $closed, $type, $locked; | |||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | 6 | select $stdout; | |||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | =head2 validate | ||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | Validate item data against all possible errors: | ||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | my $is_valid = $item->validate(); | ||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||
| 807 | Returns true when all item data is valid, and false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | 3 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=1 SCAR=0.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 812 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | 3 | my $test = $self->new(); | |||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 3 | ▶ | my $is_valid = try { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=31.9
| |||||||||||||||||||||||||||||||||||||||||||
| 817 | 3 | my $data = $self->data(); | |||||||||||||||||||||||||||||||||||||||||
| 818 | 3 | ▶ | die unless defined $data; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 819 | 3 | $test->data($data); | |||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | 3 | my $type = $self->type(); | |||||||||||||||||||||||||||||||||||||||||
| 822 | 3 | ▶ | die unless defined $type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 3 | $test->type($type); | |||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||
| 825 | 2 | my $closed = $self->closed(); | |||||||||||||||||||||||||||||||||||||||||
| 826 | 2 | ▶ | die unless defined $closed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 2 | $test->closed($closed); | |||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 2 | my $locked = $self->locked(); | |||||||||||||||||||||||||||||||||||||||||
| 830 | 2 | ▶ | die unless defined $locked; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 831 | 2 | $test->locked($locked); | |||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||
| 833 | 2 | my $track = $self->track(); | |||||||||||||||||||||||||||||||||||||||||
| 834 | 2 | ▶ | die unless defined $track; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | 2 | $test->track($track); | |||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 2 | my $sector = $self->sector(); | |||||||||||||||||||||||||||||||||||||||||
| 838 | 2 | ▶ | die unless defined $sector; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 839 | 2 | $test->sector($sector); | |||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | 2 | my $name = $self->name(); | |||||||||||||||||||||||||||||||||||||||||
| 842 | 2 | ▶ | die unless defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | 2 | $test->name($name); | |||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | 2 | ▶ | if ($self->type() eq $T_REL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | my $side_track = $self->side_track(); | |||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | die unless defined $side_track; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | $test->side_track($side_track); | |||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | my $side_sector = $self->side_sector(); | |||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | ▶ | die unless defined $side_sector; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | $test->side_sector($side_sector); | |||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $record_length = $self->record_length(); | |||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | die unless defined $record_length; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | $test->record_length($record_length); | |||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | 2 | my $size = $self->size(); | |||||||||||||||||||||||||||||||||||||||||
| 861 | 2 | ▶ | die unless defined $size; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 2 | $test->size($size); | |||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||
| 866 | 1 | ▶ | catch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | 1 | 0; | |||||||||||||||||||||||||||||||||||||||||
| 868 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | 3 | return $is_valid; | |||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | =head2 empty | ||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | Check if directory item contains information about the actual disk file: | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | my $is_empty = $item->empty(); | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | True value will be returned when directory item object is empty. | ||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | 2 | ▶ | sub empty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 2 | my $is_empty = not grep { ord ($_) != 0x00 } @{$self}; | |||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 2 | return $is_empty; | |||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | =head2 writable | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | Check if slot occupied by this item in a disk directory is writable and can be replaced by any new file that would be written into disk: | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | my $is_writable = $item->writable(); | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||
| 897 | True value will be returned when directory item object is writable. | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | 4 | ▶ | sub writable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writable: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 902 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | 4 | ▶ | my $is_writable = !$self->closed() && $self->type() eq $T_DEL; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
!$self->closed && $self->type eq $D64::Disk::Dir::Item::T_DEL
MC/DC50%1/2
!$self->closed && $self->type eq $D64::Disk::Dir::Item::T_DEL
!$self->closed
$self->type eq $D64::Disk::Dir::Item::T_DEL
Truth table66%2/3
not(A) && B
A= !$self->closedB= $self->type eq $D64::Disk::Dir::Item::T_DEL
| |||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||
| 906 | 4 | return $is_writable; | |||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||
| 909 | =head2 clone | ||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | Clone disk directory item: | ||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||
| 913 | my $clone = $item->clone(); | ||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | =head2 match_name | ||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||
| 917 | Check if filename matches given CBM ASCII pattern: | ||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||
| 919 | my $is_matched = $item->match_name($petscii_pattern); | ||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | C<$petscii_pattern> is expected to be a CBM ASCII string containing optional wildcard characters. The following wildcards are allowed/recognized: | ||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||
| 925 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 926 | An asterisk C<*> character following any program name will yield successful match if filename is starting with that name. | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 929 | A question mark C<?> character used as a wildcard will match any character in a filename. | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | 29 | ▶ | sub match_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_name: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 936 | 29 | my ($self, $petscii_pattern) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||
| 938 | 29 | my $name = $self->name(padding_with_a0 => 0); | |||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||
| 940 | 29 | my @name = split //, $name; | |||||||||||||||||||||||||||||||||||||||||
| 941 | 29 | my @pattern = split //, $petscii_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | 29 | ▶ | for (my $i = 0; $i < @pattern; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 944 | 135 | my $match_pattern = ord $pattern[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 945 | 135 | ▶ | if ($match_pattern == 0x2a) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 946 | 14 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||
| 948 | 121 | my $character = $name[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 949 | 121 | ▶ | unless (defined $character && $match_pattern == 0x3f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $character and $match_pattern == 63
MC/DC100%2/2
defined $character and $match_pattern == 63
defined $character
$match_pattern == 63
Truth table100%3/3
A and B
A= defined $characterB= $match_pattern == 63
| |||||||||||||||||||||||||||||||||||||||||||
| 950 | 110 | ▶ | if (!defined $character || ord $character != $match_pattern) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $character or ord $character != $match_pattern
MC/DC100%2/2
not defined $character or ord $character != $match_pattern
not defined $character
ord $character != $match_pattern
Truth table100%3/3
not(A) or B
A= not defined $characterB= ord $character != $match_pattern
| |||||||||||||||||||||||||||||||||||||||||||
| 951 | 4 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | 11 | ▶ | if (@name == @pattern) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 957 | 7 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | 4 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | =head2 type_to_string | ||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||
| 965 | Convert given file type into its three-letter printable ASCII/PETSCII string representation: | ||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||
| 967 | my $string = D64::Disk::Dir::Item->type_to_string($type, $as_petscii); | ||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||
| 969 | C<as_petscii> defaults to false (meaning that ASCII characters will be returned by default). | ||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | 25 | ▶ | sub type_to_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type_to_string: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | 25 | my ($this, $type, $as_petscii) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||
| 976 | 25 | ▶ | unless ($as_petscii) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 977 | 15 | my @mapping = ( | |||||||||||||||||||||||||||||||||||||||||
| 978 | 'del', # $T_DEL | ||||||||||||||||||||||||||||||||||||||||||
| 979 | 'seq', # $T_SEQ | ||||||||||||||||||||||||||||||||||||||||||
| 980 | 'prg', # $T_PRG | ||||||||||||||||||||||||||||||||||||||||||
| 981 | 'usr', # $T_USR | ||||||||||||||||||||||||||||||||||||||||||
| 982 | 'rel', # $T_REL | ||||||||||||||||||||||||||||||||||||||||||
| 983 | 'cbm', # $T_CBM | ||||||||||||||||||||||||||||||||||||||||||
| 984 | 'dir', # $T_DIR | ||||||||||||||||||||||||||||||||||||||||||
| 985 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | 15 | ▶ | if ($type >= 0 && $type < @mapping) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type >= 0 and $type < @mapping
MC/DC50%1/2
$type >= 0 and $type < @mapping
$type >= 0
$type < @mapping
Truth table66%2/3
A and B
A= $type >= 0B= $type < @mapping
| |||||||||||||||||||||||||||||||||||||||||||
| 988 | 14 | return $mapping[$type] | |||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||
| 990 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 991 | 1 | return '???'; | |||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||
| 994 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 995 | 10 | my @mapping = ( | |||||||||||||||||||||||||||||||||||||||||
| 996 | '44454c', # $T_DEL | ||||||||||||||||||||||||||||||||||||||||||
| 997 | '534551', # $T_SEQ | ||||||||||||||||||||||||||||||||||||||||||
| 998 | '505247', # $T_PRG | ||||||||||||||||||||||||||||||||||||||||||
| 999 | '555352', # $T_USR | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | '52454c', # $T_REL | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | '43424d', # $T_CBM | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | '444952', # $T_DIR | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 10 | ▶ | if ($type >= 0 && $type < @mapping) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type >= 0 and $type < @mapping
MC/DC50%1/2
$type >= 0 and $type < @mapping
$type >= 0
$type < @mapping
Truth table66%2/3
A and B
A= $type >= 0B= $type < @mapping
| |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 9 | return pack 'H*', $mapping[$type]; | |||||||||||||||||||||||||||||||||||||||||
| 1007 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | 1 | return pack 'H*', '3f3f3f'; | |||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||
| 1014 | 23 | ▶ | sub _dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1015 | 23 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||
| 1017 | 23 | my $dump = Data::Dumper->new([$value])->Indent(0)->Terse(1)->Deepcopy(1)->Sortkeys(1)->Dump(); | |||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||
| 1019 | 23 | return $dump; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | 93 | ▶ | sub is_int { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_int: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1023 | 93 | my ($this, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||
| 1025 | 93 | return _is_int($var); | |||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 36 | ▶ | sub is_str { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_str: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1029 | 36 | my ($this, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | 36 | return _is_str($var); | |||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||
| 1034 | 2 | ▶ | sub magic_to_int { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
magic_to_int: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1035 | 2 | my ($this, $magic) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | 2 | return _magic_to_int($magic); | |||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | 24 | ▶ | sub set_iok { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_iok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1041 | 24 | my ($self, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | 24 | my $var_iok = _set_iok($var); | |||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | 24 | return $var_iok; | |||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | There are no known bugs at the moment. Please report any bugs or feature requests. | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | =head1 CAVEATS | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | No GEOS-specific properties are supported by accessor methods of this module. Due to low popularity of GEOS system and rare amount of GEOS D64 disk images available on the net, I have decided to intentionally skip implementation of C<VLIR> file type format here. Thus all the information needed for the windowing system (icon, window position, creation time/date) cannot be right now accessed conveniently without the knowledge of specific C<VLIR> format details. | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | =head1 EXPORT | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||
| 1058 | C<D64::Disk::Dir::Item> exports nothing by default. | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||
| 1060 | You may request the import of file type constants (C<$T_DEL>, C<$T_SEQ>, C<$T_PRG>, C<$T_USR>, C<$T_REL>, C<$T_CBM>, and C<$T_DIR>) individually. All of these constants can be explicitly imported from C<D64::Disk::Dir::Item> by using it with the ":types" tag. All constants can be explicitly imported from C<D64::Disk::Dir::Item> by using it with the ":all" tag. | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||
| 1064 | L<D64::Disk::Image>, L<D64::Disk::Layout>, L<Text::Convert::PETSCII>. | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||
| 1066 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | Pawel Krol, E<lt>pawelkrol@cpan.orgE<gt>. | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||
| 1072 | Version 0.08 (2023-05-12) | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||
| 1076 | Copyright 2013-2023 by Pawel Krol <pawelkrol@cpan.org>. | ||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||
| 1078 | This library is free open source software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||
| 1080 | PLEASE NOTE THAT IT COMES WITHOUT A WARRANTY OF ANY KIND! | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||
| 1082 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||
| 1084 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||