Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I run my script and it returns this:
:/var/www/dayworks/cgi-bin$ perl Edit1.cgi Global symbol "$dbh" requires explicit package name at Edit1.cgi line +8. Global symbol "$sth" requires explicit package name at Edit1.cgi line +10. Execution of Edit1.cgi aborted due to compilation errors.

Any ideas??? Please help me!

Many thanks,

Frustrated Dave

Replies are listed 'Best First'.
Re: Database Blues
by btrott (Parson) on Feb 11, 2000 at 06:21 UTC
    It seems that you have "use strict" enabled in your script. Good job.

    However, when you "use strict", you need to write code that behaves. Variables used in your script have to either be declared with "my" or explicitly qualified. Put

    my($dbh, $sth);
    above line 8 in your code, and see what that gives you.

    For more information, do

    perldoc strict
RE: Database Blues
by Anonymous Monk on Feb 11, 2000 at 20:09 UTC
    Hi, if you haven't installed extra packages for de database you wanna use, do so now. If you use MySQL for instance, you need DBI-bin and DBI-perl or whatever. I don't know the exact package names :) You'll probably find more info on www.tcx.se (if you use MySQL that is). Arie.
Re: Database Blues
by Anonymous Monk on Feb 11, 2000 at 22:01 UTC
    Thank you for your suggestions... declaring my variables worked great...now I'm getting this message... Usage: $class->connect([$dsn [,$user [,$passwd ,\%attr]]]) at Edit1.cgi line 8 Any ideas as to what this means? Many thanks, Frustrated Dave
      I guess this is supposed to look like this:
      Usage: $class->connect([$dsn [,$user [,$passwd [,\%attr]]]])at Edit1.c +gi line 8