0c452cebfbba146edc0d9f8bc23a88fef527e4a3
[catagits/Catalyst-Runtime.git] / t / lib / TestAppClassExceptionSimpleTest.pm
1 package TestAppClassExceptionSimpleTest::Exceptions;
2
3 use strict;
4 use warnings;
5
6 BEGIN {
7     $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'TestAppClassExceptionSimpleTest::Exception';
8
9     my %classes = (
10         'TestAppClassExceptionSimpleTest::Exception' => {
11             description => 'Generic exception',
12             alias       => 'throw'
13         },
14     );
15
16     my @exports = grep { defined } map { $classes{ $_ }->{ alias } } keys %classes;
17
18     require Exception::Class;
19     require Sub::Exporter;
20
21     Exception::Class->import(%classes);
22     Sub::Exporter->import( -setup => { exports => \@exports  } );
23 }
24
25 package TestAppClassExceptionSimpleTest::Exception;
26
27 ## thank to Brian
28 ## http://bricas.vox.com/library/post/catalyst-exceptionclass.html
29
30 use strict;
31 use warnings;
32 no warnings 'redefine';
33
34 use HTTP::Headers ();
35 use HTTP::Status  ();
36 use Scalar::Util  qw( blessed );
37
38 sub status {
39     return $_[0]->{status} ||= 500;
40 }
41
42 #########
43
44 package TestAppClassExceptionSimpleTest;
45
46 use strict;
47 use warnings;
48 use Scalar::Util ();
49 use Catalyst::Runtime '5.80';
50
51 use Catalyst qw/ -Debug /;
52
53 our $VERSION = '0.02';
54
55 # Start the application
56 __PACKAGE__->setup;
57
58 =head1 NAME
59
60 TestAppClassExceptionSimpleTest - Catalyst based application
61
62 =head1 SYNOPSIS
63
64     script/TestAppClassExceptionSipleTest_server.pl
65
66 =head1 DESCRIPTION
67
68 [enter your description here]
69
70 =head1 SEE ALSO
71
72 L<TestAppClassException::Controller::Root>, L<Catalyst>
73
74 =head1 AUTHOR
75
76 Ferruccio Zamuner
77
78 =head1 LICENSE
79
80 This library is free software, you can redistribute it and/or modify
81 it under the same terms as Perl itself.
82
83 =cut
84
85 1;