Permalink
Browse files

Add DBIx::Connector attribute.

  • Loading branch information...
1 parent 2cd8297 commit d5d04511943fb99e339f1bcfcea15087110ca998 @theory committed Nov 6, 2009
Showing with 14 additions and 0 deletions.
  1. +2 −0 Makefile.PL
  2. +12 −0 lib/MyApp.pm
View
@@ -10,6 +10,8 @@ requires 'Catalyst::Runtime' => '5.80013';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
+requires 'DBIx::Connector' => '0.30';
+requires 'Exception::Class::DBI' => '1.00';
requires 'parent';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
View
@@ -4,6 +4,9 @@ use strict;
use warnings;
use Catalyst::Runtime 5.80;
+use Moose;
+use DBIx::Connector;
+use Exception::Class::DBI;
# Set flags and add plugins for the application
#
@@ -36,6 +39,15 @@ __PACKAGE__->config( name => 'MyApp' );
# Start the application
__PACKAGE__->setup();
+has conn => (is => 'ro', lazy => 1, default => sub {
+ DBIx::Connector->new( 'dbi:Pg:dbname=myapp', 'postgres', '', {
+ PrintError => 0,
+ RaiseError => 0,
+ HandleError => Exception::Class::DBI->handler,
+ AutoCommit => 1,
+ pg_enable_utf8 => 1,
+ });
+});
=head1 NAME

0 comments on commit d5d0451

Please sign in to comment.