Commit | Line | Data |
ecd7abea |
1 | package Test::LDAP::Controller::Root; |
2 | use Moose; |
3 | use namespace::autoclean; |
4 | |
5 | BEGIN { extends 'Catalyst::Controller' } |
6 | |
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 | # |
11 | __PACKAGE__->config(namespace => ''); |
12 | |
13 | =head1 NAME |
14 | |
15 | Test::LDAP::Controller::Root - Root Controller for Test::LDAP |
16 | |
17 | =head1 DESCRIPTION |
18 | |
19 | [enter your description here] |
20 | |
21 | =head1 METHODS |
22 | |
23 | =head2 itndex |
24 | |
25 | The root page (/) |
26 | |
27 | =cut |
28 | |
29 | sub index :Path :Args(0) { |
30 | my ( $self, $c ) = @_; |
2148a3cd |
31 | |
32 | $c->res->body("Index"); |
ecd7abea |
33 | } |
34 | |
35 | =head2 default |
36 | |
37 | Standard 404 error page |
38 | |
39 | =cut |
40 | |
41 | sub default :Path { |
42 | my ( $self, $c ) = @_; |
43 | |
2148a3cd |
44 | $c->res->body("Not found"); |
ecd7abea |
45 | $c->res->status(404); |
46 | } |
47 | |
48 | =head2 end |
49 | |
50 | Attempt to render a view, if needed. |
51 | |
52 | =cut |
53 | |
54 | sub end : ActionClass('RenderView') { |
55 | my ($self, $c) = @_; |
56 | my $errors = scalar @{$c->error}; |
57 | |
2148a3cd |
58 | if ($errors) { |
59 | $c->res->body("Internal error"); |
60 | $c->res->status("500"); |
ecd7abea |
61 | $c->clear_errors; |
62 | } |
63 | } |
64 | |
65 | =head1 AUTHOR |
66 | |
67 | root |
68 | |
69 | =head1 LICENSE |
70 | |
71 | This library is free software. You can redistribute it and/or modify |
72 | it under the same terms as Perl itself. |
73 | |
74 | =cut |
75 | |
76 | __PACKAGE__->meta->make_immutable; |
77 | |
78 | 1; |