Apache2-PodBrowser

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    is stripped off to get the directory name.

    Note that you need to write the package name again. You also need to
    either escape the semicolons as in
    "src="Apache2%3A%3APodBrowser/torsten-foertsch.jpg"" or put a "./" in
    front of the link.

    A note about the content type of linked documents. "Apache::PodBrowser"
    does not enter a new request cycle to ship these documents. So, the
    normal Apache Content-Type guessing does not take place.
    "Apache::PodBrowser" knows a few file name extensions ("png", "jpg",
    "jpeg", "gif", "js", "pdf" and "html"). For those it sends the correct
    Content-Type headers. All other documents are shipped as
    "application/octet-stream".

    If a document needs a different Content-Type header it can be passed as
    CGI parameter:

     src="Apache2%3A%3APodBrowser/torsten-foertsch.jpg?ct=text/plain"

    The link above will ship the image as "text/plain".

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

                    if( $r->args eq '?' ) {
                        $body=_compress(_findex($r), $r);
                    } else {
                        $body=_compress(_body($r, undef, $r->args, 1), $r);
                    }
                } else {            # generate index
                    $body=_compress(_index($r), $r);
                }
            } elsif(($pos=index $pi, '/', 1)>0) {
                # image or something like that, e.g.
                #   =for html <img src="Apache2::PodBrowser/img.png">
                my $path=_findpod($r, substr($pi, 1, $pos-1));
                unless( $path=~s!\.[^.]+$!! ) {
                    $path=~s!/[^/]+$!!;
                }
                $path.=substr $pi, $pos;
                update_finfo $r, $path;
                if( $r->finfo->filetype==APR::Const::FILETYPE_REG ) {
                    if( $r->args=~/\bct=([^;&]+)/ ) {
                        # content-type given as URL parameter
                        my $ct=$1;
                        $ct=~s/%([0-9a-f]{2})|\+/defined $1
                                                 ? pack('H2', $1)
                                                 : ' '/egi;
                        $r->content_type($ct);
                    } elsif( substr($path, -4) eq '.png' ) {
                        $r->content_type('image/png');
                    } elsif( substr($path, -4) eq '.jpg' or
                             substr($path, -5) eq '.jpeg' ) {
                        $r->content_type('image/jpeg');
                    } elsif( substr($path, -4) eq '.gif' ) {
                        $r->content_type('image/gif');
                    } elsif( substr($path, -3) eq '.js' ) {
                        $r->content_type('text/javascript');
                    } elsif( substr($path, -4) eq '.pdf' ) {
                        $r->content_type('application/pdf');
                    } elsif( substr($path, -5) eq '.html' ) {

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

is stripped off to get the directory name.

Note that you need to write the package name again. You also need to
either escape the semicolons as in
C<src="Apache2%3A%3APodBrowser/torsten-foertsch.jpg"> or put a C<./>
in front of the link.

A note about the content type of linked documents. C<Apache::PodBrowser>
does not enter a new request cycle to ship these documents. So, the normal
Apache Content-Type guessing does not take place. C<Apache::PodBrowser> knows
a few file name extensions (C<png>, C<jpg>, C<jpeg>, C<gif>, C<js>,
C<pdf> and C<html>). For those it sends the correct Content-Type headers.
All other documents are shipped as C<application/octet-stream>.

If a document needs a different Content-Type header it can be passed as
CGI parameter:

 src="Apache2%3A%3APodBrowser/torsten-foertsch.jpg?ct=text/plain"

The link above will ship the image as C<text/plain>.



( run in 1.409 second using v1.01-cache-2.11-cpan-df04353d9ac )