Skip to content
Snippets Groups Projects
Select Git revision
  • eb10ca8a4b170ce5aa8b2cd29b954db8c45db88d
  • zig default
  • master
  • zig-threaded
  • openat
  • chdir
  • clear
  • compll
  • v1.18.1
  • v2.2.2
  • v1.18
  • v2.2.1
  • v2.2
  • v1.17
  • v2.1.2
  • v2.1.1
  • v2.1
  • v2.0.1
  • v2.0
  • v2.0-beta3
  • v2.0-beta2
  • v2.0-beta1
  • v1.16
  • v1.15.1
  • v1.15
  • v1.14.2
  • v1.14.1
  • v1.14
28 results

delete.c

Blame
  • WardenCommon.pm 3.52 KiB
    # WardenCommon.pm
    #
    # Copyright (C) 2011-2014 Cesnet z.s.p.o
    #
    # Use of this source is governed by a BSD-style license, see LICENSE file.
    
    package WardenCommon;
    
    use strict;
    use warnings;
    
    use Sys::Syslog qw(:DEFAULT setlogsock);
    Sys::Syslog::setlogsock('unix');
    use Carp;
    
    our $VERSION = "2.2";
    
    #-------------------------------------------------------------------------------
    # succMsg - print message and exit seccessfully
    #-------------------------------------------------------------------------------
    sub succMsg
    {
      my $msg = shift;
      $msg = trim($msg);
      print $msg . "\n";
      exit 0;
    } # End of succMsg
    
    
    #-------------------------------------------------------------------------------
    # errMsg - print error message and exit unsuccessfully
    #-------------------------------------------------------------------------------
    sub errMsg
    {
      my $msg = shift;
      $msg = trim($msg);
      print $msg . "\n";
      exit 1;
    } # End of errMsg
    
    
    #-------------------------------------------------------------------------------
    # trim - remove whitespace from the start and end of the string
    #-------------------------------------------------------------------------------
    sub trim
    {
      my $string = shift;
      $string =~ s/^\s+//;
      $string =~ s/\s+$//;
      return $string;
    } # End of trim
    
    
    #-------------------------------------------------------------------------------
    # sendMsg - sent message via syslog (SYS::Syslog) and to client (SOAP::Fault)
    #-------------------------------------------------------------------------------
    sub sendMsg
    {
      my $syslog            = shift;
      my $syslog_verbose    = shift;
      my $syslog_facility   = shift;
      my $severity          = shift;
      my $syslog_msg        = shift;
      my $soap_msg          = shift;
      my $filename          = shift;
    
      if ($syslog_verbose == 1 && ($severity eq "err" || $severity eq "debug")) {
        $syslog_msg .= "\nStack info: " . Carp::longmess();
      }