]> git.decadent.org.uk Git - maypole.git/blob - lib/Apache/MVC/Base.pm
Apache2::MVC, Maypole::Application, parse_args() and much more...
[maypole.git] / lib / Apache / MVC / Base.pm
1 package Apache::MVC::Base;
2
3 use strict;
4 use warnings;
5
6 sub parse_location {
7     my $self = shift;
8     $self->{path} = $self->{ar}->uri;
9     my $loc = $self->{ar}->location;
10     no warnings 'uninitialized';
11     $self->{path} =~ s/^($loc)?\///;
12     $self->parse_path;
13     $self->parse_args;
14 }
15
16 sub send_output {
17     my $r = shift;
18     $r->{ar}->content_type( $r->{content_type} );
19     $r->{ar}->headers_out->set( "Content-Length" => length $r->{output} );
20     $r->{ar}->send_http_header;
21     $r->{ar}->print( $r->{output} );
22 }
23
24 sub get_template_root {
25     my $r = shift;
26     $r->{ar}->document_root . "/" . $r->{ar}->location;
27 }
28
29 1;
30
31 =head1 NAME
32
33 Apache::MVC::Base - Apache front-end base class
34
35 =head1 SYNOPSIS
36
37     use base 'Apache::Maypole::Base';
38
39 =head1 DESCRIPTION
40
41 The base class for the Apache and Apache2 front-ends.
42
43 =head1 AUTHOR
44
45 Simon Cozens, C<simon@cpan.org>
46 Screwed up by Sebastian Riedel, C<sri@oook.de>
47
48 =head1 LICENSE
49
50 You may distribute this code under the same terms as Perl itself.