| 1 | package D64::Disk::Layout::Sector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | D64::Disk::Layout::Sector - An abstraction layer over physical sector data of various Commodore disk image formats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | use D64::Disk::Layout::Sector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Create a new disk sector object instance: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | my $object = D64::Disk::Layout::Sector->new(data => $data, track => $track, sector => $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | my $object = D64::Disk::Layout::Sector->new(data => \@data, track => $track, sector => $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # Fetch sector data as a scalar of 256 bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | my $data = $object->data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Fetch sector data as an array of 256 bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | my @data = $object->data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # Update sector providing 256 bytes of scalar data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | $object->data($data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # Update sector given array with 256 bytes of data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | $object->data(@data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | $object->data(\@data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # Fetch the actual file contents from sector data as a scalar of allocated number of bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | my $file_data = $object->file_data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Fetch the actual file contents from sector data as an array of allocated number of bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | my @file_data = $object->file_data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Update the actual file contents providing number of scalar data bytes to allocate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $object->file_data($file_data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # Update the actual file contents given array with number of bytes of data to allocate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $object->file_data(@file_data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $object->file_data(\@file_data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Get/set track location of the object data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | my $track = $object->track(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | $object->track($track); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # Get/set sector location of the object data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | my $sector = $object->sector(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | $object->sector($sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # Check if first two bytes of data point to the next chunk of data in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | my $is_valid_ts_link = $object->is_valid_ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # Get/set track and sector link values to the next chunk of data in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | my ($track, $sector) = $object->ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | $object->ts_link($track, $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Check if first two bytes of data indicate index of the last allocated byte: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my $is_last_in_chain = $object->is_last_in_chain(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Get/set index of the last allocated byte within the sector data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | my $alloc_size = $object->alloc_size(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | $object->alloc_size($alloc_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # Check if sector object is empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | my $is_empty = $object->empty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # Set/clear boolean flag marking sector object as empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | $object->empty($empty); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Wipe out an entire sector data, and mark it as empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $object->clean(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # Print out formatted disk sector data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $object->print(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | C<D64::Disk::Layout::Sector> provides a helper class for C<D64::Disk::Layout> module and defines an abstraction layer over physical sector data of various Commodore disk image formats, enabling users to access and modify disk sector data in an object oriented way without the hassle of worrying about the meaning of individual bits and bytes, describing their function in a disk image layout. 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 6 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 6 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 6 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 6 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 6 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 6 | ▶ | use Text::Convert::PETSCII qw/:convert/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 6 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 6 | XSLoader::load(__PACKAGE__, $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # Data offset constants: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 6 | Readonly our $I_TS_POINTER_TRACK => 0x00; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 6 | Readonly our $I_TS_POINTER_SECTOR => 0x01; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 6 | Readonly our $I_ALLOC_SIZE => 0x01; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 6 | Readonly our $I_SECTOR_DATA => 0x02; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 6 | Readonly our $SECTOR_DATA_SIZE => 0x0100; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | Create an instance of a C<D64::Disk::Layout::Sector> class as an empty disk sector: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | my $object = D64::Disk::Layout::Sector->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | Create an instance of a C<D64::Disk::Layout::Sector> class providing 256 bytes of data retrieved from a disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | my $object = D64::Disk::Layout::Sector->new(data => $data, track => $track, sector => $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | my $object = D64::Disk::Layout::Sector->new(data => \@data, track => $track, sector => $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | C<$track> and C<$sector> values are expected to be single bytes, an exception will be thrown when non-byte or non-numeric or non-scalar value is provided (please note that a default value of C<undef> is internally translated into the value of C<0x00>). For more information about C<$data> and C<@data> validation, see the C<data> section below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 167 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 167 | my ($this, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 167 | ▶ | my $class = ref ($this) || $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 167 | my $object = $class->_init(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 167 | my $self = bless $object, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 167 | ▶ | if (%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 126 | ▶ | unless (defined $args{data}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | die sprintf q{Unable to initialize sector data: undefined value of data (%d bytes expected)}, $SECTOR_DATA_SIZE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 124 | ▶ | unless (defined $args{track}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | die q{Unable to initialize track property: undefined value of track (numeric value expected)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 123 | ▶ | unless (defined $args{sector}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | die q{Unable to initialize sector property: undefined value of sector (numeric value expected)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 122 | $self->data($args{data}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 113 | $self->track($args{track}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 109 | $self->sector($args{sector}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 147 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 168 | ▶ | sub _init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 168 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 168 | my @data = map { chr 0x00 } (0x01 .. $SECTOR_DATA_SIZE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 168 | my %object = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | data => \@data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | track => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | sector => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | is_empty => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 168 | return \%object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1666 | ▶ | sub _object_property { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_object_property: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1666 | my ($self, $name, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1666 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 548 | ▶ | $self->{$name} = ref $value ? dclone $value : $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 1666 | return $self->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 34059 | ▶ | sub _is_valid_byte_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_byte_value: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 34059 | my ($self, $byte_value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 34059 | ▶ | if (defined $byte_value && length ($byte_value) == 1 && ord ($byte_value) >= 0x00 && ord ($byte_value) <= 0xff) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
defined $byte_value and length $byte_value == 1 and ord $byte_value >= 0 and ord $byte_value <= 255
defined $byte_value and length $byte_value == 1 and ord $byte_value >= 0
defined $byte_value and length $byte_value == 1
MC/DC50%2/4
defined $byte_value and length $byte_value == 1 and ord $byte_value >= 0 and ord $byte_value <= 255
defined $byte_value
length $byte_value == 1
ord $byte_value >= 0
ord $byte_value <= 255
Truth table60%3/5
A and B and C and D
A= defined $byte_valueB= length $byte_value == 1C= ord $byte_value >= 0D= ord $byte_value <= 255
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 34051 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 8 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 279 | ▶ | sub _is_valid_number_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_number_value: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 279 | my ($self, $number_value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 279 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 234 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 45 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | =head2 data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | Fetch sector data as a scalar of 256 bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | my $data = $object->data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | Fetch sector data as an array of 256 bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | my @data = $object->data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | Update sector providing 256 bytes of scalar data retrieved from a disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $object->data($data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | C<$data> value is expected to be a scalar of 256 bytes in length, an exception will be thrown when non-scalar value or a scalar which does not have a length of 256 bytes or a scalar which contains wide non-byte character is provided. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | Update sector given array with 256 bytes of data retrieved from a disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | $object->data(@data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | $object->data(\@data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | C<@data> value is expected to be an array of 256 bytes in size, an exception will be thrown when non-array or an array with any other number of elements or an array with non-scalar byte values is provided. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 180 | ▶ | sub data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 180 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 180 | my $data = $self->_validate_data(args => \@args, min_size => $SECTOR_DATA_SIZE, max_size => $SECTOR_DATA_SIZE, what => 'sector'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 152 | ▶ | if (defined $data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 124 | $self->_object_property('data', $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # When data is set, object is no longer empty (unless it's filled with zeroes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 124 | my $is_valid_ts_link = $self->is_valid_ts_link(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 124 | my $alloc_size = $self->alloc_size(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 124 | ▶ | unless ($is_valid_ts_link || $alloc_size != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_valid_ts_link or $alloc_size != 0
MC/DC100%2/2
$is_valid_ts_link or $alloc_size != 0
$is_valid_ts_link
$alloc_size != 0
Truth table100%3/3
A or B
A= $is_valid_ts_linkB= $alloc_size != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 4 | $self->empty(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 120 | $self->empty(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 152 | ▶ | return unless defined wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 28 | $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 28 | ▶ | return wantarray ? @{$data} : join '', @{$data}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 220 | ▶ | sub _validate_data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_data: called CC=13 SCAR=25.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 220 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 220 | my @args = @{$args{args}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 220 | ▶ | return unless scalar @args > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # Convert arrayref parameter to an array: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 192 | ▶ | if (scalar @args == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 182 | my ($arg) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 182 | ▶ | if (ref $arg eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 149 | @args = @{$arg}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 192 | my $what = $args{what}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 192 | my $min_size = $args{min_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 192 | my $max_size = $args{max_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # Convert scalar parameter to an array: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 192 | ▶ | if (scalar @args == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 34 | my ($arg) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 34 | ▶ | unless (ref $arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 6 | ▶ | no bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 31 | ▶ | if (length ($arg) < $min_size || length ($arg) > $max_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
length $arg < $min_size or length $arg > $max_size
MC/DC100%2/2
length $arg < $min_size or length $arg > $max_size
length $arg < $min_size
length $arg > $max_size
Truth table100%3/3
A or B
A= length $arg < $min_sizeB= length $arg > $max_size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 8 | die sprintf q{Unable to set %s data: Invalid length of data}, $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 23 | @args = split //, $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 3 | die sprintf q{Unable to set %s data: Invalid arguments given}, $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 181 | ▶ | unless (scalar (@args) < $min_size || scalar (@args) > $max_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
scalar @args < $min_size or scalar @args > $max_size
MC/DC100%2/2
scalar @args < $min_size or scalar @args > $max_size
scalar @args < $min_size
scalar @args > $max_size
Truth table100%3/3
A or B
A= scalar @args < $min_sizeB= scalar @args > $max_size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 170 | ▶ | for (my $i = 0; $i < @args; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 34063 | my $byte_value = $args[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 34063 | ▶ | if (ref $byte_value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | die sprintf q{Unable to set %s data: Invalid data type at offset %d (%s)}, $what, $i, ref $args[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 34059 | ▶ | unless ($self->_is_valid_byte_value($byte_value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 8 | die sprintf q{Unable to set %s data: Invalid byte value at offset %d (%s)}, $what, $i, $self->_dump($byte_value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 11 | die sprintf q{Unable to set %s data: Invalid amount of data}, $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 158 | my @data = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 158 | return \@data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =head2 file_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | Fetch the actual file contents from sector data as a scalar of allocated number of bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | my $file_data = $object->file_data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Fetch the actual file contents from sector data as an array of allocated number of bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | my @file_data = $object->file_data(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | Update the actual file contents providing number of scalar data bytes to allocate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | $object->file_data($file_data, set_alloc_size => $set_alloc_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | C<$file_data> value is expected to be a scalar of between 0 and 254 bytes in length, an exception will be thrown when non-scalar value or a scalar which does not have a length between 0 and 254 bytes or a scalar which contains wide non-byte character is provided. C<$set_alloc_size> input parameter defaults to C<0>. That means every file data assignment modifies only certain data bytes. This may or may not be a desired behaviour. If C<$file_data> contains 254 bytes of data, it is likely that the first two bytes of sector data should still point to the next chunk of data in a chain and thus remain unchanged. If C<$set_alloc_size> flag is set, this operation will additionally mark sector object as the last sector in chain and calculate the last allocated byte within sector data based on the number of bytes provided in C<$file_data> value. This value will then be assigned to the C<alloc_size> object property. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | Update the actual file contents given array with number of bytes of data to allocate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | $object->file_data(\@file_data, set_alloc_size => $set_alloc_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | C<@file_data> value is expected to be an array of between 0 and 254 bytes in size, an exception will be thrown when non-array or an array with any other number of elements not in between 0 and 254 or an array with non-scalar byte values is provided. C<$set_alloc_size> input parameter defaults to C<0>. The same remarks apply here as the ones desribed in a paragraph above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 56 | ▶ | sub file_data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_data: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 56 | my ($self, $data, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 56 | ▶ | $args{set_alloc_size} = 0 if not exists $args{set_alloc_size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 56 | ▶ | my $file_data = $self->_validate_data(args => [$data], min_size => 0, max_size => 254, what => 'file') if defined $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 50 | ▶ | if (defined $file_data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 34 | my $file_data_size = scalar @{$file_data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 34 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 34 | splice @{$data}, $I_SECTOR_DATA, $file_data_size, @{$file_data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 34 | ▶ | if ($args{set_alloc_size}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 12 | $data->[$I_TS_POINTER_TRACK] = chr 0x00; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 12 | ▶ | $data->[$I_ALLOC_SIZE] = chr ($file_data_size + ($file_data_size > 0x00 ? 0x01 : 0x00)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 34 | $self->_object_property('data', $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # When data is set, object is no longer empty (unless it's filled with zeroes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 34 | my $is_valid_ts_link = $self->is_valid_ts_link(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 34 | my $alloc_size = $self->alloc_size(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 34 | ▶ | unless ($is_valid_ts_link || $alloc_size != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_valid_ts_link or $alloc_size != 0
MC/DC100%2/2
$is_valid_ts_link or $alloc_size != 0
$is_valid_ts_link
$alloc_size != 0
Truth table100%3/3
A or B
A= $is_valid_ts_linkB= $alloc_size != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 11 | $self->empty(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 23 | $self->empty(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 50 | ▶ | return unless defined wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 16 | $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 16 | my @file_data = @{$data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 16 | my $alloc_size = $self->alloc_size(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 16 | splice @file_data, $alloc_size + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 16 | splice @file_data, 0, $I_SECTOR_DATA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 16 | ▶ | return wantarray ? @file_data : join '', @file_data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | =head2 track | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | Get track location of sector data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | my $track = $object->track(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | Set track location of sector data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | $object->track($track); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | C<$track> value is expected to be a single byte, an exception will be thrown when non-byte or non-numeric or non-scalar value is provided. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 125 | ▶ | sub track { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
track: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 125 | my ($self, $track) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 125 | ▶ | if (defined $track) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 118 | ▶ | if (ref $track) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 2 | die sprintf q{Invalid type (%s) of track location of sector data (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 116 | ▶ | unless ($self->_is_valid_number_value($track)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 4 | die sprintf q{Invalid value (%s) of track location of sector data (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 112 | ▶ | if ($track == 0x00) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | die sprintf q{Illegal value (0) of track location of sector data (track 0 does not exist)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 111 | $track = $self->_object_property('track', $track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 118 | $track = $self->_object_property('track'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 118 | return $track; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | =head2 sector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | Get sector location of sector data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | my $sector = $object->sector(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | Set sector location of sector data in the actual disk image: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | $object->sector($sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | C<$sector> value is expected to be a single byte, an exception will be thrown when non-byte or non-numeric or non-scalar value is provided. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 121 | ▶ | sub sector { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sector: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 121 | my ($self, $sector) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 121 | ▶ | if (defined $sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 114 | ▶ | if (ref $sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 2 | die sprintf q{Invalid type (%s) of sector location of sector data (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 112 | ▶ | unless ($self->_is_valid_number_value($sector)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 4 | die sprintf q{Invalid value (%s) of sector location of sector data (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 108 | $sector = $self->_object_property('sector', $sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 115 | $sector = $self->_object_property('sector'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 115 | return $sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | =head2 is_valid_ts_link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | Check if first two bytes of data point to the next chunk of data in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | my $is_valid_ts_link = $object->is_valid_ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 378 | ▶ | sub is_valid_ts_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_valid_ts_link: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 378 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 378 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 378 | my $ts_pointer_track = ord $data->[$I_TS_POINTER_TRACK]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 378 | ▶ | return $ts_pointer_track == 0x00 ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | =head2 ts_link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | Get track and sector link values to the next chunk of data in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | my ($track, $sector) = $object->ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | Track and sector values will be returned if first two bytes of data point to the next chunk of data in a chain, indicating this sector is in a link chain. When two first bytes of data indicate an index of the last allocated byte, an undefined value will be returned. An undefined value indicates that this is the last sector in a chain (and C<alloc_size> can be used to fetch index of the last allocated byte within sector data). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | Set track and sector link values to the next chunk of data in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | $object->ts_link($track, $sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | Setting track/sector link includes sector in a chain and adds link to the next sector of data, at the same time allocating an entire sector for storing file data. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 24 | ▶ | sub ts_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ts_link: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 24 | my ($self, $track, $sector) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 24 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 24 | ▶ | if (defined $track || defined $sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $track or defined $sector
MC/DC100%2/2
defined $track or defined $sector
defined $track
defined $sector
Truth table100%3/3
A or B
A= defined $trackB= defined $sector
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 12 | ▶ | unless (defined $track) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 1 | die sprintf q{Undefined value of track location for the next chunk of data in a chain (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 11 | ▶ | if (ref $track) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1 | die sprintf q{Invalid type (%s) of track location for the next chunk of data in a chain (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 10 | ▶ | unless ($self->_is_valid_number_value($track)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 2 | die sprintf q{Invalid value (%s) of track location for the next chunk of data in a chain (single byte expected)}, $self->_dump($track); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 8 | ▶ | if ($track == 0x00) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 1 | die sprintf q{Illegal value (0) of track location for the next chunk of data in a chain (track 0 does not exist)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 7 | ▶ | unless (defined $sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | die sprintf q{Undefined value of sector location for the next chunk of data in a chain (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 6 | ▶ | if (ref $sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | die sprintf q{Invalid type (%s) of sector location for the next chunk of data in a chain (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 5 | ▶ | unless ($self->_is_valid_number_value($sector)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | die sprintf q{Invalid value (%s) of sector location for the next chunk of data in a chain (single byte expected)}, $self->_dump($sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 3 | $data->[$I_TS_POINTER_TRACK] = chr $track; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 3 | $data->[$I_TS_POINTER_SECTOR] = chr $sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # Once valid track and sector link values are set, sector can no longer be considered empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 3 | $self->empty(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 15 | ▶ | return unless $self->is_valid_ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 11 | $track = ord $data->[$I_TS_POINTER_TRACK]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 11 | $sector = ord $data->[$I_TS_POINTER_SECTOR]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 11 | return ($track, $sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 6 | *ts_pointer = \&ts_link; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | =head2 is_last_in_chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | Check if two first bytes of data indicate an index of the last allocated byte, meaning this is the last sector in a chain: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | my $is_last_in_chain = $object->is_last_in_chain(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | Note that C<alloc_size> method will always correctly return index of the last allocated byte within the sector data (even if first two bytes of data contain track and sector link values to the next chunk of data in a chain). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 14 | ▶ | sub is_last_in_chain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_last_in_chain: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 14 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 14 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 14 | my $ts_pointer_track = ord $data->[$I_TS_POINTER_TRACK]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 14 | ▶ | return $ts_pointer_track == 0x00 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | =head2 alloc_size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | Get index of the last allocated byte within the sector data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | my $alloc_size = $object->alloc_size(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | Index of the last valid (loaded) file byte will be returned when this is the last sector in a chain. When C<0xff> value is returned, this sector may be included in a link chain (if that is the case, C<ts_link> can be used to fetch track and sector link values to the next chunk of data in a chain). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | Set index of the last allocated byte within the sector data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | $object->alloc_size($alloc_size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | Setting index of the last allocated byte marks sector as the last one in a chain. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 194 | ▶ | sub alloc_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alloc_size: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 194 | my ($self, $alloc_size) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 194 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 194 | ▶ | if (defined $alloc_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 6 | ▶ | if (ref $alloc_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | die sprintf q{Invalid index type (%s) of the last allocated byte within the sector data (single byte expected)}, $self->_dump($alloc_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 5 | ▶ | unless ($self->_is_valid_number_value($alloc_size)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 2 | die sprintf q{Invalid index value (%s) of the last allocated byte within the sector data (single byte expected)}, $self->_dump($alloc_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 3 | $data->[$I_ALLOC_SIZE] = chr $alloc_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 3 | $data->[$I_TS_POINTER_TRACK] = chr 0x00; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 191 | ▶ | return 0xff if $self->is_valid_ts_link(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 75 | $alloc_size = ord $data->[$I_ALLOC_SIZE]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 75 | return $alloc_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | =head2 empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | Check if sector object is empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | my $is_empty = $object->empty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | Set boolean flag to mark sector object as empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | $object->empty(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | Clear boolean flag to mark sector object as non-empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | $object->empty(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 195 | ▶ | sub empty { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 195 | my ($self, $is_empty) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 195 | ▶ | if (defined $is_empty) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 168 | ▶ | if (ref $is_empty) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 1 | die q{Invalid "empty" flag}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 167 | ▶ | $self->_object_property('is_empty', $is_empty ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 194 | $is_empty = $self->_object_property('is_empty'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 194 | return $is_empty; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | =head2 clean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | Wipe out an entire sector data, and mark it as empty: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | $object->clean(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | ▶ | sub clean { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1 | my $clean_object = $self->_init(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | ▶ | while (my ($property, $value) = each %{$clean_object}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 4 | $self->_object_property($property, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | =head2 print | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | Print out formatted disk sector data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | $object->print(fh => $fh); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | C<$fh> defaults to the standard output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 3 | ▶ | sub print { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 3 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 3 | my $fh = $args{fh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 3 | ▶ | $fh ||= *STDOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$fh ||= *STDOUT
MC/DC0%0/2
$fh ||= *STDOUT
$fh
*STDOUT
Truth table33%1/3
A ||= B
A= $fhB= *STDOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 3 | $fh->binmode(':bytes'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 3 | my $stdout = select $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 3 | my $data = $self->_object_property('data'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 3 | print q{ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 3 | ▶ | for (my $col = 0x00; $col < 0x10; $col++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 48 | printf q{%02X }, $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 3 | print qq{\n} . q{ } . '-' x 47 . qq{\n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 3 | ▶ | for (my $row = 0x00; $row < 0x100; $row += 0x10) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 48 | printf q{%02X: }, $row; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 48 | ▶ | for (my $col = 0x00; $col < 0x10; $col++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 768 | my $val = ord $data->[$row + $col]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 768 | printf q{%02X }, $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 48 | ▶ | for (my $col = 0x00; $col < 0x10; $col++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 768 | my $val = ord $data->[$row + $col]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 768 | ▶ | if ($val >= 0x20 and $val <= 0x7f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$val >= 32 and $val <= 127
MC/DC50%1/2
$val >= 32 and $val <= 127
$val >= 32
$val <= 127
Truth table66%2/3
A and B
A= $val >= 32B= $val <= 127
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | $val = ord petscii_to_ascii chr $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 767 | $val = ord '?'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 768 | printf q{%c}, $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 48 | printf qq{\n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 3 | select $stdout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 31 | ▶ | sub _dump { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 31 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 31 | ▶ | if ($self->_is_valid_number_value($value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | return sprintf q{$%02x}, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 31 | my $dump = Data::Dumper->new([$value])->Indent(0)->Terse(1)->Deepcopy(1)->Sortkeys(1)->Dump(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 31 | return $dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 279 | ▶ | sub is_int { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_int: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 279 | my ($this, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 279 | return _is_int($var); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | ▶ | sub is_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_str: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my ($this, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | return _is_str($var); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | There are no known bugs at the moment. Please report any bugs or feature requests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | =head1 EXPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | None. No method is exported into the caller's namespace neither by default nor explicitly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | L<D64::Disk::Image>, L<D64::Disk::Layout>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | Pawel Krol, E<lt>pawelkrol@cpan.orgE<gt>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | Version 0.02 (2013-02-10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | Copyright 2013 by Pawel Krol E<lt>pawelkrol@cpan.orgE<gt>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | PLEASE NOTE THAT IT COMES WITHOUT A WARRANTY OF ANY KIND! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||