Apache-Roaming
view release on metacpan or search on metacpan
METHOD INTERFACE
As already said, the Apache::Roaming module is subclassable. You can
well use it by itself, but IMO the most important possibility is
overwriting the GET method for complete control over the users settings.
handler
$result = Apache::Roaming->handler($r);
(Class Method) The *handler* method is called by the Apache server for
any request. It receives an Apache request $r. The methods main task is
creating an instance of Apache::Roaming by calling the *new* method and
then passing control to the *Authenticate*, *CheckDir* and *GET*, *PUT*,
*DELETE* or *MOVE*, respectively, methods.
handler_type
$status = Apache::Roaming->handler_type($r)
(Class Method) This method is required only, because the Apache server
would refuse other methods than GET otherwise. It checks whether the
requested method is GET, PUT, HEAD, DELETE or MOVE, in which case it
returns the value OK. Otherwise the value DECLINED is returned.
new
$ar_req = Apache::Roaming->new(%attr);
(Class Method) This is the modules constructor, called by the *handler*
method. Instances of Apache::Request have the following attributes:
basedir The roaming servers base directory, as an absolute path. You set
this using a PerlSetVar instruction, see the INSTALLATION
manpage above for an example.
file This is the path of the file being created (PUT), read (GET),
deleted (DELETE) or moved (MOVE). It's an absolute path.
method The requested method, one of HEAD, GET, PUT, MOVE or DELETE.
request This is the Apache request object.
status If a method dies, it should set this value to a return code like
SERVER_ERROR (default), FORBIDDEN, METHOD_NOT_ALLOWED, or
something similar from Apache::Constants. See the
Apache::Constants(3) manpage. The *handler* method will catch
Perl exceptions for you and generate an error page.
user Name the user authenticated as.
Authenticate
$ar_req->Authenticate();
(Instance Method) This method is checking whether the user has
authorized himself. The current implementation is checking only whether
user name is given via $r->connection()->user(), in other words you can
use simple basic authentication or something similar.
The method should throw an exception in case of problems.
CheckDir
$ar_req->CheckDir();
(Instance method) Once the user is authenticated, this method should
determine whether the user is permitted to access the requested URI. The
current implementation verifies whether the user is accessing a file in
the directory $basedir/$user. If not, a Perl exception is thrown with
$ar_req->{'status'} set to FORBIDDEN.
GET, PUT, MOVE, DELETE
$ar_req->GET();
$ar_req->PUT();
$ar_req->MOVE();
$ar_req->DELETE();
(Instance Methods) These methods are called finally for performing the
real action. With the exception of GET, they call *Success* finally for
reporting Ok.
Alternative method names are possible, depending on the name of the
requested file. For example, if you request the file *liprefs* via GET,
then it is checked whether your sublass has a method *GET_liprefs*. If
so, this method is called rather than the default method *GET*. The
alternative method names are obtained by removing all non-alpha- numeric
characters from the files base name. That is, if you request a file
*pab.na2*, then the alternative name is *pabna2*. Note, these method
names are case sensitive!
MkDir
$ar_req->MkDir($file);
(Instance Method) Helper function of *PUT*, creates the directory where
$file is located, if it doesn't yet exist. Works recursively, if more
than one directory must be created.
Success
$ar_req->Success($status, $text);
(Instance Method) Creates an HTML document with status $status,
containing $text as success messages.
AUTHOR AND COPYRIGHT
This module is
Copyright (C) 1998 Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Phone: +49 7123 14887
Email: joe@ispsoft.de
All rights reserved.
You may distribute this module under the terms of either the GNU General
Public License or the Artistic License, as specified in the Perl README
file.
SEE ALSO
the Apache(3) manpage, the mod_perl(3) manpage
An example subclass is Apache::Roaming::LiPrefs. See the
Apache::Roaming::LiPrefs(3) manpage.
( run in 1.202 second using v1.01-cache-2.11-cpan-39bf76dae61 )