File: Defaults.pm

package info (click to toggle)
munin 2.0.76-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,064 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (114 lines) | stat: -rw-r--r-- 2,352 bytes parent folder | download | duplicates (4)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
use warnings;
use strict;

# If you change the class path take a look in get_defaults too, please!
package Munin::Common::Defaults;

use English qw(-no_match_vars);
use File::Basename qw(dirname);

# This file's package variables are changed during the build process.

# This variable makes only sense in development environment
my $COMPONENT_ROOT = dirname(__FILE__) . '/../../..';


our $DROPDOWNLIMIT     = 1;

our $MUNIN_PREFIX     = '';
our $MUNIN_CONFDIR    = "$COMPONENT_ROOT/t/config/";
our $MUNIN_BINDIR     = '';
our $MUNIN_SBINDIR    = '';
our $MUNIN_DOCDIR     = '';
our $MUNIN_LIBDIR     = '';
our $MUNIN_HTMLDIR    = '';
our $MUNIN_CGIDIR     = '';
our $MUNIN_CGITMPDIR     = '';
our $MUNIN_DBDIR      = '';
our $MUNIN_PLUGSTATE  = ''; 
our $MUNIN_SPOOLDIR   = '';
our $MUNIN_MANDIR     = '';
our $MUNIN_LOGDIR     = "$COMPONENT_ROOT/log/";
our $MUNIN_STATEDIR   = ''; 
our $MUNIN_USER       = getpwuid $UID;
our $MUNIN_GROUP      = getgrgid $GID;
our $MUNIN_PLUGINUSER = getpwuid $UID;
our $MUNIN_VERSION    = 'svn';
our $MUNIN_PERL       = '/usr/bin/perl';
our $MUNIN_PERLLIB    = '';
our $MUNIN_GOODSH     = '';
our $MUNIN_BASH       = '';
our $MUNIN_PYTHON     = '';
our $MUNIN_RUBY       = '';
our $MUNIN_OSTYPE     = '';
our $MUNIN_HOSTNAME   = '';
our $MUNIN_MKTEMP     = '';
our $MUNIN_HASSETR    = '';


sub get_defaults {
    my ($class) = @_;
    
    ## no critic

    no strict 'refs';
    my $defaults = {};
    for my $g (keys %{"Munin::Common::Defaults::"}) {
        next unless $g =~ /MUNIN_/;
        $defaults->{$g} = ${*$g{'SCALAR'}};
    }

    ## use critic

    return $defaults;
}


sub export_to_environment {
    my ($class) = @_;

    my %defaults = %{$class->get_defaults()};
    while (my ($k, $v) = each %defaults) {
        $ENV{$k} = $v;
    }

    return
}


1;


__END__


=head1 NAME

Munin::Common::Defaults - Default values defined by installation
scripts.


=head1 PACKAGE VARIABLES

See L<http://munin-monitoring.org/wiki/MuninInstallProcedure> for
more information on the variables provided by this package.


=head1 METHODS

=over

=item B<get_defaults>

  \%defaults = $class->get_defaults()

Returns all the package variables as key value pairs in a hash.

=item B<export_to_environment>

  $class = $class->export_to_environment()

Export all the package variables to the environment.

=back