/[webpac2]/Webpacus/lib/Webpacus.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 398 by dpavlin, Wed Feb 15 15:23:52 2006 UTC revision 399 by dpavlin, Sun Feb 19 12:37:27 2006 UTC
# Line 16  use Catalyst qw/-Debug Line 16  use Catalyst qw/-Debug
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
# Line 69  sub default : Private { Line 70  sub default : Private {
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                          }                          }
# Line 103  sub end : Private { Line 102  sub end : Private {
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
# Line 119  sub end : Private { Line 123  sub end : Private {
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

Legend:
Removed from v.398  
changed lines
  Added in v.399

  ViewVC Help
Powered by ViewVC 1.1.26