--- Webpacus/lib/Webpacus.pm 2006/02/15 15:23:52 396 +++ Webpacus/lib/Webpacus.pm 2006/03/19 22:57:05 422 @@ -16,10 +16,11 @@ SubRequest Static::Simple StackTrace + Dumper /; # FormValidator -our $VERSION = '0.32-dev'; +our $VERSION = '0.34-dev'; # # Configure the application @@ -58,7 +59,7 @@ my ( $self, $c ) = @_; $c->stash->{template} = 'index.tt'; - my $site_name = shift @{ $c->req->args }; + my $site_name = shift @{ $c->req->args } || ''; $c->log->debug("trying site name: $site_name"); @@ -69,10 +70,8 @@ $c->stash->{site} = $site_name; if (my $action = join('/', @{ $c->req->args })) { $c->log->debug( "site: $site_name, action: $action" ); - # TODO can I really change base like this? - $c->stash->{base} = "/$site_name/" . $c->stash->{base} - if ($c->stash->{base} && $$c->stash->{base} !~ m#^/\Q$site_name\E/#); - $c->internal_redirect( $action, $c->stash, @{ $c->req->args } ); + # do a subrequest + $c->res->body( $c->subreq( $action, $c->stash, @{ $c->req->args } ) ); } else { $c->log->debug( "site: $site_name" ); } @@ -103,7 +102,12 @@ } else { $c->log->warn("can't find $template_path, fallback to default"); } - $c->log->debug("using template ", $c->stash->{template}); + $c->log->debug("using template " . $c->stash->{template}); + + $c->stash->{site_url} = "/$site_name/"; + + #$c->log->dumper( $c->stash, 'stash' ); + } # Forward to View unless response body is already defined @@ -119,25 +123,6 @@ } -=item internal_redirect - - $c->internal_redirect( $action, @args ); - -=cut - -sub internal_redirect { - my ( $c, $action, @args ) = @_; - - unless ( defined $action ) { - $action = $c->action->namespace; - } else { - $action = join '/', $c->action->namespace, $action unless $action =~ m!^/!; - } - $c->res->body( $c->subreq( $action, @args ) ); - return; -} - - =back =head1 AUTHOR