--- trunk/lib/App/RoomReservation.pm 2009/06/28 18:51:49 1095 +++ trunk/lib/App/RoomReservation.pm 2009/06/28 22:14:22 1098 @@ -5,12 +5,29 @@ with 'Frey::Web'; #with 'Frey::Storage'; +use lib 'lib'; use App::RoomReservation::Room; +sub dsn { 'DBI:Pg:dbname=room-reservation' } + +our $dbh; +sub dbh { + my ($self) = @_; + + return $dbh if defined $dbh; + + $dbh = DBI->connect( $self->dsn, '', '', { RaiseError => 1 } ) || die $DBI::errstr; + $dbh->do( qq{ set client_encoding='utf-8' } ) if $self->dsn =~ m{pg}i; + + return $dbh; +} + sub as_markup { my ($self) = @_; App::RoomReservation::Room->new->room_markup + . qq|seat reservation| + ; } 1;