hi Mr.John Bokma

Discussion in 'Perl Misc' started by madan, Jun 8, 2006.

  1. madan

    madan Guest

    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.
    ########################################################################
     
    madan, Jun 8, 2006
    #1
    1. Advertising

  2. "madan" <> writes:

    > 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--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Jun 12, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RN
    Replies:
    3
    Views:
    513
    Matt Berther
    Feb 27, 2005
  2. Replies:
    0
    Views:
    366
  3. William Baker
    Replies:
    6
    Views:
    104
    Anno Siegel
    May 23, 2005
  4. William Baker
    Replies:
    2
    Views:
    376
    Sturkie
    May 23, 2005
  5. John Bokma

    , Aug 16, 2006, in forum: Perl Misc
    Replies:
    14
    Views:
    166
    John Bokma
    Aug 18, 2006
Loading...

Share This Page