App-Office-Contacts
view release on metacpan or search on metacpan
lib/App/Office/Contacts/Database.pm view on Meta::CPAN
is => 'rw',
#isa => 'Data::Session',
required => 0,
);
has simple =>
(
default => sub{return ''},
is => 'rw',
#isa => 'DBIx::Simple',
required => 0,
);
has templater =>
(
default => sub{return ''},
is => 'rw',
#isa => 'Text::Xslate',
required => 0,
);
our $VERSION = '2.04';
# -----------------------------------------------
sub BUILD
{
my($self) = @_;
my($config) = $self -> module_config;
# We do this to short-circuit $self -> logger -> simple everywhere.
$self -> simple($self -> logger -> simple);
$self -> templater
(
Text::Xslate -> new
(
input_layer => '',
path => $$config{template_path},
)
);
# Set up the session. To simplify things we always use
# Data::Session, and ignore the PSGI alternative.
$self -> session
(
Data::Session -> new
(
data_source => $$config{dsn},
dbh => $self -> simple -> dbh,
name => 'sid',
pg_bytea => $$config{pg_bytea} || 0,
pg_text => $$config{pg_text} || 0,
query => $self -> query,
table_name => $$config{session_table_name},
type => $$config{session_driver},
)
);
# Force the session object to be updated by setting an arbitrary parameter.
# This means the object will be flushed in the teardown phase.
$self -> session -> param(_initialized => 1);
$self -> autocomplete(App::Office::Contacts::Database::AutoComplete -> new
(
db => $self,
) );
$self -> email_address(App::Office::Contacts::Database::EmailAddress -> new
(
db => $self,
) );
$self -> note(App::Office::Contacts::Database::Note -> new
(
db => $self,
) );
$self -> occupation(App::Office::Contacts::Database::Occupation -> new
(
db => $self,
) );
$self -> organization(App::Office::Contacts::Database::Organization -> new
(
db => $self,
) );
$self -> person(App::Office::Contacts::Database::Person -> new
(
db => $self,
) );
$self -> phone_number(App::Office::Contacts::Database::PhoneNumber -> new
(
db => $self,
) );
# The next call sets $self -> library().
# It allows init() to be overridden by a subclass,
# specifically App::Office::Contacts::Donations::Database.
$self -> init;
} # End of BUILD.
# --------------------------------------------------
sub init
{
my($self) = @_;
$self -> library(App::Office::Contacts::Database::Library -> new
(
db => $self,
) );
} # End of init.
( run in 1.629 second using v1.01-cache-2.11-cpan-39bf76dae61 )