The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache::AxKit::DirHandler - base class for Directory handlers

SYNOPSIS

Override the base DirHandler class and enable it by using:

    AxDirHandler MyClass

    # alternatively use:
    # PerlSetVar AxDirHandler MyClass

DESCRIPTION

AxKit supports the capability to handle directory requests. Therefore, instead of relying on Apache to serve a Directory Index file or generating a file listing, AxKit will generate XML representing the content of the indicated directory for processing by your stylesheet pipeline.

In many cases the default XML grammar provided will be sufficient, but for those instances when something more specific is necessary, this default behavior can be overridden.

This class is a base-class implementing basic behavior, but must be inherited for directory listings to function. To write your own directory handler, simply override this class and implement the get_strref() method.

PUBLIC METHODS

The following are the methods available from this class:

get_strref

This method is called to generate the XML contents of a directory. The "directory" property of the object contains the path of the directory to be returned. The return value is expected to be a reference to the XML string to be returned.

init()

This method is called shortly after object construction, and can be used to initialize anything necessary to the operation of a directory handler.

mtime()

This returns the latest last modified time of any file or directory within the requested directory. This is used for caching purposes.

PRIVATE METHODS

Apache::AxKit::DirHandler provides a few convenience methods that can make the business of processing directory listings easier.

_request_filename

This returns the requested filename from the Apache object.

_request_uri

Given a filename relative to the currently processed directory, this will return a full URI for the file. If called in a scalar context it will return the full URI, while in an array context it will return both an Apache::URI object and the "unparsed" URI string.

_format_filesize

This will return a fancy filesize string (XkB, etc) for a given byte-size.