]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Apache/MVC.pm
Apache2::MVC, Maypole::Application, parse_args() and much more...
[maypole.git] / lib / Apache / MVC.pm
index 0f917752bf419cc0942a1cf91f65f7a27100ad56..5005effb96f244fa0eaeae8526fc64d146160b80 100644 (file)
@@ -1,43 +1,24 @@
 package Apache::MVC;
-use base 'Maypole';
+
+use base qw(Apache::MVC::Base Maypole);
 use Apache;
 use Apache::Request;
 use strict;
 use warnings;
+
 our $VERSION = "0.3";
 
 sub get_request {
-    shift->{ar} = Apache::Request->new(Apache->request);
+    shift->{ar} = Apache::Request->new( Apache->request );
 }
 
-sub parse_location {
+sub parse_args {
     my $self = shift;
-    $self->{path} = $self->{ar}->uri;
-    my $loc = $self->{ar}->location;
-    no warnings 'uninitialized';
-    $self->{path} =~ s/^($loc)?\///;
-    $self->{path} ||= "frontpage";
-    my @pi = split /\//, $self->{path};
-    shift @pi while @pi and !$pi[0];
-    $self->{table} = shift @pi;
-    $self->{action} = shift @pi;
-    $self->{args} = \@pi;
-
     $self->{params} = { $self->{ar}->content };
-    $self->{query}  = { $self->{ar}->args };
-}
-
-sub send_output {
-    my $r = shift;
-    $r->{ar}->content_type($r->{content_type});
-    $r->{ar}->headers_out->set("Content-Length" => length $r->{output});
-    $r->{ar}->send_http_header;
-    $r->{ar}->print($r->{output});
-}
-
-sub get_template_root {
-    my $r = shift;
-    $r->{ar}->document_root . "/". $r->{ar}->location;
+    while ( my ( $key, $value ) = each %{ $self->{params} } ) {
+        $self->{params}{$key} = '' unless defined $value;
+    }
+    $self->{query} = { $self->{ar}->args };
 }
 
 1;
@@ -132,6 +113,7 @@ see L<Maypole>.
 =head1 AUTHOR
 
 Simon Cozens, C<simon@cpan.org>
+Screwed up by Sebastian Riedel, C<sri@oook.de>
 
 =head1 LICENSE