diff --git a/scripts/ZoneMinder/lib/ZoneMinder.pm b/scripts/ZoneMinder/lib/ZoneMinder.pm index 37292a44d..63b7c8108 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder.pm @@ -81,12 +81,6 @@ our @EXPORT = ( @EXPORT_OK ); our $VERSION = $ZoneMinder::Base::VERSION; -BEGIN { - require ZoneMinder::Config; - require ZoneMinder::Database; - ZoneMinder::Config::zmConfigLoad(); - ZoneMinder::Database::zmDbConnect(); -} 1; __END__ diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index fdea725fe..574c382f5 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -31,6 +31,7 @@ use DBI; require Exporter; require ZoneMinder::Base; +require ZoneMinder::Config; our @ISA = qw(Exporter ZoneMinder::Base); @@ -65,7 +66,6 @@ our $VERSION = $ZoneMinder::Base::VERSION; # ========================================================================== use ZoneMinder::Logger qw(:all); -use ZoneMinder::Config qw(:all); use Carp; @@ -80,23 +80,23 @@ sub zmDbConnect } if ( !defined( $dbh ) ) { - my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); + my ( $host, $port ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); if ( defined($port) ) { - $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + $dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME} .";host=".$host .";port=".$port - , $Config{ZM_DB_USER} - , $Config{ZM_DB_PASS} + , $ZoneMinder::Config::Config{ZM_DB_USER} + , $ZoneMinder::Config::Config{ZM_DB_PASS} ); } else { - $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} - .";host=".$Config{ZM_DB_HOST} - , $Config{ZM_DB_USER} - , $Config{ZM_DB_PASS} + $dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME} + .";host=".$ZoneMinder::Config::Config{ZM_DB_HOST} + , $ZoneMinder::Config::Config{ZM_DB_USER} + , $ZoneMinder::Config::Config{ZM_DB_PASS} ); } $dbh->trace( 0 );