+=head1 NAME
+
+Apache::MVC - Apache front-end to Maypole
+
+=head1 SYNOPSIS
+
+ package BeerDB;
+ use Maypole::Application;
+
+=head1 DESCRIPTION
+
+A mod_perl platform driver for Maypole. Your application can inherit from
+Apache::MVC directly, but it is recommended that you use
+L<Maypole::Application>.
+
+=head1 INSTALLATION
+
+Create a driver module like the one illustrated in L<Maypole::Application>.
+
+Put the following in your Apache config:
+
+ <Location /beer>
+ SetHandler perl-script
+ PerlHandler BeerDB
+ </Location>
+
+Copy the templates found in F<templates/factory> into the F<beer/factory>
+directory off the web root. When the designers get back to you with custom
+templates, they are to go in F<beer/custom>. If you need to override templates
+on a database-table-by-table basis, put the new template in F<beer/I<table>>.
+
+This will automatically give you C<add>, C<edit>, C<list>, C<view> and C<delete>
+commands; for instance, to see a list of breweries, go to
+
+ http://your.site/beer/brewery/list
+
+For more information about how the system works and how to extend it,
+see L<Maypole>.
+
+=head1 Implementation
+
+This class overrides a set of methods in the base Maypole class to provide its
+functionality. See L<Maypole> for these:
+
+=over
+
+=item get_request
+
+=cut
+
+sub get_request {
+ my ($self, $r) = @_;
+ my $request_options = $self->config->request_options || {};
+ my $ar;
+ if ($MODPERL2) {
+ $ar = eval {require Apache2::Request} ? Apache2::Request->new($r,%{$request_options}) : $r;
+ } else {
+ if (keys %$request_options) {
+ $ar = Apache::Request->new($r,%{$request_options});
+ } else {
+ $ar = Apache::Request->instance($r);
+ }
+ }
+ $self->ar($ar);
+}
+
+=item warn
+
+=cut
+
+sub warn {
+ my ($self,@args) = @_;
+ my ($package, $line) = (caller)[0,2];
+ my $ar = $self->parent ? $self->parent->{ar} : $self->{ar};
+ if ( $args[0] and ref $self ) {
+ $ar->warn("[$package line $line] ", @args) ;
+ } else {
+ print "warn called by ", caller, " with ", @_, "\n";
+ }
+ return;