From e0835c2fea33e86bb1411949c8c2bac2cf8519e0 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 2 Nov 2006 06:57:25 +0000 Subject: 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 --- utils/cli/ledgersmb_cli.pl | 10 +++++----- utils/cli/sample.lsmb | 7 +++++-- 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 -- cgit v1.2.3