16 |
SubRequest |
SubRequest |
17 |
Static::Simple |
Static::Simple |
18 |
StackTrace |
StackTrace |
19 |
|
Dumper |
20 |
/; |
/; |
21 |
# FormValidator |
# FormValidator |
22 |
|
|
23 |
our $VERSION = '0.32-dev'; |
our $VERSION = '0.33-dev'; |
24 |
|
|
25 |
# |
# |
26 |
# Configure the application |
# Configure the application |
70 |
$c->stash->{site} = $site_name; |
$c->stash->{site} = $site_name; |
71 |
if (my $action = join('/', @{ $c->req->args })) { |
if (my $action = join('/', @{ $c->req->args })) { |
72 |
$c->log->debug( "site: $site_name, action: $action" ); |
$c->log->debug( "site: $site_name, action: $action" ); |
73 |
# TODO can I really change base like this? |
# do a subrequest |
74 |
$c->stash->{base} = "/$site_name/" . $c->stash->{base} |
$c->res->body( $c->subreq( $action, $c->stash, @{ $c->req->args } ) ); |
|
if ($c->stash->{base} && $$c->stash->{base} !~ m#^/\Q$site_name\E/#); |
|
|
$c->internal_redirect( $action, $c->stash, @{ $c->req->args } ); |
|
75 |
} else { |
} else { |
76 |
$c->log->debug( "site: $site_name" ); |
$c->log->debug( "site: $site_name" ); |
77 |
} |
} |
102 |
} else { |
} else { |
103 |
$c->log->warn("can't find $template_path, fallback to default"); |
$c->log->warn("can't find $template_path, fallback to default"); |
104 |
} |
} |
105 |
$c->log->debug("using template ", $c->stash->{template}); |
$c->log->debug("using template " . $c->stash->{template}); |
106 |
|
|
107 |
|
$c->stash->{site_url} = "/$site_name/"; |
108 |
|
|
109 |
|
$c->log->dumper( $c->stash, 'stash' ); |
110 |
|
|
111 |
} |
} |
112 |
|
|
113 |
# Forward to View unless response body is already defined |
# Forward to View unless response body is already defined |
123 |
|
|
124 |
} |
} |
125 |
|
|
|
=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; |
|
|
} |
|
|
|
|
|
|
|
126 |
=back |
=back |
127 |
|
|
128 |
=head1 AUTHOR |
=head1 AUTHOR |