in reply to For Review: DB Import

Some very, very minor points.

You might put the definition of  $username, $password, $dsn at the very top of the script. This will make it easier to make simple modifications quickly. Something like:

use strict; use DBI; use Getopt::Std; my $dsn = "DBI:mysql:$database:localhost"; my $username = 'username'; my $passwd = unpack("u", $enc_passwd); ######### No User servicable parts below ############
Also, I'm not sure what the gain is with the obscured password. It isn't too hard to say:
print unpack("u", $enc_passwd);


email: mandog

Replies are listed 'Best First'.
Re: Re: For Review: DB Import
by impossiblerobot (Deacon) on Jan 25, 2002 at 22:02 UTC
    Thanks, mandog. I originally put my config variables at the top of my script. I added my usage statement at the top to give a POD-like overview to anyone reading the code (which of course begs the question of why I didn't use POD itself). I agree that this tends to bury the config vars pretty deep, and I like the suggestion someone else made about using constants to correct it.

    The obscured password is my equivalent of the asterisks that appear when you are typing in a password field. (Sure, someone can pay close attention to what I'm typing, but it prevents people subconsciously picking it up while standing over my shoulder.) No one who should not have access to the password should have access to the script itself.

    Impossible Robot