0d85a6b7442fc2e406dcec6b4a35a3153a72b05f
[catagits/Catalyst-Authentication-Store-LDAP.git] / Test-Session-Broken / lib / Test / LDAP / Controller / Root.pm
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 ) = @_;
31 }
32
33 =head2 default
34
35 Standard 404 error page
36
37 =cut
38
39 sub default :Path {
40     my ( $self, $c ) = @_;
41
42     $c->stash->{"template"} = "error-404.tt";
43     $c->res->status(404);
44 }
45
46 =head2 end
47
48 Attempt to render a view, if needed.
49
50 =cut
51
52 sub end : ActionClass('RenderView') {
53     my ($self, $c) = @_;
54     my $errors = scalar @{$c->error};
55
56     if ($errors && not defined $c->stash->{"error_msg"}) {
57         $c->stash->{"template"} = "error-500.tt";
58
59         $c->stash->{"message"} = join "\n", @{$c->error};
60         $c->res->status(500);
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;