From 378fc51951d5e6d517717186973a892f065ca52b Mon Sep 17 00:00:00 2001 From: einhverfr Date: Wed, 1 Nov 2006 16:19:41 +0000 Subject: Some enhancements to the CLI script wrapper git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@451 4979c152-3d1c-0410-bac9-87ea11338e46 --- utils/cli/ledgersmb_cli.pl | 18 +++++++++++++----- utils/cli/sample.lsmb | 9 +++++---- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'utils') diff --git a/utils/cli/ledgersmb_cli.pl b/utils/cli/ledgersmb_cli.pl index b689b68d..82a9785b 100644 --- a/utils/cli/ledgersmb_cli.pl +++ b/utils/cli/ledgersmb_cli.pl @@ -29,23 +29,31 @@ $form = new Form; 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"; } diff --git a/utils/cli/sample.lsmb b/utils/cli/sample.lsmb index 05650f97..62b67fb0 100644 --- a/utils/cli/sample.lsmb +++ b/utils/cli/sample.lsmb @@ -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); -- cgit v1.2.3