Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

  (email not shown publicly)

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm :,,
lug : Devon & Cornwall LUG
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl []
flickr :hashbangperl []

Journal of TeeJay (2309)

Tuesday June 05, 2007
03:18 PM

Funky new feature in Maypole 2.12 / SVN

[ #33435 ]
I've added a new hook into the Maypole request process - preprocess_location - allows you to do what it says on the tin - you can rewrite urls, or as I've done today - you can set configuration per request based on hostname and path..

sub preprocess_location {
  my $self = shift;

  # get uri base, template_paths, client, etc from url
  my $site_config = My::Config->get_site(scheme=>'http', host=>$self->headers_in->get('host'), path => $self->ar->uri);

  $self->config->additional->{site_config} = $site_config;
  $self->config->additional->{client_id} = $site_config->client_id;

  my $custom_path = $site_config->custom_path;
  if ($custom_path) {
    my $default_path = $ENV{TEMPLATE_ROOT};
    my $template_paths = [ $custom_path, $default_path ];

The Config package in turn uses Config::Context to load per host/path configuration from an apache style config file.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.