blib/lib/WWW/Link_Controller/ReadConf.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 75 CC 12 SCAR 47.7
CC
12
Cov
0%
BEGIN
156.0
BEGIN
2.0
BEGIN
2.0
CRAP 117.5
1 #Configuration - we go through %ENV, so you'd better not be running SUID
2 #eval to ignore if a file doesn't exist.. e.g. the system config
3 package WWW::Link_Controller::ReadConf;
4 $REVISION=q$Revision: 1.4 $ ; $VERSION = sprintf ( "%d.%02d", $REVISION =~ /(\d+).(\d+)/ );
5 use vars qw($VERSION);
6 $VERSION=0.002;
7  
8 package main;
9  
10 #declare variables to allow partially configured setups to work.
11  
12 use vars qw($user_address $schedule $links $page_index $link_index
13 $fixlink_cgi);
14  
15 #FIXME: we should check that the modes of these files are such that
16 #they cannot be modified by people other than the user.
17  
18 BEGIN { eval { require "/etc/link-control.pl"; }; #FIXME local setup
19 $DB::single = 1;
20 die "System config failed: $@"
21 if $@ and not $@ =~ m/Can't locate/;
22 eval { require $ENV{"HOME"} . "/.link-control.pl"; } if $ENV{"HOME"};
23 die "User config failed: $@"
24 if $@ and not $@ =~ m/Can't locate/;
25  
26 if ( defined $::base_dir ) {
27  
28 -e $::base_dir or do {
29 mkdir $::base_dir;
30 die "couldn't create base directory $::base_dir" unless -d $::base_dir;
31 };
32 die "config directory $::base_dir isn't a directory" unless -d $::base_dir;
33  
34 $::links="$::base_dir/links.bdbm" unless defined $::links;
35 $::page_index="$::base_dir/page_has_link.cdb" unless defined $::page_index;
36 $::link_index="$::base_dir/link_on_page.cdb" unless defined $::link_index;
37 $::schedule="$::base_dir/schedule.bdbm" unless defined $::schedule;
38 $::infostrucs="$::base_dir/infostrucs" unless defined $::infostrucs;
39 }
40  
41 $::max_link_age=100; #days after which we delete link records
42  
43 };
44  
45 return 1; #cocaine. It's just like giving free cocaine to an addict.
46 #that's what it is.
47  
48 __END__