Koha-Contrib-Tamil
view release on metacpan or search on metacpan
lib/Koha/Contrib/Tamil/Koha.pm view on Meta::CPAN
package Koha::Contrib::Tamil::Koha;
#ABSTRACT: Class exposing info about a Koha instance.
$Koha::Contrib::Tamil::Koha::VERSION = '0.074';
use Moose;
use Modern::Perl;
use Carp;
use XML::Simple;
use DBI;
use ZOOM;
use MARC::Record;
use MARC::File::XML;
use YAML;
use Search::Elasticsearch;
has conf_file => ( is => 'rw', isa => 'Str' );
has dbh => ( is => 'rw' );
has conf => ( is => 'rw' );
has _zconn => ( is => 'rw', isa => 'HashRef' );
has es => ( is => 'rw' );
has es_index => ( is=> 'rw' );
has koha_version => ( is => 'rw', isa => 'Num', default => 0 );
sub BUILD {
my $self = shift;
# Use KOHA_CONF environment variable by default
$self->conf_file( $ENV{KOHA_CONF} ) unless $self->conf_file;
$self->conf( XMLin( $self->conf_file,
keyattr => ['id'], forcearray => ['listen', 'server', 'serverinfo'],
suppressempty => ' ') );
# Database Handler
my $c = $self->conf->{config};
$self->dbh( DBI->connect(
"DBI:" . $c->{db_scheme} .
":dbname=" . $c->{database} .
";host=" . $c->{hostname} .
";port=" . $c->{port},
$c->{user}, $c->{pass} )
) or carp $DBI::errstr;
if ( $c->{db_scheme} eq 'mysql' ) {
# Force utf8 communication between MySQL and koha
$self->dbh->{ mysql_enable_utf8 } = 1;
$self->dbh->do( "set NAMES 'utf8'" );
$self->dbh->{ mysql_auto_reconnect } = 1;
my $tz = $ENV{TZ};
($tz) and $self->dbh->do( qq(SET time_zone = "$tz") );
}
# Zebra connections
( run in 8.085 seconds using v1.01-cache-2.11-cpan-2e0ccfb7a10 )