MrGamoo/Config.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 38 CC 2 SCAR 11.0
CC
2
Cov
0%
handle_config
6.0
conf_value
2.0
BEGIN
2.0
CRAP 3.0
1 # -*- perl -*-
2  
3 # Copyright (c) 2009 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2009-Mar-27 17:31 (EDT)
6 # Function: parse the config file
7 #
8 # $Id: Config.pm,v 1.2 2011/01/12 19:18:52 jaw Exp $
9  
10 package AC::MrGamoo::Config;
11 use AC::Misc;
12 use AC::Import;
13 use AC::ConfigFile::Simple;
14 use Socket;
15 use strict;
16  
17 our @ISA = 'AC::ConfigFile::Simple';
18 our @EXPORT = qw(conf_value);
19  
20  
21 my %CONFIG = (
22  
23 include => \&AC::ConfigFile::Simple::include_file,
24 debug => \&AC::ConfigFile::Simple::parse_debug,
25 allow => \&AC::ConfigFile::Simple::parse_allow,
26 port => \&AC::ConfigFile::Simple::parse_keyvalue,
27 environment => \&AC::ConfigFile::Simple::parse_keyvalue,
28 basedir => \&AC::ConfigFile::Simple::parse_keyvalue,
29 syslog => \&AC::ConfigFile::Simple::parse_keyvalue,
30 seedpeer => \&AC::ConfigFile::Simple::parse_keyarray,
31 scriblr => \&AC::ConfigFile::Simple::parse_keyvalue,
32 sortprog => \&AC::ConfigFile::Simple::parse_keyvalue,
33 gzprog => \&AC::ConfigFile::Simple::parse_keyvalue,
34 );
35  
36  
37  
38 ################################################################
39  
40 sub handle_config {
41 my $me = shift;
42 my $key = shift;
43 my $rest = shift;
44  
45 my $fnc = $CONFIG{$key};
46 return unless $fnc;
47 $fnc->($me, $key, $rest);
48 return 1;
49 }
50  
51 ################################################################
52  
53 sub conf_value {
54 my $key = shift;
55  
56 return $AC::MrGamoo::CONF->{config}{$key};
57 }
58  
59  
60 1;