AppleII-LibA2
view release on metacpan or search on metacpan
lib/AppleII/Disk.pm view on Meta::CPAN
if the filesystem containing the image file supports sparse files.
=item $disk->write_block($block, $contents, [$pad])
Writes one block to the disk image. C<$block> is the block number to
write. C<$contents> is the data to write. The optional C<$pad> is a
character to pad the block with (out to 512 bytes). If C<$pad> is
omitted or null, then C<$contents> must be exactly 512 bytes.
=item $disk->write_blocks(\@blocks, $contents, [$pad])
Writes a sequence of blocks to the disk image. C<\@blocks> is a
reference to an array of block numbers to write. C<$contents> is the
data to write. It is broken up into 512 byte chunks and written to
the blocks. The optional C<$pad> is a character to pad the data with
(out to a multiple of 512 bytes). If C<$pad> is omitted or null, then
C<$contents> must be exactly 512 bytes times the number of blocks.
As a special case, block 0 cannot be written by this method. Instead,
that block of C<$contents> is just skipped. This is how sparse files
are implemented. If you want to write the contents of block 0, you
must call $disk->write_block directly.
=item $disk->write_sector($track, $sector, $contents, [$pad])
Writes one sector to the disk image. C<$track> is the track number,
and C<$sector> is the DOS 3.3 logical sector number. C<$contents> is
the data to write. The optional C<$pad> is a character to pad the
sector with (out to 256 bytes). If C<$pad> is omitted or null, then
C<$contents> must be exactly 256 bytes. This is currently implemented
only for DOS 3.3 order images.
=item $padded = AppleII::Disk::pad_block($data, [$pad, [$length]])
Pads C<$data> out to C<$length> bytes with C<$pad>. Returns the
padded string; the original is not altered. Dies if C<$data> is
longer than C<$length>. The default C<$pad> is "\0", and the default
C<$length> is 512 bytes.
If C<$pad> is the null string (not undef), just checks to make sure
that C<$data> is exactly C<$length> bytes and returns the original
string. Dies if C<$data> is not exactly C<$length> bytes.
C<pad_block> is a subroutine, not a method, and is not exported. You
probably don't need to call it directly anyway, because the
C<write_XXX> methods will call it for you.
=back
=for Pod::Coverage
^pad_block$
=head1 CONFIGURATION AND ENVIRONMENT
AppleII::Disk requires no configuration files or environment variables.
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
=head1 AUTHOR
Christopher J. Madsen S<C<< <perl AT cjmweb.net> >>>
Please report any bugs or feature requests
to S<C<< <bug-AppleII-LibA2 AT rt.cpan.org> >>>
or through the web interface at
L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=AppleII-LibA2 >>.
You can follow or contribute to AppleII-LibA2's development at
L<< https://github.com/madsen/perl-libA2 >>.
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
=cut
( run in 1.511 second using v1.01-cache-2.11-cpan-39bf76dae61 )