summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 18:00:56 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 18:00:56 +0000
commit666fd833584fe2e3618a397fe9d9a9bdf4c5b94b (patch)
tree19c4444705fd7f7803e0d7b597659c11d7e85b73 /doc
parent2edd2e4de0f08a0a5f23647ea715f279671a0b89 (diff)
Doing a simple Perltidy commit so that I can evaluate differences between the branches and make sure patches are up to date
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1103 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'doc')
-rw-r--r--doc/samples/lsmb02-cli-example.pl89
1 files changed, 48 insertions, 41 deletions
diff --git a/doc/samples/lsmb02-cli-example.pl b/doc/samples/lsmb02-cli-example.pl
index e0084c01..2aa2657e 100644
--- a/doc/samples/lsmb02-cli-example.pl
+++ b/doc/samples/lsmb02-cli-example.pl
@@ -28,12 +28,10 @@
use File::chdir;
use HTML::Entities;
-
print "\n\nLedger-SMB login: ";
my $login = <STDIN>;
chomp($login);
-
print "\nLedger-SMB password: ";
system("stty -echo");
my $pwd = <STDIN>;
@@ -43,56 +41,68 @@ print "\n\n";
$cmd = "login=" . $login . '&password=' . $pwd . '&path=bin&action=login';
-$signin = runLScmd("./login.pl",$cmd);
+$signin = runLScmd( "./login.pl", $cmd );
if ( $signin =~ m/Error:/ ) {
- print "\nLogin error\n";
- exit;
+ print "\nLogin error\n";
+ exit;
}
-
while (<main::DATA>) {
- chomp;
- @rec = split(/\|/);
-
- $arg = 'path=bin/mozilla&login=' . $login . '&password=' . $pwd .
- '&action=' . escape(substr($rec[0],0,35)) .
- '&db=' . $rec[1] .
- '&name=' . escape(substr($rec[2],0,35)) .
- '&vendornumber=' . $rec[3] .
- '&address1=' . escape(substr($rec[4],0,35)) .
- '&address2=' . escape(substr($rec[5],0,35)) .
- '&city=' . escape(substr($rec[6],0,35)) .
- '&state=' . escape(substr($rec[7],0,35)) .
- '&zipcode=' . escape(substr($rec[8],0,35)) .
- '&country=' . escape(substr($rec[9],0,35)) .
- '&phone=' . escape(substr($rec[10],0,20)) .
- '&tax_2150=1' .
- '&taxaccounts=2150' .
- '&taxincluded=0' .
- '&terms=0';
-
- $rc=runLScmd("./ct.pl",$arg);
-
- if ($rc =~ m/Vendor saved!/) {
-
- print "$rec[2] SAVED\n";
+ chomp;
+ @rec = split(/\|/);
+
+ $arg =
+ 'path=bin/mozilla&login=' . $login
+ . '&password='
+ . $pwd
+ . '&action='
+ . escape( substr( $rec[0], 0, 35 ) ) . '&db='
+ . $rec[1]
+ . '&name='
+ . escape( substr( $rec[2], 0, 35 ) )
+ . '&vendornumber='
+ . $rec[3]
+ . '&address1='
+ . escape( substr( $rec[4], 0, 35 ) )
+ . '&address2='
+ . escape( substr( $rec[5], 0, 35 ) )
+ . '&city='
+ . escape( substr( $rec[6], 0, 35 ) )
+ . '&state='
+ . escape( substr( $rec[7], 0, 35 ) )
+ . '&zipcode='
+ . escape( substr( $rec[8], 0, 35 ) )
+ . '&country='
+ . escape( substr( $rec[9], 0, 35 ) )
+ . '&phone='
+ . escape( substr( $rec[10], 0, 20 ) )
+ . '&tax_2150=1'
+ . '&taxaccounts=2150'
+ . '&taxincluded=0'
+ . '&terms=0';
+
+ $rc = runLScmd( "./ct.pl", $arg );
+
+ if ( $rc =~ m/Vendor saved!/ ) {
+
+ print "$rec[2] SAVED\n";
- } else {
+ }
+ else {
- print "$rec[2] ERROR\n";
+ print "$rec[2] ERROR\n";
- }
+ }
}
-
$cmd = "login=" . $login . '&password=' . $pwd . '&path=bin&action=logout';
-$signin = runLScmd("./login.pl",$cmd);
+$signin = runLScmd( "./login.pl", $cmd );
if ( $signin =~ m/Error:/ ) {
@@ -102,12 +112,10 @@ if ( $signin =~ m/Error:/ ) {
exit;
-
#*******************************************************
# Subroutines
#*******************************************************
-
sub runLScmd {
my $cmd = shift;
@@ -131,15 +139,14 @@ sub escape {
if ($str) {
- decode_entities($str);
- $str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge;
+ decode_entities($str);
+ $str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge;
}
return $str;
}
-
#*******************************************************
# Record Format
#*******************************************************