i am writing a little function (see hack below) that will allow me to sort data for my CGI's easily (especially for multiple columns) ... ala another function that works the CGI.pm aspect of things.
problem is that this function seems to (under mod_perl) duplicate the rows that i pass to it (although it sorts all of them wonderfully). if i castrate the function in order to see if the problem is elsewhere to 'sub sortcol {return shift}' it works just fine (although it doesnt sort anything) thanks for any help you guys can provide. package Hacks; use strict; use DBI; sub sortcol { my @body=@{$_[0]}; my @ords=@{$_[1]}; my $cols = @body; my $table="tmptable"; my @alpha=('a' .. 'zz'); my @col_names; my $dbh = DBI->connect('dbi:RAM:',,,{RaiseError => 0}); for my $i (0 .. $cols-1) { push(@col_names, $alpha[$i]); } $dbh->func({table_name => $table, col_names => join(',',@col_names), data_type => 'ARRAY', data_source => \@body, }, 'import' ); my $orderby; { my @tmp; for my $ord (@ords) { my $ao=abs($ord); push(@tmp, join(' ', $alpha[$ao], $ao==$ord ? "ASC" : "DESC")); } $orderby=join(', ', @tmp); } # DBD::RAM 'export array' method broken? my $sth = $dbh->prepare("SELECT * FROM $table ORDER BY $orderby"); $sth->execute(); my @body; while( my (@cells) = $sth->fetchrow_array) { push(@body, \@cells); } $sth->finish(); $dbh->disconnect(); return(\@body); } 1; --- Gabriel C. Millerd | Oh loneliness and cheeseburgers are a deadly Super Plumber | combination. -Comic Book Guy |