I am having a HUG problem figuring out the cause of an error in a perl script. My perl code is as follows:
#!/user/bin/perl -w ###################################################################### +######### # Copyright (c) 2005 Matt Verstraete - All Rights Reserved. + # # Modification, distribution, selling of this script is prohibited. + # # Use of this script anywhere but crystalreverie.com is prohibited. + # ###################################################################### +######### use strict; use CGI q~:standard~; use DBI; my ($dbh, $sth, @resultholder, $uid, $password, $character); $uid = param('uid'); $password = param('password'); print "Content-type: text/html\n\n"; print q~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Modify Your Character's Information</title> <meta name="publisher" content="Matt Verstraete" /> <meta name="copyright" content="2005 Matthew Verstraete" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1 +" /> <style type="text/css"><!-- body {background-color: #cccccc; color: #009900} .center {text-align: center} --></style> </head> <body>~; $dbh = DBI -> connect ('dbi:ODBC:read', 'uid', 'pass') or die "Could n +ot open database: $DBI::errstr; stopped"; $sth = $dbh -> prepare (qq~select character_name, uid from characters +where character_name = 'Sirmatt'~) or die "Could not prepare statemen +t: $DBI::errstr; stopped"; $sth -> execute() or die "Could not execute SQL statment: $DBI::errstr +; stopped"; @resultholder = $sth -> fetchrow_array; $dbh -> disconnect(); print qq~\n</body> </html>~;
The error I get is:
DBI::db=HASH(0x18a0ea0)->disconnect invalidates 1 active statement han +dle (eithe r destroy statement handles or call finish on them before disconnectin +g) at D:\crystalreverie.com\www\members\modify.pl line 34.
Line 34 is the dbh -> prepare code. I have about 5 other scripts running fine and all the code related to the DB is copyed from one of the working ones with NO modification. So my question is, Why does this code work perficly fine in the other scripts but in this extreamly simple script does it fail?

In reply to Can not figure out cause of error. by Eagle_f91

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.