Bryar::Frontend::Mod_perl - Apache mod_perl interface to Bryar


Bryar documentation Contained in the Bryar distribution.

Index


Code Index:

NAME

Top

Bryar::Frontend::Mod_perl - Apache mod_perl interface to Bryar

DESCRIPTION

Top

This is a frontend to Bryar which is used when Bryar is being driven from Apache.

LICENSE

Top

This module is free software, and may be distributed under the same terms as Perl itself.

AUTHOR

Top

Copyright (C) 2003, Simon Cozens simon@kasei.com


Bryar documentation Contained in the Bryar distribution.

package Bryar::Frontend::Mod_perl;
use base 'Bryar::Frontend::Base';
use Apache::Constants qw(OK);
use Apache::Request;
use Apache;
use 5.006;
use strict;
use warnings;
use Carp;
our $VERSION = '1.1';

sub obtain_url { Apache->request->uri() }
sub obtain_path_info { Apache->request->path_info() }
sub obtain_params { my $apr = Apache::Request->new(Apache->request);
                    map { $_ => $apr->param($_) } $apr->param ;
                    }
sub send_data { my $self = shift; 
                Apache->request->send_http_header("text/html");
    Apache->request->status(OK);
                Apache->request->print(@_); 
              }
sub send_header { 
my ($self, $k, $v) = @_; Apache->request->header_out($k, $v) }

sub get_header {
    my ($self, $header) = @_;
    Apache->request->headers_in->get($header);
}

sub handler ($$) { 
    my ($class, $r)= @_;
    return -1 if$r->filename and -f $r->filename;
    Bryar->go(datadir => $r->dir_config('BryarDataDir'),
              baseurl => $r->dir_config('BryarBaseURL')); 
}


1;