summaryrefslogtreecommitdiff
path: root/regress/tinymta/Config.pm
blob: 823678dba513945a77ce018a5a4492852e2b9565 (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
#-*- perl -*-
#
#  Copyright (C) 2006 Ken'ichi Fukamachi
#   All rights reserved. This program is free software; you can
#   redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML$
#

package TinyMTA::Config;
use strict;
use Carp;

# Descriptions: load configuration from $config_cf_file.
#    Arguments: STR($config_cf_file) OBJ($main_cf)
# Side Effects: none
# Return Value: OBJ
sub load_file
{
    my ($config_cf_file, $main_cf) = @_;

    my $opts = {};
    for my $k (keys %$main_cf) {
	my $key = sprintf("fml_%s", $k); 
	$opts->{ $key } = $main_cf->{ $k };
    }

    use FML::Config;
    my $config = new FML::Config $opts;
    $config->load_file($config_cf_file);
    return $config;
}


1;