RE: ques on error msg

2000-05-30 Thread Geoffrey Young



 -Original Message-
 From: amy [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 26, 2000 3:27 PM
 To: Geoffrey Young
 Subject: Re: ques on error msg
 
 
 Geoffrey Young wrote:
 
   -Original Message-
   From: amy [mailto:[EMAIL PROTECTED]]
   Sent: Friday, May 26, 2000 1:51 PM
   To: [EMAIL PROTECTED]
   Subject: ques on error msg
  
  
  
   every now and then I got some error messages in
   the file /logs/error_log, but everything works fine.
  
   ##  first error
   Use of uninitialized value at
   /usr/local/bin/apache/cgi-bin/lib.pl line
   749.
   ##
   721  $name = '';
 
  are you running under Apache::Registry?  If so, you should always
  use strict;
 
  and declare all variables with my (as you did below)
 
 
 the startup.perl file already has 'use strict'

but this will affect only your startup script - each script should 'use
strict'...

 #!/usr/local/bin/perl
 use strict;
 use Apache::Registry;
 use CGI;
 use DBI();
 1;
 
 I tried using 'my $name='';' on line 721
 same error msg complaining about line 749
 
 
  you can also set
  PerlWarn On
 
  in httpd.conf to help troubleshoot errors like this
 
   722  my $fieldname = $cursor-{NAME-[$i];
   723  $name = lc($fieldname);
   :
   749  if ( $name eq 'eventnum' || $name eq 'debugnum' ) {
   --  is it true line 721 already initilialized it ?
  
   ##  second error
   DBI::db=HASH(0x1ff304)-disconnect invalidates 1 active
   statement handle (either destroy statement handles or call
   finish on them before disconnecting) at
   /usr/local/bin/apache/cgi-bin/lib.pl line 41.
   ##
 
  the error typically means that you are calling disconnect 
 (or the script is
  ending) before calling $sth-finish.
 
 
 yes, found out where it is, fixed, and problem gone.
 Thank You.

sure...

--Geoff

 
 
 
  HTH
 
  --Geoff
 



RE: ques on error msg

2000-05-26 Thread Geoffrey Young



 -Original Message-
 From: amy [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 26, 2000 1:51 PM
 To: [EMAIL PROTECTED]
 Subject: ques on error msg
 
 
 
 every now and then I got some error messages in
 the file /logs/error_log, but everything works fine.
 
 ##  first error
 Use of uninitialized value at 
 /usr/local/bin/apache/cgi-bin/lib.pl line
 749.
 ##
 721  $name = '';

are you running under Apache::Registry?  If so, you should always
use strict;

and declare all variables with my (as you did below)

you can also set
PerlWarn On  

in httpd.conf to help troubleshoot errors like this 

 722  my $fieldname = $cursor-{NAME-[$i];
 723  $name = lc($fieldname);
 :
 749  if ( $name eq 'eventnum' || $name eq 'debugnum' ) {
 --  is it true line 721 already initilialized it ?
 
 ##  second error
 DBI::db=HASH(0x1ff304)-disconnect invalidates 1 active
 statement handle (either destroy statement handles or call
 finish on them before disconnecting) at
 /usr/local/bin/apache/cgi-bin/lib.pl line 41.
 ##

the error typically means that you are calling disconnect (or the script is
ending) before calling $sth-finish.

HTH

--Geoff



 
 any comment
 Thank You.
 



Re: ques on error msg

2000-05-26 Thread Perrin Harkins

On Fri, 26 May 2000, amy wrote:
 ##  second error
 DBI::db=HASH(0x1ff304)-disconnect invalidates 1 active
 statement handle (either destroy statement handles or call
 finish on them before disconnecting) at
 /usr/local/bin/apache/cgi-bin/lib.pl line 41.
 ##

I avoid this type of error by pushing a cleanup handler to take care of
it, like this: 

sub finisher {
while ((my $key, my $sth) =
   each %{$dbh-{'CachedKids'}}) {
$sth-finish();
}
}

I call finish on my statements explicitly when I can, but if something
exits in an irregular way (i.e. before I was able to call finsih) this
handler will take care of it.

Maybe this should be folded into Apache::DBI, like the automatic rollback?

- Perrin