.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Data::Section::Simple 3pm" .TH Data::Section::Simple 3pm "2018-01-28" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Data::Section::Simple \- Read data from _\|_DATA_\|_ .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Data::Section::Simple qw(get_data_section); \& \& # Functional interface \-\- reads from caller package _\|_DATA_\|_ \& my $all = get_data_section; # All data in hash reference \& my $foo = get_data_section(\*(Aqfoo.html\*(Aq); \& \& # OO \- allows reading from other packages \& my $reader = Data::Section::Simple\->new($package); \& my $all = $reader\->get_data_section; \& \& _\|_DATA_\|_ \& \& @@ foo.html \& \& Hello \& \& \& @@ bar.tt \& [% IF true %] \& Foo \& [% END %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Data::Section::Simple is a simple module to extract data from \&\f(CW\*(C`_\|_DATA_\|_\*(C'\fR section of the file. .SH "LIMITATIONS" .IX Header "LIMITATIONS" As the name suggests, this module is a simpler version of the excellent Data::Section. If you want more functionalities such as merging data sections or changing header patterns, use Data::Section instead. .PP This module does not implement caching (yet) which means in every \&\f(CW\*(C`get_data_section\*(C'\fR or \f(CW\*(C`get_data_section($name)\*(C'\fR this module seeks and re-reads the data section. If you want to avoid doing so for the better performance, you should implement caching in your own caller code. .SH "BUGS" .IX Header "BUGS" .SS "_\|_DATA_\|_ appearing elsewhere" .IX Subsection "__DATA__ appearing elsewhere" If you data section has literal \f(CW\*(C`_\|_DATA_\|_\*(C'\fR in the data section, this module might be tricked by that. Although since its pattern match is greedy, \f(CW\*(C`_\|_DATA_\|_\*(C'\fR appearing \fIbefore\fR the actual data section (i.e. in the code) might be okay. .PP This is by design \*(-- in theory you can \f(CW\*(C`tell\*(C'\fR the \s-1DATA\s0 handle before reading it, but then reloading the data section of the file (handy for developing inline templates with \s-1PSGI\s0 web applications) would fail because the pos would be changed. .PP If you don't like this design, again, use the superior Data::Section. .SS "utf8 pragma" .IX Subsection "utf8 pragma" If you enable utf8 pragma in the caller's package (or the package you're inspecting with the \s-1OO\s0 interface), the data retrieved via \&\f(CW\*(C`get_data_section\*(C'\fR is decoded, but otherwise undecoded. There's no reliable way for this module to programmatically know whether utf8 pragma is enabled or not: it's your responsibility to handle them correctly. .SH "AUTHOR" .IX Header "AUTHOR" Tatsuhiko Miyagawa .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2010\- Tatsuhiko Miyagawa .PP The code to read \s-1DATA\s0 section is based on Mojo::Command get_all_data: Copyright 2008\-2010 Sebastian Riedel .SH "LICENSE" .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Data::Section Inline::Files