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:
parent
068afffd33
commit
e725ce8d27
|
|
@ -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);
|
||||
|
|
|
|||
21
C4/Koha.pm
21
C4/Koha.pm
|
|
@ -13,33 +13,12 @@ $VERSION = 0.01;
|
|||
&fixEthnicity
|
||||
&borrowercategories
|
||||
ðnicitycategories
|
||||
&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]
|
||||
|
|
|
|||
Loading…
Reference in New Issue