From f55f979cc9c63201de7d3727265a319312dd00bc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 7 May 2016 09:30:03 -0400 Subject: [PATCH] use fully specified Config to simplify symbol tables --- scripts/ZoneMinder/lib/ZoneMinder/Logger.pm | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index 0e454d784..7366ada90 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -31,6 +31,8 @@ use warnings; require Exporter; require ZoneMinder::Base; require ZoneMinder::Database; +require ZoneMinder::Config; + our @ISA = qw(Exporter ZoneMinder::Base); @@ -87,8 +89,6 @@ our $VERSION = $ZoneMinder::Base::VERSION; # # ========================================================================== -use ZoneMinder::Config qw(:all); - use DBI; use Carp; use POSIX; @@ -152,7 +152,7 @@ sub new $this->{hasTerm} = -t STDERR; ( $this->{fileName} = $0 ) =~ s|^.*/||; - $this->{logPath} = $Config{ZM_PATH_LOGS}; + $this->{logPath} = $ZoneMinder::Config::Config{ZM_PATH_LOGS}; $this->{logFile} = $this->{logPath}."/".$this->{id}.".log"; $this->{trace} = 0; @@ -165,7 +165,7 @@ sub BEGIN { # Fake the config variables that are used in case they are not defined yet # Only really necessary to support upgrade from previous version - if ( !eval('defined($Config{ZM_LOG_DEBUG})') ) + if ( !eval('defined($ZoneMinder::Config::Config{ZM_LOG_DEBUG})') ) { no strict 'subs'; no strict 'refs'; @@ -223,7 +223,7 @@ sub initialise( @ ) } else { - $tempDatabaseLevel = $Config{ZM_LOG_LEVEL_DATABASE}; + $tempDatabaseLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_DATABASE}; } if ( defined($options{fileLevel}) ) { @@ -231,7 +231,7 @@ sub initialise( @ ) } else { - $tempFileLevel = $Config{ZM_LOG_LEVEL_FILE}; + $tempFileLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_FILE}; } if ( defined($options{syslogLevel}) ) { @@ -239,7 +239,7 @@ sub initialise( @ ) } else { - $tempSyslogLevel = $Config{ZM_LOG_LEVEL_SYSLOG}; + $tempSyslogLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_SYSLOG}; } if ( defined($ENV{'LOG_PRINT'}) ) @@ -255,9 +255,9 @@ sub initialise( @ ) $tempFileLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_FILE')) ); $tempSyslogLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_SYSLOG')) ); - if ( $Config{ZM_LOG_DEBUG} ) + if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG} ) { - foreach my $target ( split( /\|/, $Config{ZM_LOG_DEBUG_TARGET} ) ) + foreach my $target ( split( /\|/, $ZoneMinder::Config::Config{ZM_LOG_DEBUG_TARGET} ) ) { if ( $target eq $this->{id} || $target eq "_".$this->{id} @@ -266,12 +266,12 @@ sub initialise( @ ) || $target eq "" ) { - if ( $Config{ZM_LOG_DEBUG_LEVEL} > NOLOG ) + if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_LEVEL} > NOLOG ) { - $tempLevel = $this->limit( $Config{ZM_LOG_DEBUG_LEVEL} ); - if ( $Config{ZM_LOG_DEBUG_FILE} ne "" ) + $tempLevel = $this->limit( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_LEVEL} ); + if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_FILE} ne "" ) { - $tempLogFile = $Config{ZM_LOG_DEBUG_FILE}; + $tempLogFile = $ZoneMinder::Config::Config{ZM_LOG_DEBUG_FILE}; $tempFileLevel = $tempLevel; } } @@ -466,9 +466,9 @@ sub databaseLevel { $databaseLevel = NOLOG; Error( "Unable to write log entries to DB, can't connect to database '" - .$Config{ZM_DB_NAME} + .$ZoneMinder::Config::Config{ZM_DB_NAME} ."' on host '" - .$Config{ZM_DB_HOST} + .$ZoneMinder::Config::Config{ZM_DB_HOST} ."'" ); } @@ -566,8 +566,8 @@ sub openFile { $LOGFILE->autoflush() if ( $this->{autoFlush} ); - my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2]; - my $webGid = (getgrnam( $Config{ZM_WEB_GROUP} ))[2]; + my $webUid = (getpwnam( $ZoneMinder::Config::Config{ZM_WEB_USER} ))[2]; + my $webGid = (getgrnam( $ZoneMinder::Config::Config{ZM_WEB_GROUP} ))[2]; if ( $> == 0 ) { chown( $webUid, $webGid, $this->{logFile} )