| Remember, I have the entire ports tree
installed. So adding these ports were. See also, Installing a port without installing the ports. First,
I just tried to connect to mysql, thinking that perhaps the required software was
already installed. I mean, why bother installing without first checking.
Nope. It was not installed. Here's the error message:
$ perl connect.pl
Can't locate DBI.pm in @INC
(@INC contains: /usr/libdata/perl/5.00503/mach
/usr/libdata/perl/5.00503
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd
/usr/local/lib/perl5/site_perl/5.005 .)
at connect.pl line 3.
BEGIN failed--compilation aborted at connect.pl line 3.
I didn't know what ports I needed in order to get at mysql from within perl.
While I was at one of my resource sites, I found a reference to the DBI (which I
think means DataBase-independent Interface; comments are welcome.)
So I found and installed that port:
cd /usr/ports/databases/p5-DBI
make install
Then I tried again. No luck:
$ perl connect.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC
(@INC contains: /usr/libdata/perl/5.00503/mach
/usr/libdata/perl/5.00503
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd
/usr/local/lib/perl5/site_perl/5.005 .)
at (eval 1) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: ADO, ExampleP, Proxy.
at connect.pl line 5
So then I looked for a perl-mysql port. I found one and installed it:
cd /usr/ports/databases/p5-Mysql
make install
And I tried again:
$ perl connect.pl
wocker
march
daniel
dan
dan1
Which means it worked. See the next section for the sample code: |