X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=3215b842320c6a7b8be7c002a1471c6cf6e4a153;hb=f9a6b47b3b916585d710eac141003fb8261d9c3c;hp=e4c0f7318e8847c1d38504ec2df014dda1a38f5e;hpb=7dda5e1451220612c6ad749746d84e4c090e330c;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index e4c0f73..3215b84 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -1,18 +1,19 @@ package Maypole; use base qw(Class::Accessor::Fast Class::Data::Inheritable); -use attributes (); use UNIVERSAL::require; use strict; use warnings; use Maypole::Config; use Maypole::Constants; +use Maypole::Headers; -our $VERSION = '2.0'; +our $VERSION = '2.05'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( qw( ar params query objects model_class template_args output path - args action template error document_encoding content_type table) + args action template error document_encoding content_type table + headers_in headers_out ) ); __PACKAGE__->config( Maypole::Config->new() ); __PACKAGE__->init_done(0); @@ -24,6 +25,7 @@ sub setup { $calling_class = ref $calling_class if ref $calling_class; { no strict 'refs'; + no warnings 'redefine'; # Naughty. *{ $calling_class . "::handler" } = @@ -49,7 +51,7 @@ sub init { $config->view->require; die "Couldn't load the view class " . $config->view . ": $@" if $@; $config->display_tables - || $config->display_tables( [ $class->config->tables ] ); + || $config->display_tables( $class->config->tables ); $class->view_object( $class->config->view->new ); $class->init_done(1); @@ -60,7 +62,8 @@ sub handler { # See Maypole::Workflow before trying to understand this. my ( $class, $req ) = @_; $class->init unless $class->init_done; - my $r = bless { config => $class->config }, $class; + my $r = bless { template_args => {}, config => $class->config }, $class; + $r->headers_out(Maypole::Headers->new); $r->get_request($req); $r->parse_location(); my $status = $r->handler_guts(); @@ -73,6 +76,7 @@ sub handler { sub handler_guts { my $r = shift; $r->model_class( $r->config->model->class_of( $r, $r->{table} ) ); + my $applicable = $r->is_applicable; unless ( $applicable == OK ) { @@ -134,7 +138,8 @@ sub is_applicable { . "Available tables are: " . join( ",", @{ $config->{display_tables} } ) if $self->debug - and not $config->ok_tables->{ $self->{table} }; + and not $config->ok_tables->{ $self->{table} } + and $self->{action}; return DECLINED() unless exists $config->ok_tables->{ $self->{table} }; # Is it public? @@ -274,6 +279,14 @@ A list of remaining parts of the request path after table and action have been removed +=head3 headers_in + +A L object containing HTTP headers for the request + +=head3 headers_out + +A L object that contains HTTP headers for the output + =head3 parse_args Turns post data and query string paramaters into a hash of C. @@ -441,8 +454,8 @@ Simon Cozens, C =head1 THANKS TO Danijel Milicevic, Dave Slack, Jesse Sheidlower, Jody Belka, Marcus Ramberg, -Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've -helped. +Mickael Joanne, Randal Schwartz, Simon Flack, Steve Simms, Veljko Vidovic +and all the others who've helped. =head1 LICENSE