]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Apache/MVC.pm
Maypole::CLI and the beginnings of a test suite.
[maypole.git] / lib / Apache / MVC.pm
index d43e292534984f0ce2faf13eb0be713e6a385e74..e284b1e54e8df4b03f8aee8878c64fa24959ea5d 100644 (file)
@@ -15,18 +15,26 @@ sub parse_location {
     $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->{path} =~ s/^($loc)?\///;
+    $self->parse_path;
 
     $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;
+}
+
 1;
 
 =head1 NAME