]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
+ Use HTTP::Headers for input/output headers. Add appropriate unit tests.
[maypole.git] / lib / Maypole.pm
index eed0c74aa1a49ac89f23b8d089104ce61cdd42e3..3215b842320c6a7b8be7c002a1471c6cf6e4a153 100644 (file)
@@ -5,13 +5,15 @@ use strict;
 use warnings;
 use Maypole::Config;
 use Maypole::Constants;
+use Maypole::Headers;
 
-our $VERSION = '2.03';
+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);
@@ -23,6 +25,7 @@ sub setup {
     $calling_class = ref $calling_class if ref $calling_class;
     {
         no strict 'refs';
+        no warnings 'redefine';
 
         # Naughty.
         *{ $calling_class . "::handler" } =
@@ -59,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();
@@ -72,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 ) {
 
@@ -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<Maypole::Headers> object containing HTTP headers for the request
+
+=head3 headers_out
+
+A L<HTTP::Headers> object that contains HTTP headers for the output
+
 =head3 parse_args
 
 Turns post data and query string paramaters into a hash of C<params>.