[ic] Redundant code in DBI.pm?

Peter peter at pajamian.dhs.org
Fri Mar 13 03:09:39 UTC 2015

IRT this block of code in the create_sql function in DBI.pm:

    for (my $i = 0;  $i < @$columns;  $i++) {
        $cols[$i] = $$columns[$i];
#::logDebug("checking column '$cols[$i]'");
                if(defined $key) {
                        $keycol = $i if $cols[$i] eq $key;
                if(defined $config->{COLUMN_DEF}->{$cols[$i]}) {
                        $cols[$i] .= " " .
                else {
                        $cols[$i] .= " $def_type";
                $$columns[$i] = $cols[$i];
                $$columns[$i] =~ s/\s+.*//;

The last two lines of the loop look to be redundant to me.
$$columns[$i] already contains the column name, and $cols[$i] contain
the column definition which is the column name, followed by a space and
other stuff, so the last two names write $cols[$i] back to $$columns[$i]
then strip the space + other stuff off the end leaving just the column
name ... which is what was in $$columns[$i] to begin with?

Can we scrap those two lines or is there something I'm missing?


More information about the interchange-users mailing list