X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=645c046349e63957ac809b4d44ca78b48a56ad65;hb=6438c73c6e11a516bfb670397bfc57048ac94c44;hp=7d2114bd5952f3d6f9495a32faa30f0ecbf47131;hpb=83e1c35229307f73d613c7e8b473abf41ba9b76a;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 7d2114b..645c046 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -1,5 +1,7 @@ package Apache::MVC; +our $VERSION = '2.05'; + use strict; use warnings; @@ -17,8 +19,6 @@ if (APACHE2) { else { require Apache } require Apache::Request; -our $VERSION = "0.4"; - sub get_request { my ( $self, $r ) = @_; $self->{ar} = Apache::Request->new($r); @@ -42,8 +42,12 @@ sub parse_args { sub send_output { my $r = shift; - $r->{ar}->content_type( $r->{content_type} ."; encoding=".$r->{document_encoding} ); - $r->{ar}->headers_out->set( "Content-Length" => length $r->{output} ); + $r->{ar}->content_type( + $r->{content_type} =~ m/^text/ + ? $r->{content_type} . "; charset=" . $r->{document_encoding} + : $r->{content_type} + ); + $r->{ar}->headers_out->set( "Content-Length" => do { use bytes; length $r->{output} } ); APACHE2 || $r->{ar}->send_http_header; $r->{ar}->print( $r->{output} ); } @@ -152,6 +156,25 @@ C commands; for instance, a list of breweries, go to For more information about how the system works and how to extend it, see L. +=head1 Implementation + +This class overrides a set of methods in the base Maypole class to provide it's +functionality. See L for these: + +=over + +=item get_request + +=item get_template_root + +=item parse_args + +=item parse_location + +=item send_output + +=back + =head1 AUTHOR Simon Cozens, C