X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=21071de5950e5181185ed820bb7e85e86b525772;hb=763567374b3430c726dc2fdfb38362fb960ce1eb;hp=0b1c87333838ce56fd0a679d6f9f036639c2f199;hpb=74800a709376d0ce878cabd9db6b3578c002606c;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 0b1c873..21071de 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -16,17 +16,28 @@ sub parse_location { 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->parse_path; $self->{params} = { $self->{ar}->content }; + while (my ($key, $value) = each %{$self->{params}}) { + $self->{params}{$key} = '' unless defined $value; + } $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