I had Koha.pm using Database.pm and vice versa. Subroutines don't get exported properly when this is done. Moved configfile subroutine to Database.pm

This commit is contained in:
tonnesen 2002-07-12 23:58:35 +00:00
parent 068afffd33
commit e725ce8d27
2 changed files with 22 additions and 21 deletions

View File

@ -13,9 +13,31 @@ $VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(
&C4Connect &requireDBI
&configfile
);
sub configfile {
my $configfile;
open (KC, "/etc/koha.conf");
while (<KC>) {
chomp;
(next) if (/^\s*#/);
if (/(.*)\s*=\s*(.*)/) {
my $variable=$1;
my $value=$2;
# Clean up white space at beginning and end
$variable=~s/^\s*//g;
$variable=~s/\s*$//g;
$value=~s/^\s*//g;
$value=~s/\s*$//g;
$configfile->{$variable}=$value;
}
}
return $configfile;
}
sub C4Connect {
my $dbname="c4";
my ($database,$hostname,$user,$pass);

View File

@ -13,33 +13,12 @@ $VERSION = 0.01;
&fixEthnicity
&borrowercategories
&ethnicitycategories
&configfile
$DEBUG);
use vars qw();
my $DEBUG = 0;
sub configfile {
my $configfile;
open (KC, "/etc/koha.conf");
while (<KC>) {
chomp;
(next) if (/^\s*#/);
if (/(.*)\s*=\s*(.*)/) {
my $variable=$1;
my $value=$2;
# Clean up white space at beginning and end
$variable=~s/^\s*//g;
$variable=~s/\s*$//g;
$value=~s/^\s*//g;
$value=~s/\s*$//g;
$configfile->{$variable}=$value;
}
}
return $configfile;
}
sub slashifyDate {
# accepts a date of the form xx-xx-xx[xx] and returns it in the
# form xx/xx/xx[xx]