in reply to Review and Suggestions - My First Module

Seems like you are hard-coding the user-name and password.why not make that one too as a argument?

The world is so big for any individual to conquer

  • Comment on Re: Review and Suggestions - My First Module

Replies are listed 'Best First'.
Re^2: Review and Suggestions - My First Module
by bradcathey (Prior) on Dec 10, 2007 at 13:50 UTC

    That was something I noticed as well. I usually store my username and password in a .conf file in a another directory and then grab it with some form of Config::Simple. Here's an example I use with CGI::Application::Plugin::Config::Simple (thanks to gmax):

    sub dbconnect { my $self = shift; my %attr = @_; my $user = $self->config_param($attr{'db'}.'.user'); my $pass = $self->config_param($attr{'db'}.'.pass'); my $dbh = DBI->connect_cached('DBI:mysql:'.$dbn.':'.$host, $user, $pass, {RaiseError => 1} ) or die "Can't connect: $DBI::errst +r\n"; return ($dbh); }

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re^2: Review and Suggestions - My First Module
by awohld (Hermit) on Dec 10, 2007 at 14:53 UTC
    I don't want to have to remember my username and password.