/usr/share/perl5/NetSDS/Conf.pm is in libnetsds-perl 1.301-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 115 116 | #===============================================================================
#
# FILE: Conf.pm
#
# DESCRIPTION: Configuration handling via command line and Config::General
#
# AUTHOR: Michael Bochkaryov (Rattler), <misha@rattler.kiev.ua>
# COMPANY: Net.Style
# CREATED: 16.05.2008 12:24:55 EEST
#===============================================================================
=head1 NAME
NetSDS::Conf - API to configuration files
=head1 SYNOPSIS
use NetSDS::Conf;
my $cf = NetSDS::Conf->getconf($conf_file);
my $val = $cf->{'parameter'};
=head1 DESCRIPTION
B<NetSDS::Conf> module is a wrapper to B<Config::General> handler for
NetSDS configuration files.
This package is for internal usage and is called from B<NetSDS::App>
or inherited modules and should be never used directly from applications.
=cut
package NetSDS::Conf;
use 5.8.0;
use strict;
use warnings;
use Config::General;
use version; our $VERSION = '1.301';
#***********************************************************************
=over
=item B<getconf()> - read parameters from configuration file
Paramters: configuration file name
Returns: cofiguration as hash reference
This method tries to read configuration file and fill object properties
with read values.
NOTE: Parameters set from command line will not be overriden.
=cut
#-----------------------------------------------------------------------
sub getconf {
my ( $proto, $cf ) = @_;
# Check if configuration file available for reading and read data
if ( $cf and ( -f $cf ) and ( -r $cf ) ) {
my $conf = Config::General->new(
-ConfigFile => $cf,
-AllowMultiOptions => 'yes',
-UseApacheInclude => 'yes',
-InterPolateVars => 'yes',
-ConfigPath => [ $ENV{NETSDS_CONF_DIR}, '/etc/NetSDS' ],
-IncludeRelative => 'yes',
-IncludeGlob => 'yes',
-UTF8 => 'yes',
);
# Parse configuration file
my %cf_hash = $conf->getall;
return \%cf_hash;
} else {
return undef;
}
} ## end sub getconf
1;
__END__
=back
=head1 EXAMPLES
=head1 BUGS
Unknown
=head1 SEE ALSO
L<Getopt::Long>, L<Config::General>, L<NetSDS::Class::Abstract>
=head1 TODO
1. Improve documentation.
=head1 AUTHOR
Michael Bochkaryov <misha@rattler.kiev.ua>
=cut
|