Hello,
I'm experiencing some odd behavior with DBI 1.20 that I'm hoping someone can explain to me. When I use DBI->trace() to see what data is returned for a particular select statement, I see the value I want is formatted as I expect: as a number formatted with commas where I want. However, if I immediately dump the resulting the data structure with Data::Dumper, the comma is missing. What's especially odd is that I use similiar constructs elsewhere in the application the comma "sticks" as I expect, and I can't reproduce this with a "simple test case". The code and the output are below. Any ideas on how this is possible? -mark http://mark.stosberg.com/ ###### CODE: # I'm expecting the subtotal to come back with a comma in the formatting. # The log file below shows that the value for "subtotal" starts with a comma # but is missing in the immediate data dump. my $po_lines = $DBH->selectall_arrayref("SELECT *, to_char(unit_price, 'FM999,999,999.99') as unit_price, to_char(subtotal::numeric, 'FM999,999,999.99') as subtotal FROM purchase_order_lines WHERE purchase_order_num = upper(?) AND customer_id = ?",{Slice=>{}},$FORM{po_num},$session{customer_id}); use Data::Dumper; warn Dumper ($po_lines); ################ # Log file contents: .... dbd_st_fetch 3 <- fetch= [ '002460' '05528' '001' '095897' '6BAR6001' '6BAR-R-B-BLK/LINER-SGLD ' '60' '618' '37080' '2002-01-30' undef '60' '618' '37,080' ] row1 at DBI.pm line 1181 dbd_st_FETCH 3 <- FETCH= [ 'purchase_order_num' 'customer_id' 'line_num' 'order_id' 'part_num' 'part_desc' 'qt_ordered' 'unit_price' 'subtotal' 'will_ship_date' 'actual_ship_date' 'qt_to_ship' 'unit_price' 'subtotal' ] at DBI.pm line 1181 2 <- fetchrow_hashref= HASH(0x83711d4)12keys row1 at DBI.pm line 1181 dbd_st_fetch 3 <- fetch= undef row1 at DBI.pm line 1181 2 <- fetchrow_hashref= undef row1 at DBI.pm line 1181 <- fetchall_arrayref= [ HASH(0x83711d4) ] row1 at DBI.pm line 994 <- selectall_arrayref= [ HASH(0x83711d4) ] at po-detail.cgi line 82 dbd_st_destroy <- DESTROY= undef at po-detail.cgi line 90 [Thu Mar 21 13:24:19 2002] po-detail.cgi: $VAR1 = [ [Thu Mar 21 13:24:19 2002] po-detail.cgi: { [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'unit_price' => 618, [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'purchase_order_num' => '002460', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'part_desc' => '6BAR-R-B-BLK/LINER-SGLD ', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'part_num' => '6BAR6001', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'line_num' => '001', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'will_ship_date' => '2002-01-30', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'order_id' => '095897', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'qt_ordered' => 60, [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'qt_to_ship' => 60, [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'actual_ship_date' => undef, [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'customer_id' => '05528', [Thu Mar 21 13:24:19 2002] po-detail.cgi: 'subtotal' => 37080 [Thu Mar 21 13:24:19 2002] po-detail.cgi: } [Thu Mar 21 13:24:19 2002] po-detail.cgi: ]; ############################
