X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=e284b1e54e8df4b03f8aee8878c64fa24959ea5d;hb=fb48746a79e660e7f5df5a22269ca9e22519eaa5;hp=68f2c0af1fdf0319d4ffa4de080532f5f787bba5;hpb=9bbeafd23117d2b489a298cc002a97b133de17bd;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 68f2c0a..e284b1e 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -14,18 +14,27 @@ sub parse_location { my $self = shift; $self->{path} = $self->{ar}->uri; my $loc = $self->{ar}->location; - $self->{path} =~ s/^$loc//; # I shouldn't need to do this? - $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; + no warnings 'uninitialized'; + $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