hi Mr.John Bokma

M

madan

hello Mr.John Bokma
thanks for ur replay..but i modified the source code as u specified but

still some error is coming...
the modified program is as below

#######################################################################



#! /usr/bin/perl


use lib '/cgi-bin/lib';
require("CGI.pm");
use strict;
use warnings;


use CGI::Carp 'fatalsToBrowser';
use CGI;
use Win32::ODBC;
my $cgi = CGI->new;
$dbh= new Win32::ODBC("dsn=madan; uid=madan; pwd=madan");
if(!$dbh)
{
&printFailure;
exit();
}
else
{
&printSucess;
}
print $cgi->header( 'text/html' );
print $cgi->start_html;
print $cgi->startform("get","/cgi-bin/data.cgi");
sub printFailure {
print "failure in connecting <br>".Win32::ODBC::Error();


}


sub printSucess {
print "Connection Sucessful<br>";

}


print $cgi->endform;
print $cgi->end_html;
########################################################################


the following error is being displayed on the screen:


#######################################################################

Software error:
Undefined subroutine &Scalar::Util::blessed called at
W:/usr/lib/overload.pm line 89.
Compilation failed in require at W:/usr/lib/Config.pm line 70.
Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.

Compilation failed in require at W:/cgi-bin/dbtest.pl line 10.
BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 10.
########################################################################
 
S

Sherm Pendley

madan said:
hello Mr.John Bokma
thanks for ur replay

It's spelled "your". This is usenet, not instant messaging.

And what reply are you speaking of? If you mean to post a reply, please don't
start a new thread to do so.
..but i modified the source code as u specified but

It's spelled "you". This is usenet, not instant messaging.
#######################################################################



#! /usr/bin/perl


use lib '/cgi-bin/lib';

This will almost certainly not do what you expect it to. Is your cgi-bin
directory *really* at the root level on your hard drive? (Note that being
at the root level of your web site - i.e. http://invalid.com/cgi-bin - is
almost certainly *not* the same thing.)
require("CGI.pm");
use strict;
use warnings;


use CGI::Carp 'fatalsToBrowser';
use CGI;

Why did you import CGI.pm twice?
use Win32::ODBC;
my $cgi = CGI->new;
$dbh= new Win32::ODBC("dsn=madan; uid=madan; pwd=madan");

my $dbh = ...
if(!$dbh)
{
&printFailure;

Don't use & to call subroutines unless you know what that does and why you
need it.

printFailure;
exit();
}
else
{
&printSucess;
printSuccess;

}

Whether $dbh is defined or not, the above if/else will print *somehing* before
your scripts gets any chance to print HTTP headers.
print $cgi->header( 'text/html' );
print $cgi->start_html;
print $cgi->startform("get","/cgi-bin/data.cgi");

Move these three lines above the $dbh, so that the headers are printed before
the output from printFailure() or printSuccess().
the following error is being displayed on the screen:


#######################################################################

Software error:
Undefined subroutine &Scalar::Util::blessed called at
W:/usr/lib/overload.pm line 89.

Are you using Perl 5.6? If so, have you installed the Scalar::Util module? It
became a core module (i.e. included with Perl) as of 5.8, so you'll need to
install it separately if you're using 5.6.

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top