On Tue, Apr 10, 2001 at 12:26:39PM +0100, Tom Robinson wrote:
> I'm trying to use the DBI within a package I'm
> writing, and am getting an odd error (warning). What
> is even more odd is that everything actually works
> fine.
> sub END {
> $Dbh->disconnect()
> or croak "could not disconnect from database:
> $DBI::errstr";
> }
> And I get a printout of the tables, which means it
> must be connecting ok. I don't get the croak message
> on the $Dbh->disconnect(), so that must also be
> working. But I am getting:
>
> Useless use of private variable in void context at
> Package.pm line 56.
>
> line 56 being the one that just contains:
>
> $Dbh->disconnect()
>
> so it must be saying $Dbh is being used in a void
> context. But if that were the case, surely the
> disconnect method call would fail with cannot call
> method on undefined object?
I suspect that the error is actually on another line.
$Dbh on that line is not in a void context, because it is on the left-hand
side of a method call.
Ronald