Test case using Exception::Class
[catagits/Catalyst-Runtime.git] / t / lib / TestAppClassExceptionSimpleTest.pm
CommitLineData
08f9c848 1package TestAppClassExceptionSimpleTest::Exceptions;
2
3use strict;
4use warnings;
5
6BEGIN {
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
25package TestAppClassExceptionSimpleTest::Exception;
26
27## thank to Brian
28## http://bricas.vox.com/library/post/catalyst-exceptionclass.html
29
30use strict;
31use warnings;
32no warnings 'redefine';
33
34use HTTP::Headers ();
35use HTTP::Status ();
36use Scalar::Util qw( blessed );
37
38sub status {
39 return $_[0]->{status} ||= 500;
40}
41
42#########
43
44package TestAppClassExceptionSimpleTest;
45
46use strict;
47use warnings;
48use Scalar::Util ();
49use Catalyst::Runtime '5.80';
50
51use Catalyst qw/ -Debug /;
52
53our $VERSION = '0.02';
54
55# Start the application
56__PACKAGE__->setup;
57
58=head1 NAME
59
60TestAppClassExceptionSimpleTest - 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
72L<TestAppClassException::Controller::Root>, L<Catalyst>
73
74=head1 AUTHOR
75
76Ferruccio Zamuner
77
78=head1 LICENSE
79
80This library is free software, you can redistribute it and/or modify
81it under the same terms as Perl itself.
82
83=cut
84
851;