summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-02 06:57:25 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-02 06:57:25 +0000
commite0835c2fea33e86bb1411949c8c2bac2cf8519e0 (patch)
treeb7cf439500e81ae5d86e9a1fc06404a2ef28933f
parent438d3506dbfb28429ecd9c8bcca35e6e0cb55b44 (diff)
CLI script host works enough that the sample can retrieve a customer by id.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@463 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--utils/cli/ledgersmb_cli.pl10
-rw-r--r--utils/cli/sample.lsmb7
2 files changed, 10 insertions, 7 deletions
diff --git a/utils/cli/ledgersmb_cli.pl b/utils/cli/ledgersmb_cli.pl
index d279e958..39d550e7 100644
--- a/utils/cli/ledgersmb_cli.pl
+++ b/utils/cli/ledgersmb_cli.pl
@@ -30,8 +30,8 @@ $form = new Form;
$syntax = << '_END_SYNTAX_';
KEY : /\w[a-z0-9_]*/i
- MODSTR : /\w[a-z0-9_]*/i
- FNKEY : /(?:\w|:)+/
+ MODSTR : /\w[a-z0-9_:]*/i
+ FNKEY : /(?:\w|:|\-\>)+/
OP : m([-+*/%])
NUMBER : /[+-]?\d*\.?\d+/
@@ -51,7 +51,7 @@ $syntax = << '_END_SYNTAX_';
{ main::call_and_assign($item{FNKEY}, $item{ARGSTR}, $item{KEY}) }
FUNCTIONCALL : /call/i FNKEY '(' ARGS ')'
- { main::call($item{FNKEY}, $item{ARGS})}
+ { main::call($item{FNKEY}, $item{ARGS});}
for : /for/i KEY
{ main::push_loop($item{KEY}) }
@@ -112,7 +112,7 @@ sub call {
$argstr =~ s/form/\\\%\$form/;
$argstr =~ s/user/\\\%myconfig/;
my @args = split /,\s/, $argstr;
- return $call(@args);
+ eval "$call($argstr);\n" || print STDERR $@ . "\n";
}
sub call_and_assign {
@@ -149,7 +149,7 @@ sub login {
sub load_mod {
my $mod = shift;
$mod =~ s/::/\//;
- eval { require "$mod.pm"; };
+ require "$mod.pm";;
}
my $scriptparse = new Parse::RecDescent($syntax);
diff --git a/utils/cli/sample.lsmb b/utils/cli/sample.lsmb
index 6344c89f..9e544b4e 100644
--- a/utils/cli/sample.lsmb
+++ b/utils/cli/sample.lsmb
@@ -2,5 +2,8 @@ ENV:PGUSER = postgres # how to set an environment variable
login = demo # How to set a form variable
password = demo
LOGIN # Log in
-MODULE AR # Load a module
-CALL AR::transactions(form, user) # call a function
+MODULE LedgerSMB::CT # Load a module
+id = 10139
+vc = customer
+db = customer
+CALL CT->create_links(user, form) # call a function