From 874f319fc7b5bd840c993860d74a4e76475d9e89 Mon Sep 17 00:00:00 2001 From: Tomas Plesnik <plesnik@ics.muni.cz> Date: Mon, 12 Jan 2015 17:32:21 +0100 Subject: [PATCH] presunuta funkce loadConf; uprava hlavicky souboru + zmena datumu; zmena nastaveni Sys::Syslog modulu; uprava formatovani --- src/warden-client/lib/WardenClientCommon.pm | 38 +++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm index 3949709..6931b6f 100755 --- a/src/warden-client/lib/WardenClientCommon.pm +++ b/src/warden-client/lib/WardenClientCommon.pm @@ -1,19 +1,20 @@ -#!/usr/bin/perl -w -# # WardenClientCommon.pm # -# Copyright (C) 2011-2013 Cesnet z.s.p.o +# Copyright (C) 2011-2015 Cesnet z.s.p.o # # Use of this source is governed by a BSD-style license, see LICENSE file. package WardenClientCommon; use strict; -use Carp; +use warnings; + use SOAP::Lite; use IO::Socket::SSL qw(debug1); use SOAP::Transport::HTTP; -use Sys::Syslog; +use Sys::Syslog qw(:DEFAULT setlogsock); +Sys::Syslog::setlogsock('unix'); +use Carp; our $VERSION = "2.2"; @@ -22,7 +23,7 @@ our $VERSION = "2.2"; #------------------------------------------------------------------------------- sub errMsg { - my $msg = shift; + my $msg = shift; my $type = shift; defined $type or $type = "err"; # default type is err. Other: warn @@ -172,4 +173,29 @@ sub getClientsInfo return @clients; } +#------------------------------------------------------------------------------- +# loadConf - load configuration file +#------------------------------------------------------------------------------- +sub loadConf +{ + my $conf_file = shift; + + our $BASEDIR = undef; + our $URI = undef; + our $SSL_KEY = undef; + our $SSL_CERT = undef; + our $SSL_CA_CERT = undef; + our $MAX_RCV_EVENTS_LIMIT = undef; + our $CONNECTION_TIMEOUT = undef; + our $LOG_STDERR = undef; + our $SYSLOG = undef; + our $SYSLOG_VERBOSE = undef; + our $SYSLOG_FACILITY = undef; + unless (do $conf_file) { + die("Errors in config file '$conf_file': $@") if $@; + die("Can't read config file '$conf_file': $!") unless defined $_; + # if $_ defined, it's retvalue of last statement of conf, for which we don't care + } +} # End of loadConf + 1; -- GitLab