Posted on 2009-07-06 23:29:33-07 by stephenmcgowan
perl.pm - DBD::mysql issue?
Greetings,

I started up a script in the knowledge that the DBD::mysql was installed correctly.
I've been trying to call mysql.pm which i believe to be associated with this install. But i'm receiving the error:

Can't locate mysql.pm in @INC (@INC contains: /Library/Perl/Updates/5.8.8/darwin-thread-multi-2leve +l /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Librar +y/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Net +work/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Pe +rl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 +/Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at stub_uniprot_interpro.pl line 9.


I have tried searching for the mysql.pm.. only to receive:

bash-3.2# locate mysql.pm /Users/stevey_mac2k2/.cpan/build/DBD-mysql-4.012/lib/Bundle/DBD/mysql.pm /Users/stevey_mac2k2/.cpan/build/DBD-mysql-4.012/lib/DBD/mysql.pm


I have tried to reinstall DBI::mysql:

cpan[1]> install DBD::mysql CPAN: Storable loaded ok (v2.15) Going to read '/Users/stevey_mac2k2/.cpan/Metadata' Database was generated on Sun, 05 Jul 2009 21:26:57 GMT DBD::mysql is up to date (4.012).
Any advice on this matter would be much appreciated.

Many thanks. Stephen.
Direct Responses: 11134 | Write a response
Posted on 2009-07-07 01:25:33-07 by tonyc in response to 11133
Re: perl.pm - DBD::mysql issue?

You typically use DBD::mysql through DBI, eg.

use DBI; my $dbh = DBI->connect('dbi:mysql:mydatabase', $user, $password) or die $DBI::errstr; # do stuff with the database...

If you want to use the module directly, use the full name:

use DBD::mysql;

Though I can't think why you'd want to. See perldoc DBD::mysql for typical usage.

Direct Responses: 11137 | Write a response
Posted on 2009-07-07 10:52:40-07 by stephenmcgowan in response to 11134
Re: perl.pm - DBD::mysql issue?

Here is the Perl Script which is causing the error:

#!/usr/bin/perl # Stephen McGowan use strict; use warnings; use Bio::SeqIO; use Data::Dumper; use DBI; use mysql; # The point of this script is to grab some useful identifiers from a SwissProt .dat file, and pass # them to a MySQL database with the BioSQL schema. # These identifiers are UniProt name, Uniprot accession number, InterPro accession number, InterPro + domain type. # The standard script load_seqdatabase.pl does not fetch the InterPro domain name. # connect to file and create object my $file = 'load_seqdb_test_dat.txt'; my $DEBUG = 0; my $inseq = Bio::SeqIO->new(-file => "<$file", -format => "swiss"); my @parsed_entries = (); # storage for fields of interest # connect to mysql db, localhost my $dbh = DBI->connect( "dbi:mysql:biosql:localhost:3306", 'root', 'root') or die "Could not connec +t.";

I'm not sure why it is generating the error message:

Can't locate mysql.pm in @INC (@INC contains: /Library/Perl/Updates/5.8.8/darwin-thread-multi-2leve +l /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Librar +y/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Net +work/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Pe +rl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 +/Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at stub_uniprot_interpro.pl line 11. BEGIN failed--compilation aborted at stub_uniprot_interpro.pl line 11.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.