Dan Anderson wrote:

> > There are many references , what line number does it say
> > is evil and which line below is that?
>
> Thanks for your help, I have put a -----right here ----- in the code...
>
>             }
>             $SQL .= "\n";
>           }
> #---------right here------
>         }
>         $SQL .= ");\n\n";
>         return $SQL;

Given that your error message indicates a problem with a hash ref, and that
the compiler stopped at the end of a loop, I'd say the problem has something
to do with mismatched braces.  Unfortunately, your code is way too thick to
be worth crawling through without context.

Lets look at some of the factors that make this difficult to debug:

This:

            my @options = @{ $hash{options} };
            while ($_ = shift (@options)) {
              if ($_ =~ m/not null/i) {
                $SQL .= "NOT NULL ";
              }
            ...
              else {
                $debugger->error("Option: $_ is not known.
 Assuming it's database specific and ignoring.");
              }
            }
            $SQL .= "\n";
          }

should be afunction of its own, with clearly named parameters.  So should
this:

          $SQL .= "CREATE TABLE $table_name\n";
          $SQL .= "(\n";
          while (my %hash = %{ shift (@columns) }) {
            $SQL .= "  $hash{name} ";
            if ($hash{type} =~ m/INT/i) {
          }
#---------right here------
        }
        $SQL .= ");\n\n";
        return $SQL;

the enclosing block, although I can't say for sure that I picked the right
ending brace for the start.  That uncertainty is the whole point.  There are
many challenges in programming that are more worthy of your efforts than
tracking braces.  One of them is organizing functionality.

        while ($_ = shift (@temp)) {
          my $temp3 = {
                      name => $_,

So you are naming some that is temporary, huh?  Gee, uh, well, that's nice
to know.  It would be even nicer to know what this temporary thing
represents.  Choose your variable names with more care.

Programming should be about something.  The identifiers you use should tell
you what the code is about.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to