|
Revision 112, 1.2 KB
(checked in by eevee, 3 years ago)
|
|
Added an auto-crash page.
Styled flagrant error page.
|
| Line | |
|---|
| 1 | package Vee::Controller::Test; |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | use base 'Catalyst::Controller'; |
|---|
| 6 | |
|---|
| 7 | use Data::Dumper; |
|---|
| 8 | |
|---|
| 9 | =head1 NAME |
|---|
| 10 | |
|---|
| 11 | Vee::Controller::Test - Test Controller |
|---|
| 12 | |
|---|
| 13 | =head1 SYNOPSIS |
|---|
| 14 | |
|---|
| 15 | See L<Vee> |
|---|
| 16 | |
|---|
| 17 | =head1 DESCRIPTION |
|---|
| 18 | |
|---|
| 19 | I use this controller for random tests of snippets of code, and for convenience |
|---|
| 20 | I am providing a nearly-empty version of it to everyone else. It is not used |
|---|
| 21 | by any other veekun code or required for anything. |
|---|
| 22 | |
|---|
| 23 | Please do not commit this file with random tests in it; it is meant to be used |
|---|
| 24 | as your own personal sandbox. If you want to write I<actual> tests, feel free |
|---|
| 25 | to load up the F<t/> directory with a few dozen. |
|---|
| 26 | |
|---|
| 27 | =head1 METHODS |
|---|
| 28 | |
|---|
| 29 | =cut |
|---|
| 30 | |
|---|
| 31 | =head2 test |
|---|
| 32 | |
|---|
| 33 | Prints a blank page with success/error/info messages at the top. |
|---|
| 34 | |
|---|
| 35 | =cut |
|---|
| 36 | |
|---|
| 37 | sub test : Path { |
|---|
| 38 | my ($self, $c) = @_; |
|---|
| 39 | my $s = $c->stash; |
|---|
| 40 | |
|---|
| 41 | $s->{success_msg} = "Success message"; |
|---|
| 42 | $s->{error_msg} = "Error message"; |
|---|
| 43 | $s->{info_msg} = "Info message"; |
|---|
| 44 | $s->{template} = 'blank.tt'; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | =head2 crash |
|---|
| 48 | |
|---|
| 49 | Deliberately crashes. |
|---|
| 50 | |
|---|
| 51 | =cut |
|---|
| 52 | |
|---|
| 53 | sub crash : Local { |
|---|
| 54 | my ($self, $c) = @_; |
|---|
| 55 | |
|---|
| 56 | my $crash = 1; |
|---|
| 57 | $crash /= 0; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | =head1 AUTHOR |
|---|
| 61 | |
|---|
| 62 | A clever guy |
|---|
| 63 | |
|---|
| 64 | =head1 LICENSE |
|---|
| 65 | |
|---|
| 66 | This library is free software, you can redistribute it and/or modify |
|---|
| 67 | it under the same terms as Perl itself. |
|---|
| 68 | |
|---|
| 69 | =cut |
|---|
| 70 | |
|---|
| 71 | 1; |
|---|