Apache2-PodBrowser

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    cache.

      PerlSetVar CACHE /path/to/cache.mmdb

    The cache file itself is created on the first access to the index. The
    POD index page then contains a link to update the cache. So, if a POD
    file is added or removed from the system this link is to be clicked to
    keep the POD index page up to date.

    The cache file itself is a MMapDB object. If this module is not
    available you'll probably get a "404 - NOT FOUND" response the next time
    the POD index page is requested if "CACHE" is set.

    The directory containing the cache file must be writable by the "httpd".

   CONTENTTYPE
    You'll probably need that only for plain text output with the
    Pod::Simple::Text parser. Here one can set the content type of the
    output.

      PerlSetVar CONTENTTYPE "text/plain; charset=UTF-8"

lib/Apache2/PodBrowser.pm  view on Meta::CPAN

To avoid to repeat this for each POD index request one can set up a cache.

  PerlSetVar CACHE /path/to/cache.mmdb

The cache file itself is created on the first access to the index. The POD
index page then contains a link to update the cache. So, if a POD file
is added or removed from the system this link is to be clicked to keep
the POD index page up to date.

The cache file itself is a L<MMapDB> object. If this module is not available
you'll probably get a C<404 - NOT FOUND> response the next time the POD index
page is requested if C<CACHE> is set.

The directory containing the cache file must be writable by the C<httpd>.

=head3 CONTENTTYPE

You'll probably need that only for plain text output with the
L<Pod::Simple::Text> parser. Here one can set the content type
of the output.

t/001.t  view on Meta::CPAN

like $resp, qr!a href="\./other::module#Head2"!, 'link to existing module';
like $resp, qr!a href="\./missing::module#section"!,
    'link to missing module';

$resp=GET_BODY("/perldoc/perlfunc");

like $resp, qr!>Alphabetical Listing of Perl Functions</a></h2>!, 'perlfunc';

$resp=GET("/NOINC/perlfunc");

is $resp->code, 404, '/NOINC/perlfunc: 404';

$expected=GET_BODY("/perldoc/d::p");
$resp=GET '/perldoc/d::p', 'Accept-Encoding'=>'gzip,deflate';
like $resp->header('Vary'), qr/\bAccept-Encoding\b/i, 'Vary Header';
is $resp->header('Content-Encoding'), 'deflate', 'Content-Encoding';

$expected=~s/<!--.*?-->//sg;
{
    my $got=uncompress($resp->content);
    $got=~s/<!--.*?-->//sg;
    is $got, $expected, 'inflated body';
}

##########################################
# stylesheets
##########################################
t_debug 'Testing stylesheet access';

foreach (qw!/perldoc/dummy.css /NOINC/dummy.css!) {
    is GET($_)->code, 404, $_.': 404';
}

foreach (qw!/perldoc/auto.css /NOINC/fancy.css
            /perldoc/sub/dir/auto.css /NOINC/sub/dir/fancy.css!) {
    is GET($_)->code, 200, $_.': 200';
}

$expected=GET_BODY("/perldoc/fancy.css");
$resp=GET '/perldoc/fancy.css', 'Accept-Encoding'=>'gzip,deflate';
like $resp->header('Vary'), qr/\bAccept-Encoding\b/i, 'Vary Header';



( run in 1.695 second using v1.01-cache-2.11-cpan-39bf76dae61 )