Changeset 9859

Show
Ignore:
Timestamp:
04/19/08 10:33:14 (5 years ago)
Author:
charsbar
Message:

lang/perl/Jipotter: Root cleanup

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Jipotter/branches/Cipotter/lib/Cipotter/Controller/Root.pm

    r9853 r9859  
    33use strict; 
    44use warnings; 
    5 use parent 'Catalyst::Controller'; 
     5use parent qw( Catalyst::Controller ); 
    66 
    7 # 
    8 # Sets the actions in this controller to be registered with no prefix 
    9 # so they function identically to actions created in MyApp.pm 
    10 # 
    117__PACKAGE__->config->{namespace} = ''; 
    128 
    13 =head1 NAME 
     9# XXX: What's the best way to make this configurable? 
    1410 
    15 Cipotter::Controller::Root - Root Controller for Cipotter 
     11sub base_path : Chained('/') PathPart('cipotter') CaptureArgs(0) { 
     12  my ($self, $c) = @_; 
    1613 
    17 =head1 DESCRIPTION 
    18  
    19 [enter your description here] 
    20  
    21 =head1 METHODS 
    22  
    23 =cut 
    24  
    25 =head2 default 
    26  
    27 =cut 
    28  
    29 sub index : Path Args(0) { 
    30     my ( $self, $c ) = @_; 
    31  
    32     # Hello World 
    33     $c->response->body( $c->welcome_message ); 
     14  $c->stash->{base_path} = '/cipotter'; 
    3415} 
    3516 
    3617sub default : Path { 
    37     my ( $self, $c ) = @_; 
    38     $c->response->body( 'Page not found' ); 
    39     $c->response->status(404); 
    40      
     18  my ($self, $c) = @_; 
     19 
     20  $c->detach('/not_found'); 
    4121} 
    4222 
    43 =head2 end 
     23sub not_found : Path { 
     24  my ($self, $c) = @_; 
    4425 
    45 Attempt to render a view, if needed. 
    46  
    47 =cut  
     26  $c->response->status(404); 
     27  $c->stash->{current_view} = 'ERROR'; 
     28} 
    4829 
    4930sub end : ActionClass('RenderView') {} 
    5031 
    51 =head1 AUTHOR 
    52  
    53 Catalyst developer 
    54  
    55 =head1 LICENSE 
    56  
    57 This library is free software, you can redistribute it and/or modify 
    58 it under the same terms as Perl itself. 
    59  
    60 =cut 
    61  
    62321;