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