[242] | 1 | package Epoll; |
---|
[2] | 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
[70] | 5 | use Config::YAML; |
---|
[2] | 6 | |
---|
| 7 | use Catalyst::Runtime '5.70'; |
---|
| 8 | |
---|
| 9 | # Set flags and add plugins for the application |
---|
| 10 | # |
---|
| 11 | # -Debug: activates the debug mode for very useful log messages |
---|
| 12 | # ConfigLoader: will load the configuration from a YAML file in the |
---|
| 13 | # application's home directory |
---|
| 14 | # Static::Simple: will serve static files from the application's root |
---|
| 15 | # directory |
---|
| 16 | |
---|
[9] | 17 | use Catalyst qw/ |
---|
| 18 | ConfigLoader |
---|
| 19 | Static::Simple |
---|
| 20 | Session |
---|
| 21 | Session::Store::DBI |
---|
| 22 | Session::State::Cookie |
---|
[255] | 23 | Prototype |
---|
[9] | 24 | /; |
---|
[2] | 25 | |
---|
| 26 | # Configure the application. |
---|
| 27 | # |
---|
| 28 | # Note that settings in Vote.yml (or other external |
---|
| 29 | # configuration file that you set up manually) take precedence |
---|
| 30 | # over this when using ConfigLoader. Thus configuration |
---|
| 31 | # details given here can function as a default configuration, |
---|
| 32 | # with a external configuration file acting as an override for |
---|
| 33 | # local deployment. |
---|
| 34 | |
---|
[242] | 35 | __PACKAGE__->config( name => 'Epoll' ); |
---|
[2] | 36 | |
---|
[118] | 37 | # Config file, in tree, else should be in /etc |
---|
| 38 | |
---|
| 39 | __PACKAGE__->config( |
---|
| 40 | 'Plugin::ConfigLoader' => { |
---|
[122] | 41 | file => -f __PACKAGE__->path_to('epoll.yml') |
---|
| 42 | ? __PACKAGE__->path_to('epoll.yml') |
---|
| 43 | : '/etc/epoll.yml', |
---|
[118] | 44 | } |
---|
| 45 | ); |
---|
| 46 | |
---|
[9] | 47 | __PACKAGE__->config->{session} = { |
---|
[259] | 48 | expires => 3600 * 24 * 60, |
---|
[9] | 49 | dbi_table => 'sessions', |
---|
| 50 | dbi_dsn => 'noo', |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | |
---|
[2] | 54 | # Start the application |
---|
| 55 | __PACKAGE__->setup; |
---|
| 56 | |
---|
[9] | 57 | # This is after because db config is in config file |
---|
| 58 | __PACKAGE__->config->{session}{dbi_dsn} = 'dbi:Pg:' . __PACKAGE__->config->{db}; |
---|
[2] | 59 | |
---|
[9] | 60 | |
---|
[2] | 61 | =head1 NAME |
---|
| 62 | |
---|
| 63 | Vote - Catalyst based application |
---|
| 64 | |
---|
| 65 | =head1 SYNOPSIS |
---|
| 66 | |
---|
| 67 | script/vote_server.pl |
---|
| 68 | |
---|
| 69 | =head1 DESCRIPTION |
---|
| 70 | |
---|
| 71 | [enter your description here] |
---|
| 72 | |
---|
| 73 | =head1 SEE ALSO |
---|
| 74 | |
---|
| 75 | L<Vote::Controller::Root>, L<Catalyst> |
---|
| 76 | |
---|
| 77 | =head1 AUTHOR |
---|
| 78 | |
---|
| 79 | Thauvin Olivier |
---|
| 80 | |
---|
| 81 | =head1 LICENSE |
---|
| 82 | |
---|
| 83 | This library is free software, you can redistribute it and/or modify |
---|
[129] | 84 | it under the same terms as Perl itself or CeCILL. |
---|
[2] | 85 | |
---|
| 86 | =cut |
---|
| 87 | |
---|
| 88 | 1; |
---|