in reply to Cannot Remove Redefined Warnings
Investigation continues. The issue is running the subroutine in separate threads. And when l wrote this some years ago, l put a comment about the following code.
It looks like this code no longer works, i.e. the refined warnings continue. It is the connect_to_database code that is triggering the redefin warnings.
I removed use warnings altogether, replaced the code below with no warnings in different varieties - but CANNOT remove the redefined warnings.
Any suggestions? I need each thread to hold a separate connection to the database.
###################################################################### +######### # Function: connect_to_database # Purpose: Connect to the Oracle database # Arguments: $db_uid, $db_pwd, $db_sid # Returns: $dbh ###################################################################### +######### sub connect_to_database($$$) { # Declare the variables my ($db_uid, $db_pwd, $db_sid) = @_; my $dbh; my %attribs = ( PrintError => 0, AutoCommit => 0, RaiseError => 0 ); $dbh = DBI->connect("DBI:Oracle:".$db_sid, $db_uid, $db_pwd , +\%attribs ) or die "ERROR: Can't connect to database ($db_uid\@$d +b_sid): ".$DBI::errstr."\n"; return $dbh; } ..... # Remove erroneous "subroutine redefined" warning { BEGIN { $^W = 0 } $dbh = connect_to_database($db_uid, $db_pwd, $db_sid); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cannot Remove Redefined Warnings
by Corion (Patriarch) on May 06, 2025 at 07:20 UTC | |
|
Re^2: Cannot Remove Redefined Warnings
by NERDVANA (Priest) on May 06, 2025 at 00:05 UTC |