Date: Wed, 16 Apr 2014 21:11:58 +0000 (UTC) From: Dag-Erling Smørgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r264560 - user/des/fbp/lib Message-ID: <201404162111.s3GLBwMJ042152@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Wed Apr 16 21:11:57 2014 New Revision: 264560 URL: http://svnweb.freebsd.org/changeset/base/264560 Log: Stitch it all together. Modified: user/des/fbp/lib/FBP.pm Modified: user/des/fbp/lib/FBP.pm ============================================================================== --- user/des/fbp/lib/FBP.pm Wed Apr 16 21:11:31 2014 (r264559) +++ user/des/fbp/lib/FBP.pm Wed Apr 16 21:11:57 2014 (r264560) @@ -1,3 +1,4 @@ +use utf8; package FBP; use Moose; use namespace::autoclean; @@ -5,20 +6,15 @@ use namespace::autoclean; use Catalyst::Runtime 5.80; # Set flags and add plugins for the application. -# -# Note that ORDERING IS IMPORTANT here as plugins are initialized in order, -# therefore you almost certainly want to keep ConfigLoader at the head of the -# list if you're using it. -# -# -Debug: activates the debug mode for very useful log messages -# ConfigLoader: will load the configuration from a Config::General file in the -# application's home directory -# Static::Simple: will serve static files from the application's root -# directory use Catalyst qw/ - -Debug ConfigLoader + DateTime + Authentication + Authentication::Credential::Password + Session + Session::State::Cookie + Session::Store::FastMmap Static::Simple /; @@ -27,21 +23,46 @@ extends 'Catalyst'; our $VERSION = '0.01'; # Configure the application. -# -# Note that settings in fbp.conf (or other external -# configuration file that you set up manually) take precedence -# over this when using ConfigLoader. Thus configuration -# details given here can function as a default configuration, -# with an external configuration file acting as an override for -# local deployment. __PACKAGE__->config( name => 'FBP', + encoding => 'UTF-8', + 'Plugin::ConfigLoader' => { + substitutions => { + UID => sub { $< }, + PID => sub { $$ }, + }, + }, + 'Plugin::Static::Simple' => { + dirs => [ 'static' ], + }, + 'Plugin::Authentication' => { + default_realm => 'fbp', + fbp => { + credential => { + class => 'Password', + password_field => 'password', + password_type => 'salted_hash', + }, + store => { + class => 'DBIx::Class', + user_model => 'FBP::Person', + }, + }, + }, # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback => 1, - enable_catalyst_header => 1, # Send X-Catalyst header ); +sub now($) { + my ($self) = @_; + + $self->stash->{now} //= DateTime->now(); +} + +# True for PostgreSQL if you have p5-DateTime-Format-Pg installed +$ENV{DBIC_DT_SEARCH_OK} = 1; + # Start the application __PACKAGE__->setup(); @@ -56,7 +77,7 @@ FBP - Catalyst based application =head1 DESCRIPTION -[enter your description here] +FreeBSD Polls =head1 SEE ALSO @@ -64,7 +85,7 @@ L<FBP::Controller::Root>, L<Catalyst> =head1 AUTHOR -Dag-Erling Smørgrav +Dag-Erling Smørgrav <des@freebsd.org> =head1 LICENSE @@ -74,3 +95,5 @@ it under the same terms as Perl itself. =cut 1; + +# $FreeBSD$
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404162111.s3GLBwMJ042152>