X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2FMaypole.pm;h=b1e066d648ce778c0c78eb51c781e474c3e33762;hb=c09994fa916c87876a4b1458e17ee2b5c5b500e5;hp=ae2ae58cd1b7046f6eb58cbcbbfc5542a1a6677e;hpb=fcef7418a2171a0a7fb8302285f56b0331ba1a4a;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index ae2ae58..b1e066d 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -12,7 +12,7 @@ use URI::QueryParam; use NEXT; use File::MMagic::XS qw(:compat); -our $VERSION = '2.11'; +our $VERSION = '2.11_pre2'; our $mmagic = File::MMagic::XS->new(); # proposed privacy conventions: @@ -453,20 +453,14 @@ sub handler : method { $self->status(Maypole::Constants::OK()); # set the default $self->__call_hook('start_request_hook'); return $self->status unless $self->status == Maypole::Constants::OK(); - die "status undefined after start_request_hook()" unless defined $self->status; - $self->get_session; $self->get_user; - my $status = $self->handler_guts; - return $status unless $status == OK; - # TODO: require send_output to return a status code $self->send_output; - return $status; } @@ -481,18 +475,24 @@ request. You'll need to set up actions and templates which return fragments of HTML rather than entire pages, but once you've done that, you can use the C method of the Maypole request object to call those actions. You may pass a query string in the usual URL style. + You should not fully qualify the Maypole URLs. +Note: any HTTP POST or URL parameters passed to the parent are not passed to the +component sub-request, only what is included in the url passed as an argyument +to the method + =cut sub component { my ( $r, $path ) = @_; - my $self = bless { parent => $r }, ref $r; + my $self = bless { parent => $r, config => $r->{config}, template_args => {}, }, ref $r; + $self->get_user; my $url = URI->new($path); + warn "path : $path\n"; $self->{path} = $url->path; $self->parse_path; $self->params( $url->query_form_hash ); - $self->query( $r->params ); $self->handler_guts; return $self->output; } @@ -592,7 +592,7 @@ sub handler_guts if ( my $error = $@ ) { $status = $self->call_exception($error, "model"); - if ( $status != OK ) + if ( $status != OK ) { warn "caught model error: $error"; return $self->debug ? @@ -916,7 +916,7 @@ processed. sub exception { my ($self, $error, $when) = @_; - if ($self->view_object->can("report_error") and $self->debug) { + if (ref $self->view_object && $self->view_object->can("report_error") and $self->debug) { $self->view_object->report_error($self, $error, $when); return OK; }