[2] | 1 | package Vote; |
---|
| 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 |
---|
| 23 | /; |
---|
[2] | 24 | |
---|
[129] | 25 | our $VERSION = '0.10'; |
---|
[2] | 26 | |
---|
| 27 | # Configure the application. |
---|
| 28 | # |
---|
| 29 | # Note that settings in Vote.yml (or other external |
---|
| 30 | # configuration file that you set up manually) take precedence |
---|
| 31 | # over this when using ConfigLoader. Thus configuration |
---|
| 32 | # details given here can function as a default configuration, |
---|
| 33 | # with a external configuration file acting as an override for |
---|
| 34 | # local deployment. |
---|
| 35 | |
---|
| 36 | __PACKAGE__->config( name => 'Vote' ); |
---|
| 37 | |
---|
[118] | 38 | # Config file, in tree, else should be in /etc |
---|
| 39 | |
---|
| 40 | __PACKAGE__->config( |
---|
| 41 | 'Plugin::ConfigLoader' => { |
---|
[122] | 42 | file => -f __PACKAGE__->path_to('epoll.yml') |
---|
| 43 | ? __PACKAGE__->path_to('epoll.yml') |
---|
| 44 | : '/etc/epoll.yml', |
---|
[118] | 45 | } |
---|
| 46 | ); |
---|
| 47 | |
---|
[9] | 48 | __PACKAGE__->config->{session} = { |
---|
| 49 | expires => 1800, |
---|
| 50 | dbi_table => 'sessions', |
---|
| 51 | dbi_dsn => 'noo', |
---|
| 52 | }; |
---|
| 53 | |
---|
| 54 | |
---|
[2] | 55 | # Start the application |
---|
| 56 | __PACKAGE__->setup; |
---|
| 57 | |
---|
[9] | 58 | # This is after because db config is in config file |
---|
| 59 | __PACKAGE__->config->{session}{dbi_dsn} = 'dbi:Pg:' . __PACKAGE__->config->{db}; |
---|
[2] | 60 | |
---|
[9] | 61 | |
---|
[2] | 62 | =head1 NAME |
---|
| 63 | |
---|
| 64 | Vote - Catalyst based application |
---|
| 65 | |
---|
| 66 | =head1 SYNOPSIS |
---|
| 67 | |
---|
| 68 | script/vote_server.pl |
---|
| 69 | |
---|
| 70 | =head1 DESCRIPTION |
---|
| 71 | |
---|
| 72 | [enter your description here] |
---|
| 73 | |
---|
| 74 | =head1 SEE ALSO |
---|
| 75 | |
---|
| 76 | L<Vote::Controller::Root>, L<Catalyst> |
---|
| 77 | |
---|
| 78 | =head1 AUTHOR |
---|
| 79 | |
---|
| 80 | Thauvin Olivier |
---|
| 81 | |
---|
| 82 | =head1 LICENSE |
---|
| 83 | |
---|
| 84 | This library is free software, you can redistribute it and/or modify |
---|
[129] | 85 | it under the same terms as Perl itself or CeCILL. |
---|
[2] | 86 | |
---|
| 87 | =cut |
---|
| 88 | |
---|
| 89 | 1; |
---|