installation problem
am 05.08.2002 13:44:58 von Nate
--0-91612391-1028547898=:32517
Content-Type: text/plain; charset=us-ascii
I recently used the ppm feature on my activeperl (Win32) to install both the DBI package and the DBD-mysql modules. looking through the documentation this seems to be all i need to do to access MySQL through perl. However When i try to run my script i get an error that says the following:
Global symbol "$dbh" requires explicit package name at dbi.pl
the entire script reads as follows:
#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh = DBI->connect("DBI:mysql:database=mvc2;host=localhost", "", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20)");
What is the problem? How do i resolve it?
Thank you for your time,
Akujin
---------------------------------
Do You Yahoo!?
Yahoo! Health - Feel better, live better
--0-91612391-1028547898=:32517--
Re: installation problem
am 05.08.2002 14:08:57 von dwalu
On Mon, 5 Aug 2002, Nate wrote:
=>I recently used the ppm feature on my activeperl (Win32) to install both
the DBI package and the DBD-mysql modules. looking through the
documentation this seems to be all i need to do to access MySQL through
perl. However When i try to run my script i get an error that says the
following:
=>
=>Global symbol "$dbh" requires explicit package name at dbi.pl
=>
=>the entire script reads as follows:
=>
=>#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh =
DBI->connect("DBI:mysql:database=mvc2;host=localhost",
"", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name
VARCHAR(20)");
=>
=>What is the problem? How do i resolve it?
=>
Nate,
Try 'my $dbh' after 'use DBI;' -- The 'use strict' pragma requires lexical
scoping of all variables.
- Dwalu
..peace
--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
- Student Creed
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1879@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
Re: installation problem
am 05.08.2002 14:08:57 von dwalu
On Mon, 5 Aug 2002, Nate wrote:
=>I recently used the ppm feature on my activeperl (Win32) to install both
the DBI package and the DBD-mysql modules. looking through the
documentation this seems to be all i need to do to access MySQL through
perl. However When i try to run my script i get an error that says the
following:
=>
=>Global symbol "$dbh" requires explicit package name at dbi.pl
=>
=>the entire script reads as follows:
=>
=>#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh =
DBI->connect("DBI:mysql:database=mvc2;host=localhost",
"", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name
VARCHAR(20)");
=>
=>What is the problem? How do i resolve it?
=>
Nate,
Try 'my $dbh' after 'use DBI;' -- The 'use strict' pragma requires lexical
scoping of all variables.
- Dwalu
..peace
--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
- Student Creed
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1879@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
Re: installation problem
am 06.08.2002 06:15:42 von Clinton Hogge
Hello,
>I recently used the ppm feature on my activeperl (Win32) to install both
>the DBI package and the DBD-mysql modules. looking through the
>documentation this seems to be all i need to do to access MySQL through
>perl. However When i try to run my script i get an error that says the
>following:
>
>Global symbol "$dbh" requires explicit package name at dbi.pl
>
>the entire script reads as follows:
>
>#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh =
>DBI->connect("DBI:mysql:database=mvc2;host=localhost",
>"", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name
>VARCHAR(20)");
>
>What is the problem? How do i resolve it?
Whenever you say "use strict;" in perl (which is always a good idea), you
need to declare all of your variables. In this case, change the "$dbh =
DBI..." line to "my $dbh = DBI...".
Hope that helps,
Regards,
Clinton Hogge
Industrial Images
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1880@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
Re: installation problem
am 06.08.2002 06:15:42 von Clinton Hogge
Hello,
>I recently used the ppm feature on my activeperl (Win32) to install both
>the DBI package and the DBD-mysql modules. looking through the
>documentation this seems to be all i need to do to access MySQL through
>perl. However When i try to run my script i get an error that says the
>following:
>
>Global symbol "$dbh" requires explicit package name at dbi.pl
>
>the entire script reads as follows:
>
>#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh =
>DBI->connect("DBI:mysql:database=mvc2;host=localhost",
>"", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name
>VARCHAR(20)");
>
>What is the problem? How do i resolve it?
Whenever you say "use strict;" in perl (which is always a good idea), you
need to declare all of your variables. In this case, change the "$dbh =
DBI..." line to "my $dbh = DBI...".
Hope that helps,
Regards,
Clinton Hogge
Industrial Images
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1880@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.