in reply to passing DBI database handles to subroutines
My main thought is that the
is occuring in a different scope than the return call is. For example, if you are doing something like:my $dbh = DBI->connect( " yada yada " ), { PrintError => 0}, or die "cannot open db connection: $DBI::errstr\n";
$dbh has gone out of scope before being returned and you will get undef on the other side.eval { my $dbh = DBI->connect( " yada yada " ), { PrintError => 0}, or die "cannot open db connection: $DBI::errstr\n"; } return $dbh;
Try using something like
sub db_connection { my ( $self ) = @_; my $dbh;
Standard statements of making sure you are using -w and strict and a request to use the <code></code> tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: passing DBI database handles to subroutines
by moo (Acolyte) on Aug 10, 2000 at 23:57 UTC |