Data::Section::Seekable::Reader - Read parts from data section
This document describes version 0.09 of Data::Section::Seekable::Reader (from Perl distribution Data-Section-Seekable), released on 2016-02-19.
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
This class lets you read parts from __DATA__ section. Data section should contain data in the format described by Data::Section::Seekable.
Constructor. Attributes:
handle => filehandle (default: DATA)
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.
Return list of all known parts in the data section, sorted lexicographically.
Read the content of a part named $name. Will die if part is unknown.
$name
Read the extra information field (the fourth field of TOC line) of a part named $name. Will die if part is unknown.
Please visit the project's homepage at https://metacpan.org/release/Data-Section-Seekable.
Source repository is at https://github.com/perlancar/perl-Data-Section-Seekable.
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.
Data::Section::Seekable for the description of the data format.
Data::Section::Seekable::Writer to generate the data section.
perlancar <perlancar@cpan.org>
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.
To install Data::Section::Seekable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Section::Seekable
CPAN shell
perl -MCPAN -e shell install Data::Section::Seekable
For more information on module installation, please visit the detailed CPAN module installation guide.