1 |
package Webpacus; |
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
# |
7 |
# Set flags and add plugins for the application |
8 |
# |
9 |
# -Debug: activates the debug mode for very useful log messages |
10 |
# Static::Simple: will serve static files from the applications root directory |
11 |
# |
12 |
use Catalyst qw/-Debug |
13 |
Prototype |
14 |
Config::YAML |
15 |
FillInForm |
16 |
SubRequest |
17 |
Static::Simple |
18 |
StackTrace |
19 |
/; |
20 |
# FormValidator |
21 |
|
22 |
our $VERSION = '0.29-dev'; |
23 |
|
24 |
# |
25 |
# Configure the application |
26 |
# |
27 |
__PACKAGE__->config( |
28 |
name => 'Webpacus', |
29 |
config_file => 'config.yml', |
30 |
); |
31 |
|
32 |
# |
33 |
# Start the application |
34 |
# |
35 |
__PACKAGE__->setup; |
36 |
|
37 |
=head1 NAME |
38 |
|
39 |
Webpacus - Catalyst based application |
40 |
|
41 |
=head1 SYNOPSIS |
42 |
|
43 |
script/webpacus_server.pl |
44 |
|
45 |
=head1 DESCRIPTION |
46 |
|
47 |
Catalyst based application. |
48 |
|
49 |
=head1 METHODS |
50 |
|
51 |
=over 4 |
52 |
|
53 |
=item default |
54 |
|
55 |
=cut |
56 |
|
57 |
sub default : Private { |
58 |
my ( $self, $c ) = @_; |
59 |
$c->stash->{template} = 'index.tt'; |
60 |
} |
61 |
|
62 |
=item end |
63 |
|
64 |
=cut |
65 |
|
66 |
sub end : Private { |
67 |
my ( $self, $c ) = @_; |
68 |
|
69 |
$c->stash->{webpacus_version} = $VERSION; |
70 |
|
71 |
if ($c->response->body) { |
72 |
$c->log->debug("at end body exists, we won't touch it!"); |
73 |
} else { |
74 |
$c->fillform( $c->req->params ); |
75 |
|
76 |
# Forward to View unless response body is already defined |
77 |
$c->forward('View::TT'); |
78 |
|
79 |
$c->response->{body} =~ s#\Qnew Ajax.Autocompleter(\E#new WebPAC.Suggest(#gs; |
80 |
$c->response->{body} =~ s#\Qnew Ajax.Updater(\E#new WebPAC.Updater(#gs; |
81 |
|
82 |
# $c->log->debug( $c->response->body ); |
83 |
} |
84 |
|
85 |
} |
86 |
|
87 |
=back |
88 |
|
89 |
=head1 AUTHOR |
90 |
|
91 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
92 |
|
93 |
=head1 LICENSE |
94 |
|
95 |
This library is free software, you can redistribute it and/or modify |
96 |
it under the same terms as Perl itself. |
97 |
|
98 |
=cut |
99 |
|
100 |
1; |