From: Mr B. <gn...@ya...> - 2008-10-08 19:32:36
|
Hi, I've just hit the same problem. Is this a Perl problem or SL problem? Mark how did you downgrade Perl? Is it possible to have 2 perls? I cant print anything so will be grateful for any pointers to fix this thanks g. ----- Original Message ---- From: mark <ma...@in...> To: sql...@li... Sent: Friday, 19 September, 2008 4:16:28 Subject: [SL] Warning - perl.i386 4:5.8.8-15.el5_2.1 for Centos 5 appears to have a bug perl.i386 4:5.8.8-15.el5_2.1 This package seems to cause errors in sql-ledger. Error! Not a HASH reference at SL/OE.pm line 1295. Attempt to free unreferenced scalar: SV 0x8daf9a0, Perl interpreter: 0x85cd008 at SL/OE.pm line 1295. To debug this we changed the following, printed the invoice/quote etc. Then downgraded the perl version to perl.i386 4:5.8.8-10.el5_2.3 diff -u b_OE.pm OE.pm --- b_OE.pm 2008-09-19 14:07:29.000000000 +1200 +++ OE.pm 2008-09-19 14:53:39.000000000 +1200 @@ -928,6 +928,12 @@ sub order_details { my ($self, $myconfig, $form) = @_; + use Data::Dumper; + open(DGB, ">> /tmp/sldbg.log") || die('perl sucks'); + printf(DGB "***** FORM (LINE=%d):",__LINE__); + print DGB Dumper($form); + print DGB "\n\n"; + # connect to database my $dbh = $form->dbconnect($myconfig); my $query; @@ -1096,6 +1102,9 @@ push(@{ $form->{description} }, $item->[2]); for (qw(taxrates runningnumber number sku qty ship unit bin serialnumber requiredate projectnumber sellprice listprice netprice discount discountrate linetotal weight itemnotes)) { push(@{ $form->{$_} }, "") } push(@{ $form->{lineitems} }, { amount => 0, tax => 0 }); + printf(DGB "***** FORM (LINE=%d): ",__LINE__); + print DGB Dumper($form); + print DGB "\n\n"; } } } @@ -1208,6 +1217,9 @@ } push(@{ $form->{lineitems} }, { amount => $linetotal, tax => $form->round_amount($tax, 2) }); + printf(DGB "***** FORM (LINE=%d): ",__LINE__); + print DGB Dumper($form); + print DGB "\n\n"; push(@{ $form->{taxrates} }, join ' ', sort { $a <=> $b } @taxrates); if ($form->{"assembly_$i"}) { @@ -1237,6 +1249,9 @@ push(@{ $form->{description} }, $form->{groupsubtotaldescription}); push(@{ $form->{lineitems} }, { amount => 0, tax => 0 }); + printf(DGB "***** FORM (LINE=%d): ",__LINE__); + print DGB Dumper($form); + print DGB "\n\n"; if ($form->{groupsubtotaldescription} ne "") { push(@{ $form->{linetotal} }, $form->format_amount($myconfig, $subtotal, 2)); @@ -1264,6 +1279,9 @@ push(@{ $form->{description} }, $form->{groupsubtotaldescription}); push(@{ $form->{linetotal} }, $form->format_amount($myconfig, $subtotal, 2)); push(@{ $form->{lineitems} }, { amount => 0, tax => 0 }); + printf(DGB "***** FORM (LINE=%d): ",__LINE__); + print DGB Dumper($form); + print DGB "\n\n"; } } } @@ -1291,6 +1309,17 @@ # adjust taxes for lineitems my $total = 0; + + print DGB @{ $form->{lineitems} }; + print DGB "\n"; + for (@{ $form->{lineitems} }) { + print DGB Dumper($_); + #if (ref($_) eq 'SCALAR') { + # print DGB "ref: ".ref($_).": $_\n"; + #} + } + print DGB "\n\n"; + for (@{ $form->{lineitems} }) { $total += $_->{tax}; } Output: BAD: ***** FORM (LINE=1220): $VAR1 = bless( { <snip> 'runningnumber_1' => '1', 'lineitems' => [ { 'amount' => '2396.06', 'tax' => '299.51' } ], <snip> ***** FORM (LINE=1220): $VAR1 = bless( { <snip> 'runningnumber_1' => '1', 'lineitems' => [ \$VAR1->{'runningnumber'}[1], { 'amount' => '9040.85', 'tax' => '1130.11' } ], <snip> 20/09/08 3:06 PM CORRECT: ***** FORM (LINE=1220): $VAR1 = bless( { <snip> 'runningnumber_1' => '1', 'lineitems' => [ { 'amount' => '2396.06', 'tax' => '299.51' } ], <snip> ***** FORM (LINE=1220): $VAR1 = bless( { <snip> 'runningnumber_1' => '1', 'lineitems' => [ { 'amount' => '2396.06', 'tax' => '299.51' }, { 'amount' => '9040.85', 'tax' => '1130.11' } ], <snip> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ sql-ledger-users mailing list sql...@li... https://lists.sourceforge.net/lists/listinfo/sql-ledger-users |