romy_mathew has asked for the wisdom of the Perl Monks concerning the following question:
the above code display the putput properly in terminal but in browser it just fails to print after the DBI->connect. No lines are executed after that. I checked the err log and below is the error code mentioned. anyone please suggest me a solution for the problem.1 #!/usr/bin/perl 2 use strict; 3 use Data::Dumper; 4 use CGI; 5 use DBI; 6 use Template; 7 8 $| =1; 9 #print "Content-type: text/html\n\n"; 10 print "Content-type:text/html\r\n\r\n"; 11 print "html"; 12 13 my $driver = "mysql"; 14 my $database = "RON"; 15 my $dsn = "DBI:$driver:database=$database"; 16 my $userid = "root"; 17 my $password = "test"; 18 19 20 21 22 my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::err +str; 23 my $sth=$dbh->prepare("SELECT * FROM INVOICE"); 24 $sth->execute(); 25 26 my $data = $sth->fetchall_hashref('Invoice_Number'); 27 $sth->finish(); 28 $dbh->disconnect(); 29 30 my %trend = %$data; 31 32 print Dumper(%trend); 33 34 foreach (keys %trend){ 35 36 my $invoice_nu = $trend{'Invoice_Number'}; 37 print "hello<br>\n"; 38 39 40 } 41 foreach (1..10) { 42 print "hello line $_;<br>"; 43 } 44
install_driver(mysql) failed: Can't load '/Library/Perl/5.12/darwin-th +read-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: + dlopen(/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/ +mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/ +DBD/mysql/mysql.bundle Reason: image not found at /System/Library/Perl/5.12/darwin-thread-m +ulti-2level/DynaLoader.pm line 204. at (eval 12) line 3 Compilation failed in require at (eval 12) line 3. Perhaps a required shared library or dll isn't installed where expecte +d at /Library/WebServer/CGI-Executables/hello.pl line 22
|
|---|