On Mon, Nov 12, 2001 at 01:55:13AM -0600, Mark Browne wrote:
> I *just* got my first web page filled with data from a MySQL table.
> There was a connection through MySQL,  PERL, Apache and a browser.
> It's still amazes me how a few lines of text on the screen
> can put me in such a good mood :-)

Congratulations!

> Some random notes to other clueless newbies (like myself)
> 1) Ya gotta use CPAN to get the perl MySQL-DBI modules installed.
> Period.
> The machine I am developing on has no LAN connection so I screwed around
> downloading the tars and burning them on CD so I could move them to the
> laptop.
> I could not work out how to install them into perl; a complete waste of
> time!
> After I rigged up a dialup (another adventure) I had the DBI stuff loaded in
> minutes.

There are both RPM and .deb packages of the Mysql modules.

> 2) I had the most troubles with the connect string.

Did you look at the examples in perldoc DBD::mysql? they are
all described there:

<quote>
$dsn = "DBI:$driver:database=$database;host=$hostname;port=$port";
</quote>

All of the values have defaults, so you shouldn't have to fill out
more than just database=.

> 2a) The localhost name thing screwed me up bigtime.

Understandable. If it can't get through the socket connection
it tries on the network to localhost.

> 2b) The database user and password items are another minefield.
> They are not necessarily the same as your OS user and login name.
> MySQL has it's own user and password control.

Yeah, I use a homebrewn script to create users/databases with, so
I don't need to remember how to do it every time I need it.
You can download it from: http://stderr.net/mysql.txt

> 3) I has to comment the "use strict" out to get rid of the compile errors in
> the Apache error log.
> Still don't know why the "strict" thing is so picky.
> Do you have to declare vars in perl under "strict" rules?

use strict;
#!/usr/bin/perl -wT is your friend when writing cgi-scripts.

> 4) The Apache error log is your best friend in sorting why the stuff is not
> working.

Indeed, but it can be cryptic sometimes.

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer>