Apache-Layer
view release on metacpan or search on metacpan
#
# Apache::Layer
#
# Layer is designed to allow content trees to be overlayed. This means that
# you can have more than one directory searched when looking for a file to
# be returned by the server.
#
# Author: Simon Matthews <sam@peritas.com>
#
# Copyright (C) 1998 Simon Matthews. All Rights Reserved.
#
# This module is free software; you can distribute it and/or modify is under
# the same terms as Perl itself.
#
package Apache::Layer;
use strict;
# get the DECLINED and OK constants
use Apache::Constants qw(REDIRECT DECLINED OK);
use vars qw($VERSION $DEBUG);
$VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0;
sub handler {
my ($r) = @_;
my $LAYER_PATH;
my $LOCATION;
my $turi;
# get our configuration or return DECLINED as we will not process
# this request
$LAYER_PATH = $r->dir_config("apache_layer_path") || return DECLINED;
$LOCATION = $r->dir_config("apache_layer_location") || return DECLINED;
print STDERR "Apache::Layer called translating.....\n" if $DEBUG;
# get a copy of the URI
$turi = $r->uri || '';
# no URI is a really strange error
return DECLINED unless $turi;
print STDERR "Trans URI = [$turi]\n" if $DEBUG;
print STDERR "Location = [$LOCATION]\n" if $DEBUG;
# chop off the location from the uri before we look it up.
# we do this as we are passed in stuff like /images/icons/foo.gif
# and we want to look up stuff like /usr/www/images/icons/foo.gif
# where the path part is /usr/www/images
$turi =~ s/^${LOCATION}//;
my $file = '';
foreach (split(/[:,;]+/,$LAYER_PATH)) {
next unless defined($_);
( run in 2.461 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )