CPAN-MetaPackager

 view release on metacpan or  search on metacpan

data/cpan.metapackager.conf  view on Meta::CPAN

# Database stuff
# --------------

AutoCommit				= 1
dsn						= dbi:SQLite:dbname=data/cpan.metapackager.sqlite
#dsn					= dbi:mysql:database=cpan.metapackager
#dsn					= dbi:Pg:dbname=cpan.metapackager
RaiseError				= 1
username				= local
password				= local
mysql_enable_utf8		= 1
mysql_enable_utf8mb4	= 1
pg_enable_utf8			= 1

# General stuff
# -------------

log_path = log/development.log

[webhost]

# TBA.

lib/CPAN/MetaPackager/Database.pm  view on Meta::CPAN

# -----------------------------------------------

sub init_db
{
	my($self)		= @_;
	my($config)		= $self -> config;

	my(%attributes)	=
	(
		AutoCommit 			=> $$config{AutoCommit},
		mysql_enable_utf8	=> $$config{mysql_enable_utf8},	#Ignored if not using MySQL.
		RaiseError 			=> $$config{RaiseError},
		sqlite_unicode		=> $$config{sqlite_unicode},	#Ignored if not using SQLite.
	);

	my(@dsn)	= split('=', $$config{dsn});
	$dsn[1]	 	= File::Spec -> catfile($self -> home_path, $dsn[1]);
	$dsn[0]		= "$dsn[0]=$dsn[1]";

	$self -> dbh(DBI -> connect($dsn[0], $$config{username}, $$config{password}, \%attributes) );
	$self -> dbh -> do('PRAGMA foreign_keys = ON') if ($$config{dsn} =~ /SQLite/i);



( run in 0.815 second using v1.01-cache-2.11-cpan-6aa56a78535 )