18 Use of uninitialized value at /opt/perl-5.005/lib/site_perl/5.005/sun4-solaris/Sybase/DBlib.pm l

R

ramanmu

I get the 'undefined' error, as noted in the Subject line, whenever I
initialize the $Sybase::DBlib::nsql_deadlock_retrycount var.

Line 450 of /opt/perl.../DBlib.pm looks like this:
406 sub nsql {
407
408 my ($db,$sql,$type,$callback) = @_;
409 my (@res,@data,%data);
410 my $retrycount = $nsql_deadlock_retrycount;
411 my $retrysleep = $nsql_deadlock_retrysleep || 60;
412 my $retryverbose = $nsql_deadlock_verbose;
413
414 if ( ref $type ) {
415 $type = ref $type;
416 }
417 elsif ( not defined $type ) {
418 $type = "";
419 }
420
421 undef $DB_ERROR;
422
423 DEADLOCK:
424 {
425
426 return unless $db->dbcmd($sql);
427
428 unless ( $db->dbsqlexec ) {
429
430 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
431 if ( $retrycount < 0 || $retrycount-- ) {
432 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
433 undef $DB_ERROR;
434 sleep($retrysleep);
435 redo DEADLOCK;
436 }
437 else {
438 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
439 if $retryverbose;
440 last DEADLOCK;
441 }
442 }
443


444 last DEADLOCK;
445
446 }
447
448 while ( $db->dbresults != $db->NO_MORE_RESULTS ) {
449
450 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
451 if ( $retrycount < 0 || $retrycount-- ) {
452 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
453 undef $DB_ERROR;
454 @res = ();
455 sleep($retrysleep);
456 redo DEADLOCK;
457 }
458 else {
459 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
460 if $retryverbose;
461 last DEADLOCK;
462 }
463 }

Can someone help please?

The 'undefined' error messages are filling up my log files & I'm not
able to figure out what exactly is getting undefined.

If I understand this piece of code correctly, it appears to me that
$DB_ERROR is undef'ed at line 421. Then, assuming that everything
proceeds without any errors & deadlocks, when the test for $DB_ERROR is
made in line 450 it is still undef'ed which in turn causes the error
message.

Any & all help would be greatly appreciated.
thanks,
Murali.
 
A

A. Sinan Unur

Subject: 18 Use of uninitialized value at /opt/perl-
5.005/lib/site_perl/5.005/sun4-solaris/Sybase/DBlib.pm line 450.

Please try to choose better subject lines than this.

In fact, the posting guidelines for this group contain valuable
information on how you can help others help you.

<snip long code snipped from Sybase::DBlib>

Did you check if the problem still manifests itself with the newest
version of the module (from April 2005) available on CPAN?

<URL: http://search.cpan.org/~mewp/sybperl-2.18/>

Taking a cursory look, it seems like the current version of the module
is turning off warnings in this section of the code.

If you do not want to or cannot upgrade, you might want to do the same
in your code. You should be able to use

no warnings 'uninitialized';

in the smallest lexical scope in your code where this problem applies to
turn off warnings.

I cannot test it here because I do not have the module installed.
made in line 450 it is still undef'ed which in turn causes the error
message.

That is not an error message.

Sinan
 

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,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top