On Wed, 2003-11-12 at 18:30, Dan Muey wrote: > > I am using the following code and keep getting a message that > > says "Can't use an undefined value as a hash reference." I'm > > completely lost trying to debug it because the line in > > question is a }. I was wondering if any guru could spot some > > 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... -Dan sub get_mysql_SQL { my $self = shift (@_); my $line = shift (@_); my $debugger = $self->{debugger}; if ($self->{info_mode}) { $debugger->warning("We've entered get_mysql_SQL"); } if (not $line) { $debugger->fatal_error("There was no line in the [EMAIL PROTECTED] array..."); } my @temp = split ':', $line; my $action = shift (@temp); my $SQL = ""; if ($action =~ m/create/i) { my $table_name = shift (@temp); my @columns; while ($_ = shift (@temp)) { my $temp3 = { name => $_, type => shift (@temp), options => [split (';', (shift (@temp)))] }; push @columns, $temp3; $SQL .= "CREATE TABLE $table_name\n"; $SQL .= "(\n"; while (my %hash = %{ shift (@columns) }) { $SQL .= " $hash{name} "; if ($hash{type} =~ m/INT/i) { $SQL .= "INT "; } elsif ($hash{type} =~ m/VARCHAR/i) { $SQL .= "VARCHAR(80) "; } elsif ($hash{type} =~ m/DATE/i) { $SQL .= "DATE "; } elsif ($hash{type} =~ m/LOB/i) { $SQL .= "BLOB "; } elsif ($hash{type} =~ m/TEXT/i) { $SQL .= "LONGTEXT "; } elsif ($hash{type} =~ m/BOOL/i) { $SQL .= "BIT "; } else { $debugger->fatal_error("Data Type: $hash{type} unknown."); } my @options = @{ $hash{options} }; while ($_ = shift (@options)) { if ($_ =~ m/not null/i) { $SQL .= "NOT NULL "; } elsif ($_ =~ m/unique/i) { $SQL .= "UNIQUE "; } elsif ($_ =~ m/primary key/i) { $SQL .= "PRIMARY KEY"; } elsif ($_ =~ m/auto increment/i) { $SQL .= "AUTO_INCREMENT "; } else { $debugger->error("Option: $_ is not known. Assuming it's database specific and ignoring."); } } $SQL .= "\n"; } #---------right here------ } $SQL .= ");\n\n"; return $SQL; } else { $debugger->fatal_error("Action $action is unknown to get_mysql_SQL."); } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]