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

SF.net SVN: ledger-smb: [451] trunk/utils/cli



Revision: 451
          http://svn.sourceforge.net/ledger-smb/?rev=451&view=rev
Author:   einhverfr
Date:     2006-11-01 08:19:41 -0800 (Wed, 01 Nov 2006)

Log Message:
-----------
Some enhancements to the CLI script wrapper

Modified Paths:
--------------
    trunk/utils/cli/ledgersmb_cli.pl
    trunk/utils/cli/sample.lsmb

Modified: trunk/utils/cli/ledgersmb_cli.pl
===================================================================
--- trunk/utils/cli/ledgersmb_cli.pl	2006-11-01 05:43:27 UTC (rev 450)
+++ trunk/utils/cli/ledgersmb_cli.pl	2006-11-01 16:19:41 UTC (rev 451)
@@ -29,23 +29,31 @@
 
 while ($line = <>){
 	$line =~ s/#.*//; # strip out comments
-	if ($line =~ /^\s*CALL (.+) INTO (.+)/){
+	if ($line =~ /^\s*CALL\s+(.+)\s+INTO\s+(.+)/i){
 		$form->{$2} = &{$1}(\%$form);
-	} elsif ($line =~ /^\s*MODULE (.+)/){
+	} elsif ($line =~ /^\s*MODULE (.+)/i){
 		$module = $1;
 		$module =~ s/::/\//;
 		eval { require $module; };
-	} elsif ($line =~ /^\s*ENV:(.+)\s*=\s*(.*)/){
+	} elsif ($line =~ /^\s*ENV:(.+)\s*=\s*(.*)/i){
+		my ($key, $value) = ($1, $2);
+		$key =~ s/\s?(.*)\s?/$1/;
+		$value =~ s/\s?(.*)\s?/$1/;
 		$ENV{$1} = $2;
 	} elsif ($line =~ /^\s*(.+)\s*=\s*(.+)/){
 		$form->{$1} = $2;
-	} elsif ($line =~ /^\s*CALL (.+)/){
-		{$1}(\%$form);
+	} elsif ($line =~ /^\s*CALL\s+(.+)/i){
+		{$1};
+	} elsif ($line =~ /^\s*LOGIN\s*/i){
+		$myconfig = new LedgerSMB::User 
+			"${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
 	} elsif ($line !~ /^\s*$/) {
 		die "Parse error in script file: $line";
 	}
 }
 
+delete $form->{password};
+
 for (keys %$form){
 	print "$_ = $form->{$_}\n";
 }

Modified: trunk/utils/cli/sample.lsmb
===================================================================
--- trunk/utils/cli/sample.lsmb	2006-11-01 05:43:27 UTC (rev 450)
+++ trunk/utils/cli/sample.lsmb	2006-11-01 16:19:41 UTC (rev 451)
@@ -1,6 +1,7 @@
 # THe below line shows how to set the PGUSER environment variable
-ENV:PGUSER = postgres
-user = demo # set username
-password = demo # set password
+ENV:PGUSER=postgres
+login=demo # set username
+password=demo # set password
+LOGIN
 MODULE AR # load AR
-CALL AR::transactions
+CALL AR::transactions(\%$form);


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