Maypole::Redirect - add HTTP redirect capability to Maypole


  use base 'Maypole::Redirect';

  # ... later in your code:

  sub User::go_to_google :Exported {
    my ($self,$r) = @_;
    $r->location( '' );

  sub User::display_image :Exported {
    my ($self,$r) = @_;
    $r->filename( $self->filename );


I release this as a quick hack just to get some code out. This code has ugly problems with Apache::File, so it doesn't use the functionality provided by it. This is extreme alpha quality!

The code lacks tests, the code lacks finesse, the code lacks almost everything. Use at your own risk!

Also, this code tries to fix some things I feel are ugly with Maypole, namely the lack of proper accessor methods - so this code also lacks the style to properly discuss things out with Simon until he adopts my superior view.

$app->filename FILENAME

If you set the filename, the file will be sent as the output, and all necessary headers will be generated. This method tries to use Apache::File if available.

$app->location LOCATION

By setting the location, you issue a redirect to LOCATION. This has a lower priority than a request for a directly served file as set via filename.

$app->content_type CT

An accessor method to get and set the Content-Type header for the output.

$app->log LEVEL, MESSAGE

This implements a very crude method of logging and tracing progress through the application. The message gets written to the HTTP error log if debug is set higher or equal to $level.


This sends the output. Normally this method is called from within the Maypole workflow and you don't need to bother with it. It is here where all the magic happens.


Max Maischein, <>


Maypole, Apache::Request, Apache::File.