Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-02-2010, 07:04 PM   #1
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Question Perl and mysql - warnings???

Hello and thank you for reading my post. I've decided to learn perl and have an application that is going to require the use of mysql. Are these warnings bad??? Here's the code:
#!/usr/bin/perl -w

# Utility script to sequentially number vim backup files.
# Script is called via a bash daemon using inotifywait to
# detect the presence of some_file_name~ in vim's backup
# directory.
# Requires: Run as user.

use lib '/usr/lib/perl5/DBD';
require "";

# Variables
$server = "localhost";
$host = "localhost";
$database = "vimbup";
$table_name = "vbackup";
$user = "**********";
$pass = "**********";

# C O N N E C T   T O   T H E   D A T A B A S E
my $dbh   = DBI->connect ("DBI:mysql:database=$database:host=$host", $user, $pass,
                                        PrintError => 1,   ### Don't report errors via warn(  )
                                        RaiseError => 1    ### Do report errors via die(  )
                          } ) or die "Can't connect to database: $DBI::errstr\n";

#@files = </home/barrie/.vim/backup/*~>;
#foreach $file (@files) {
#    print $file . "\n";
And the warnings:
$ > ./
Name "DBI::errstr" used only once: possible typo at ./ line 32.
Name "main::server" used only once: possible typo at ./ line 18.
Name "main::table_name" used only once: possible typo at ./ line 21.
Subroutine driver redefined at /usr/lib/perl5/DBD/ line 21.
Subroutine CLONE redefined at /usr/lib/perl5/DBD/ line 38.
Subroutine _OdbcParse redefined at /usr/lib/perl5/DBD/ line 42.
Subroutine _OdbcParseHost redefined at /usr/lib/perl5/DBD/ line 77.
Subroutine AUTOLOAD redefined at /usr/lib/perl5/DBD/ line 84.
Subroutine connect redefined at /usr/lib/perl5/DBD/ line 103.
Subroutine data_sources redefined at /usr/lib/perl5/DBD/ line 151.
Subroutine admin redefined at /usr/lib/perl5/DBD/ line 169.
Subroutine prepare redefined at /usr/lib/perl5/DBD/ line 217.
Subroutine db2ANSI redefined at /usr/lib/perl5/DBD/ line 231.
Subroutine ANSI2db redefined at /usr/lib/perl5/DBD/ line 237.
Subroutine admin redefined at /usr/lib/perl5/DBD/ line 243.
Subroutine _SelectDB redefined at /usr/lib/perl5/DBD/ line 252.
Subroutine table_info redefined at /usr/lib/perl5/DBD/ line 256.
Subroutine _ListTables redefined at /usr/lib/perl5/DBD/ line 386.
Subroutine column_info redefined at /usr/lib/perl5/DBD/ line 395.
Subroutine primary_key_info redefined at /usr/lib/perl5/DBD/ line 586.
Subroutine foreign_key_info redefined at /usr/lib/perl5/DBD/ line 633.
Subroutine _version redefined at /usr/lib/perl5/DBD/ line 714.
Subroutine get_info redefined at /usr/lib/perl5/DBD/ line 727.
Thank you and appreciate any input!
Old 12-02-2010, 11:44 PM   #2
LQ Newbie
Registered: Oct 2010
Location: Medina, OH
Distribution: Ubuntu Lucid 10.04
Posts: 1

Rep: Reputation: 1
You are loading the mysql module twice.

After the #! line use:

use strict;
use DBI;
No need for:

use lib '/usr/lib/perl5/DBD';
require "";
your DBI->connect ("DBI:mysql:database=$database:host=$host", $user, $pass,

uses and calls the proper DBD::mysql module.
1 members found this post helpful.
Old 12-03-2010, 01:43 AM   #3
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Original Poster
Rep: Reputation: 23
Thank you jodyman, that solved it!


mysql, perl

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugzilla - MySQL - perl - DBD::mysql install problem amchargue Linux - Software 3 09-10-2008 12:01 AM
[SOLVED] [php and mysql]mysql warnings Wim Sturkenboom Programming 5 04-16-2008 07:27 AM
Bugzilla - MySQL - perl - DBD::mysql install problem Runningonair Linux - Software 8 10-12-2007 12:42 AM
warnings on perl doronunu Programming 8 05-02-2006 07:09 AM
Error compiling perl-DBD-MySQL after upgrading to MySQL 4.1 pitaro920 Linux - Software 1 01-16-2006 04:28 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration