!!PERL!! "Can't locate object method 'connect' via package DBI ....(perhaps you forgot to load "DBI" ?)"
-
Hi, everybody. I am beginner in Perl programming and I have the next problem when I try to run my script from shell(in Windows it is cmd.exe). The problem was described in theme. My whole code: I'll be very thankful for help. #--My code begins here--------------- #!c:\perl\bin\perl.exe -w use DBI; my $dbh = DBI->connect('DBI:mysql:perl:localhost','root','join'); #An error is in the string above $sth = $dbh->prepare("select * from ever"); $sth->execute; print "Content-type: text/html\n\n"; &GetFormInput; #-----------------------Remaining part of code is correct and right----- sub GetFormInput { (*fval) = @_ if @_ ; local ($buf); if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN,$buf,$ENV{'CONTENT_LENGTH'}); } else { $buf=$ENV{'QUERY_STRING'}; } if ($buf eq "") {return 0;} else { @fval=split(/&/,$buf); foreach $i (0 .. $#fval){ ($name,$val)=split (/=/,$fval[$i],2); $val=~tr/+/ /; $val=~ s/%(..)/pack("c",hex($1))/ge; $name=~tr/+/ /; $name=~ s/%(..)/pack("c",hex($1))/ge; if (!defined($field{$name})) { $field{$name}=$val; } else { $field{$name} .= ",$val"; #if you want multi-selects to goto into an array change to: #$field{$name} .= "$val"; } } } return 1; } -------------------------------------------------------------------- My folder DBI contains the next modules *.pm: DBI DBM DBD ANSI APACHE FAQ FILE GETINFORETURN GETINFOTYPE METADATA MYSQL NANO ODBC PROFILE PROFILEDATA PROFILEDUMPER PROXY PROXYSERVER SPONGE It's clear that's dark.