12 return $self->handler();
16 shift->{cgi} = CGI::Simple->new();
21 $self->{path} = $self->{cgi}->url( -absolute => 1, -path_info => 1 );
22 my $loc = $self->{cgi}->url( -absolute => 1 );
23 no warnings 'uninitialized';
24 $self->{path} .= '/' if $self->{path} eq $loc;
25 $self->{path} =~ s/^($loc)?\///;
32 my (%vars) = $self->{cgi}->Vars;
33 while ( my ( $key, $value ) = each %vars ) {
34 my @values = split "\0", $value;
35 $vars{$key} = @values <= 1 ? $values[0] : \@values;
37 $self->{params} = {%vars};
38 $self->{query} = {%vars};
43 my %processed = map { "-".$_,$r->{extra_headers}{$_} }
44 keys %{$r->{extra_headers}};
45 print $r->{cgi}->header(
46 -type => $r->{content_type},
47 -charset => $r->{document_encoding},
48 -content_length => do { use bytes; length $r->{output} },
56 sub get_template_root {
58 $r->{cgi}->document_root . "/" . $r->{cgi}->url( -relative => 1 );
65 CGI::Maypole - CGI-based front-end to Maypole
70 use base 'CGI::Maypole';
71 BeerDB->setup("dbi:mysql:beerdb");
72 BeerDB->config->uri_base("http://your.site/cgi-bin/beer.cgi/");
73 BeerDB->config->display_tables([qw[beer brewery pub style]]);
74 BeerDB->config->template_root("/var/www/beerdb/");
75 # Now set up your database:
88 Now to access the beer database, type this URL into your browser:
89 http://your.site/cgi-bin/beer.cgi/frontpage
93 This is a handler for Maypole which will use the CGI instead of Apache's
94 C<mod_perl> 1.x. This handler can also be used for Apache 2.0.
102 Call this from your CGI script to start the Maypole application.
106 =head1 Implementation
108 This class overrides a set of methods in the base Maypole class to provide it's
109 functionality. See L<Maypole> for these:
115 =item get_template_root
127 Dave Ranney C<dave@sialia.com>
129 Simon Cozens C<simon@cpan.org>