On Jun 11, 2011, at 2:21 AM, Shlomi Fish wrote:

> Very well, I'll comment on your code.

        Thanks, Shlomi.  Much appreciated.

>>    my $username = 'root';
>>    my $password = 'root';
>>    my $host     = "127.0.0.1:8889";
>>    my $db       = "test_dbb";
> I hope you are not connecting to the database as user root with password root.

        This is just a MAMP install for testing.


>>    if ($dbh_db) { say "Database '$db' was created successfully." }
> That's the wrong way to test for errors.

        What do you recommend instead?


>>      my $table = fileparse($file_path, qr/\.[^.]*/);
> What are you trying to do here?

        I'm using File::Basename to grab the file name from the path to use as 
the table name.


>>      while (my $line = <$file_fh>) {
>>          last if $line =~ m/#/;  # can place comments below the ### line
> 1. Is this a comment anywhere or only at the beginning of the string?

        I was placing a line of #### at the end of the file to allow me to add 
comments after it.  However, I realized that someone might include a # in a 
field name, so I changed that line to be  ### COMMENTS ###  instead, and now 
I'm testing for it like so:

last LINES if $line =~ m/### COMMENTS ###/;


>>          if ($keytype) {
>>              $qry_table .= "`$key` $keytype, ";
>>          }
>>          else {
>>              $qry_table .= "`$key` TEXT, ";
>>          }
> 
> 1. This way you'll have a trailing L.


        What do you mean by "trailing L"?


Thanks again,
Marc



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to