[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [374] trunk



Revision: 374
          http://svn.sourceforge.net/ledger-smb/?rev=374&view=rev
Author:   tetragon
Date:     2006-10-28 22:29:28 -0700 (Sat, 28 Oct 2006)

Log Message:
-----------
Switch main config file to using Config::Std

Modified Paths:
--------------
    trunk/Build.PL
    trunk/LedgerSMB/Sysconfig.pm
    trunk/ledger-smb.conf.default

Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL	2006-10-29 04:55:06 UTC (rev 373)
+++ trunk/Build.PL	2006-10-29 05:29:28 UTC (rev 374)
@@ -24,6 +24,7 @@
 		'Locale::Language'		=> 0,
 		'Time::Local'			=> 0,
 		'Cwd'				=> 0,
+		'Config::Std'			=> 0,
 		},
 	recommends => {
 		'HTML::LinkExtor'		=> 0,

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2006-10-29 04:55:06 UTC (rev 373)
+++ trunk/LedgerSMB/Sysconfig.pm	2006-10-29 05:29:28 UTC (rev 374)
@@ -4,6 +4,8 @@
 
 package LedgerSMB::Sysconfig;
 
+use Config::Std;
+
 $session='DB';
 $logging=0; # No logging on by default
 
@@ -53,11 +55,36 @@
 my $globalUserName = "ledgersmb";
 my $globalPassword = "set me to correct password";
 
-eval { require "ledger-smb.conf"; };
-if ($@){
-	print STDERR "Parsing ledger-smb.conf failed: $@";
-}
+my %config;
+read_config('ledger-smb.conf' => %config) or die;
 
+$logging = $config{''}{logging} if $config{''}{logging};
+$check_max_invoices = $config{''}{check_max_invoices} if
+	$config{''}{check_max_invoices};
+$language = $config{''}{language} if $config{''}{language};
+$session = $config{''}{session} if $config{''}{session};
+$latex = $config{''}{latex} if $config{''}{latex};
+
+$ENV{PATH} .= ":".(join ':', @{$config{environment}{PATH}}) if
+	$config{environment}{PATH};
+$ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
+	$config{environment}{PERL5LIB};
+
+%printer = %{$config{printers}} if $config{printers};
+
+$memberfile = $config{paths}{memberfile} if $config{paths}{memberfile};
+$userspath = $config{paths}{userspath} if $config{paths}{userspath};
+$localepath = $config{paths}{localepath} if $config{paths}{localepath};
+$spool = $config{paths}{spool} if $config{paths}{spool};
+$templates = $config{paths}{tempates} if $config{paths}{tempates};
+
+$sendmail = $config{programs}{sendmail} if $config{programs}{sendmail};
+$gzip = $config{programs}{gzip} if $config{programs}{gzip};
+
+$globalDBConnect = $config{globaldb}{DBConnect} if $config{globaldb}{DBConnect};
+$globalUserName = $config{globaldb}{UserName} if $config{globaldb}{UserName};
+$globalPassword = $config{globaldb}{Password} if $config{globaldb}{Password};
+
 #$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword); 
 
 # These lines prevent other apps in mod_perl from seeing the global db 

Modified: trunk/ledger-smb.conf.default
===================================================================
--- trunk/ledger-smb.conf.default	2006-10-29 04:55:06 UTC (rev 373)
+++ trunk/ledger-smb.conf.default	2006-10-29 05:29:28 UTC (rev 374)
@@ -1,55 +1,47 @@
-use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex %printer $gzip $GLOBALDBH);
+session  : DB
+logging  : 0
 
-#################################
-# Global database parameters
-#################################
-# These parameters *must* be set correctly
-# for LedgerSMB >= 1.2 to work
-my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432';
-my $globalUserName = "ledgersmb";
-my $globalPassword = "set me to correct password";
+# Set language for login and admin pages
+language : 
 
-$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword); 
+# If you have LaTeX installed, set to 1
+latex : 1
 
-# path to user configuration files
-$userspath = "users";
+# Maximum number of invoices that can be printed on a cheque
+check_max_invoices : 5
 
-# spool directory for batch printing
-$spool = "spool";
+[environment]
+# If the server can't find applications, append to the path
+PATH: /usr/local/pgsql/bin
+PATH: /usr/local/bin
 
-# templates base directory
-$templates = "templates";
+# If on Mac OS X using Fink's Perl libs, append to the path
+#PERL5LIB = /sw/lib/perl5
 
+[paths]
+# spool directory for batch printing
+spool      = spool
+# path to user configuration files
+userspath  = users
+# templates base directory
+templates  = templates
 # member file
-$memberfile = "users/members";
+memberfile = users/members
+localepath = locale/po
 
-# location of sendmail
-$sendmail = "| /usr/sbin/sendmail -t";
-
-# set language for login and admin
-$language = "";
-
-# Maximum number of invoices that can be printed on a check
-$check_max_invoices = 5;
-
-
-# if you have latex installed set to 1
-$latex = 1;
-
-# available printers
-%printer = ( Laser	=> 'lpr -Plaser',
-             Epson	=> 'lpr -PEpson',
-	     );
-
+[programs]
+sendmail   = | /usr/bin/sendmail -t
 # program to use for file compression
-$gzip = "gzip -S .gz";
+gzip       = gzip -S .gz
 
-# if the server can't find gzip, latex, dvips or pdflatex, add the path
-$ENV{PATH} .= ":/usr/local/bin:/usr/local/pgsql/bin";
+[printers]
+# Available printers
+Laser      = lpr -Plaser
+Epson      = lpr -PEpson
 
-# on mac os X using Fink's Perl libs, add the path
-#$ENV{PERL5LIB} .= ":/sw/lib/perl5";
-
-
-1;
-
+[globaldb]
+# These paramaters *must* be set correctly
+# for LedgerSMB >= 1.2 to work
+DBConnect  = dbi:Pg:dbname=ledgersmb;host=localhost;port5432
+UserName   = ledgersmb
+Password   = set me to correct password


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.