- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- METHODS
- HOMEPAGE
- SOURCE
- BUGS
- SEE ALSO
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Data::Section::Seekable::Reader - Read parts from data section
VERSION
This document describes version 0.09 of Data::Section::Seekable::Reader (from Perl distribution Data-Section-Seekable), released on 2016-02-19.
SYNOPSIS
In your script:
use Data::Section::Seekable::Reader;
my $reader = Data::Section::Seekable::Reader->new;
my $p2 = $reader->read_part('part2'); # -> "This is part\ntwo\n"
my $p1 = $reader->read_part('part1'); # -> "This is part1\n"
my $p3 = $reader->read_part('part3'); # dies, unknown part
my $e1 = $reader->read_extra('part1'); # -> undef
my $e2 = $reader->read_extra('part2'); # -> "important"
my $e3 = $reader->read_extra('part3'); # dies, unknown part
__DATA__
Data::Section::Seekable v1
part1,0,14
part2,14,17,important
This is part1
This is part
two
DESCRIPTION
This class lets you read parts from __DATA__ section. Data section should contain data in the format described by Data::Section::Seekable.
METHODS
new(%attrs) => obj
Constructor. Attributes:
handle => filehandle (default:
DATA
)To access another package's data section, you can do:
my $reader = Data::Section::Seekable::Reader->new(handle => \*Another::Package::DATA);
The constructor will also read the header and TOC in the data section. Will die on failure.
$reader->parts($name) => list
Return list of all known parts in the data section, sorted lexicographically.
$reader->read_part($name) => str
Read the content of a part named $name
. Will die if part is unknown.
$reader->read_extra($name) => str
Read the extra information field (the fourth field of TOC line) of a part named $name
. Will die if part is unknown.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Data-Section-Seekable.
SOURCE
Source repository is at https://github.com/perlancar/perl-Data-Section-Seekable.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Section-Seekable
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
Data::Section::Seekable for the description of the data format.
Data::Section::Seekable::Writer to generate the data section.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.