/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/api/APR/PerlIO.html is in libapache2-mod-perl2-doc 2.0.8+httpd24-r1449661-6ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | <?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#Synopsis">Synopsis</a></li>
<li><a href="#Description">Description</a></li>
<li><a href="#Prerequisites">Prerequisites</a></li>
<li><a href="#Constants">Constants</a>
<ul>
<li><a href="#APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED">APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED</a></li>
</ul>
</li>
<li><a href="#API">API</a>
<ul>
<li><a href="#open">open</a></li>
<li><a href="#seek">seek</a></li>
</ul>
</li>
<li><a href="#C-API">C API</a></li>
<li><a href="#See-Also">See Also</a></li>
<li><a href="#Copyright">Copyright</a></li>
<li><a href="#Authors">Authors</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>APR::PerlIO -- Perl IO layer for APR</p>
<h1 id="Synopsis">Synopsis</h1>
<pre><code> # under mod_perl
use APR::PerlIO ();
sub handler {
my $r = shift;
die "This Perl build doesn't support PerlIO layers"
unless APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED;
open my $fh, ">:APR", $filename, $r->pool or die $!;
# work with $fh as normal $fh
close $fh;
return Apache2::Const::OK;
}
# outside mod_perl
% perl -MAPR -MAPR::PerlIO -MAPR::Pool -le \
'open my $fh, ">:APR", "/tmp/apr", APR::Pool->new or die "$!"; \
print $fh "whoah!"; \
close $fh;'</code></pre>
<h1 id="Description">Description</h1>
<p><code>APR::PerlIO</code> implements a Perl IO layer using APR's file manipulation API internally.</p>
<p>Why do you want to use this? Normally you shouldn't, probably it won't be faster than Perl's default layer. It's only useful when you need to manipulate a filehandle opened at the APR side, while using Perl.</p>
<p>Normally you won't call open() with APR layer attribute, but some mod_perl functions will return a filehandle which is internally hooked to APR. But you can use APR Perl IO directly if you want.</p>
<h1 id="Prerequisites">Prerequisites</h1>
<p>Not every Perl will have full <code>APR::PerlIO</code> functionality available.</p>
<p>Before using the Perl IO APR layer one has to check whether it's supported by the used APR/Perl build. Perl 5.8.x or higher with perlio enabled is required. You can check whether your Perl fits the bill by running:</p>
<pre><code> % perl -V:useperlio
useperlio='define';</code></pre>
<p>It should say <i>define</i>.</p>
<p>If you need to do the checking in the code, there is a special constant provided by <code>APR::PerlIO</code>, which can be used as follows:</p>
<pre><code> use APR::PerlIO ();
die "This Perl build doesn't support PerlIO layers"
unless APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED;</code></pre>
<p>Notice that loading <code>APR::PerlIO</code> won't fail when Perl IO layers aren't available since <code>APR::PerlIO</code> provides functionality for Perl builds not supporting Perl IO layers.</p>
<h1 id="Constants">Constants</h1>
<h2 id="APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED"><code>APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED</code></h2>
<p>See <a href="#Prerequisites">Prerequisites</a>.</p>
<h1 id="API">API</h1>
<p>Most of the API is as in normal perl IO with a few nuances listed in the following sections.</p>
<p>META: need to rework the exception mechanism here. Current success in using errno ($!) being set (e.g. on open()) is purely accidental and not guaranteed across all platforms and functions. So don't rely on $!. Will use <code><a>APR::Error</a></code> for that purpose.</p>
<h2 id="open"><code>open</code></h2>
<p>Open a file via APR Perl IO layer.</p>
<pre><code> open my $fh, ">:APR", $filename, $r->pool or die $!;</code></pre>
<dl>
<dt id="arg1:-fh-GLOB-filehandle">arg1: <code>$fh</code> ( GLOB filehandle )</dt>
<dd>
<p>The filehandle.</p>
</dd>
<dt id="arg2:-mode-string">arg2: <code>$mode</code> ( string )</dt>
<dd>
<p>The mode to open the file, constructed from two sections separated by the <code>:</code> character: the first section is the mode to open the file under (>, <, etc) and the second section must be a string <i>APR</i>. For more information refer to the <i>open</i> entry in the <i>perlfunc</i> manpage.</p>
</dd>
<dt id="arg3:-filename-string">arg3: <code>$filename</code> ( string )</dt>
<dd>
<p>The path to the filename to open</p>
</dd>
<dt id="arg4:-p-APR::Pool">arg4: <code>$p</code> ( <code><a>APR::Pool</a></code> )</dt>
<dd>
<p>The pool object to use to allocate APR::PerlIO layer.</p>
</dd>
<dt id="ret:-integer">ret: ( integer )</dt>
<dd>
<p>success or failure value (boolean).</p>
</dd>
<dt id="since:-2.0.00">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="seek"><code>seek</code></h2>
<p>Sets <code>$fh</code>'s position, just like the <code>seek()</code> Perl call:</p>
<pre><code> seek($fh, $offset, $whence);</code></pre>
<p>If <code>$offset</code> is zero, <code>seek()</code> works normally.</p>
<p>However if <code>$offset</code> is non-zero and Perl has been compiled with with large files support (<code>-Duselargefiles</code>), whereas APR wasn't, this function will croak. This is because largefile size <code>Off_t</code> simply cannot fit into a non-largefile size <code>apr_off_t</code>.</p>
<p>To solve the problem, rebuild Perl with <code>-Uuselargefiles</code>. Currently there is no way to force APR to build with large files support.</p>
<dl>
<dt id="since:-2.0.001">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h1 id="C-API">C API</h1>
<p>The C API provides functions to convert between Perl IO and APR Perl IO filehandles.</p>
<p>META: document these</p>
<h1 id="See-Also">See Also</h1>
<p><a>mod_perl 2.0 documentation</a>. The <i>perliol(1)</i>, <i>perlapio(1)</i> and <i>perl(1)</i> manpages.</p>
<h1 id="Copyright">Copyright</h1>
<p>mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.</p>
<h1 id="Authors">Authors</h1>
<p><a>The mod_perl development team and numerous contributors</a>.</p>
</body>
</html>
|