summaryrefslogtreecommitdiffstats
path: root/lib/exilog_config.pm
blob: 3f0fc5353947cd29824800dcb49d8a597a7965b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
#
# This file is part of the exilog suite.
# 
# http://duncanthrax.net/exilog/
#
# (c) Tom Kistner 2004
#
# See LICENSE for licensing information.
#

package exilog_config;
use strict;

use lib "/usr/lib/exilog/";


BEGIN {
  use Exporter;
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

  # set the version for version checking
  $VERSION     = 0.1;
  @ISA         = qw(Exporter);
  @EXPORT      = qw(
                      $config
                      $version
                   );

  %EXPORT_TAGS = ();

  # your exported package globals go here,
  # as well as any optionally exported functions
  @EXPORT_OK   = qw();
  
  use vars qw( $config $version );
}

$version = "0.5";

$config = _read_ph("/etc/exilog/exilog.conf");

unless ($config) {
  print STDERR "($$) [exilog_config] Can't parse configuration file.\n";
  exit(0);
};

sub _read_ph {
  my $file = shift;
  
  open(PH,"< $file");
  undef $/;
  my $tmp = (eval(<PH>));
  print STDERR "Eval Error: ".$@."\n" if ($@);
  $/ = "\n";
  close(PH);
  
  return $tmp;
};

1;