Any::Daemon::HTTP::Directory - describe a server directory
Any::Daemon::HTTP::Directory is extended by Any::Daemon::HTTP::UserDirs
# implicit creation of ::Directory object my $vh = Any::Daemon::HTTP::VirtualHost ->new(directories => {path => '/', location => ...}) my $vh = Any::Daemon::HTTP::VirtualHost ->new(directories => [ \%dir1, \%dir2, $dir_obj ]) # explicit use my $root = Any::Daemon::HTTP::Directory ->new(path => '/', location => '...'); my $vh = Any::Daemon::HTTP::VirtualHost ->new(directories => $root);
Each Any::Daemon::HTTP::VirtualHost will define where the files are located. Parts of the URI path can map on different directories, with different permissions.
User directories, like used in the URI <http://xx/~user/yy> are implemented in Any::Daemon::HTTP::UserDirs.
<http://xx/~user/yy
-Option --Default allow <undef> deny <undef> directory_list <false> index_file ['index.html', 'index.htm'] location <required> path '/'
Allow all requests which pass any of these parameters, and none of the deny parameters. See "Allow access". Be warned that the access rights are not inherited from directory configurations encapsulating this one.
See allow and "Allow access"
allow
Enables the display of a directory, when it does not contain one of the index_file prepared defaults.
index_file
When a directory is addressed, it is scanned whether one of these files exist. If so, the content will be shown.
The DIRECTORY to be prefixed before the path of the URI, or a CODE reference which will rewrite the path (passed as only parameter) into the absolute file or directory name.
If the directory PATH (relative to the document root location) is not trailed by a '/', it will be made so.
location
BE WARNED that the URI is the rewrite of the REQUEST uri, and therefore you should use that URI. The SESSION represents a user.
See "Allow access".
Convert a URI PATH into a directory path. Return undef if not possible.
undef
Try to produce a response (HTTP::Response) for something inside this directory structure. undef is returned if nothing useful is found.
Returns a HASH with information about the DIRECTORY content. This may be passed into some template or the default template. See "Return of directoryList" about the returned output.
-Option --Default filter <undef> hide_symlinks <false> names <skip hidden files>
For each of the selected names (see names option) the lstat() is called. That data is expanded into a HASH, but not all additional fields are yet filled-in (only the ones which come for free).
names
Reduce the returned list. The CODE reference is called with the found filename, and should return true when the name is acceptable. The default regexp (on UNIX) is qr/^[^.]/
qr/^[^.]/
The allow() method handles access rights. When a trueth value is produced, then access is permitted.
The base class implements access rules via the allow or deny option of new(). These parameters are exclusive (which is slightly different from Apache); you can either allow or deny, but not both at the same time. Be warned that the access rights are also not inherited from directory configurations encapsulating this one.
deny
The parameters to allow or deny are an ARRAY with any combination of
the hostname, the session, and the rewritten URI.
The list() method returns a HASH of HASHes, where the primary keys are the directory entries, each refering to a HASH with details. It is designed to ease the connection to template systems.
The details contain the lstat information plus some additional helpers. The lstat call provides the fields dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, blocks -as far as supported by your OS. The entry's name and path are added.
lstat
dev
ino
mode
nlink
uid
gid
rdev
size
atime
mtime
ctime
blksize
blocks
name
path
The kind field contains the string DIRECTORY, FILE, SYMLINK, or OTHER. Besides, you get either an is_directory, is_file, is_symlink, or is_other field set to true. Equivalent are:
kind
DIRECTORY
FILE
SYMLINK
OTHER
is_directory
is_file
is_symlink
is_other
if($entry->{kind} eq 'DIRECTORY') if($entry->{is_directory})
It depends on the kind of entry which of the following fields are added additionally. Symlinks will get symlink_dest, symlink_dest_exists. Files hace the size_nice, which is the size in pleasant humanly readable format.
symlink_dest
symlink_dest_exists
size_nice
Files and directories have the mtime_nice (in localtime). The user and group which are textual representations of the numeric uid and gid are added. The flags represents the UNIX standard permission-bit display, as produced by the "ls -l" command.
mtime_nice
user
group
flags
This module is part of Any-Daemon-HTTP distribution version 0.23, built on November 28, 2013. Website: http://perl.overmeer.net/any-daemon/
Copyrights 2013 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install Any::Daemon::HTTP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Any::Daemon::HTTP
CPAN shell
perl -MCPAN -e shell install Any::Daemon::HTTP
For more information on module installation, please visit the detailed CPAN module installation guide.