From owner-svn-src-user@FreeBSD.ORG Wed Apr 16 21:11:58 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B99D236; Wed, 16 Apr 2014 21:11:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C14311F5; Wed, 16 Apr 2014 21:11:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3GLBw0R042153; Wed, 16 Apr 2014 21:11:58 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3GLBwMJ042152; Wed, 16 Apr 2014 21:11:58 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201404162111.s3GLBwMJ042152@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Wed, 16 Apr 2014 21:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r264560 - user/des/fbp/lib X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2014 21:11:58 -0000 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, L =head1 AUTHOR -Dag-Erling Smørgrav +Dag-Erling Smørgrav =head1 LICENSE @@ -74,3 +95,5 @@ it under the same terms as Perl itself. =cut 1; + +# $FreeBSD$