On Tue, Apr 09, 2002 at 11:13:09AM +0100, Martin Harriss wrote:
> I am using Embperl on an intranet system to perform complex database
> searches and display the results.
>
> My problem is that, depending on the parameters given by the user, some
> searches can take some time - returning thousands of rows, and there is a
> danger that the user will hit the stop button, execute the Back command or
> even close the browser session altogether. If this happens at the wrong
> time, an oracle connection could have been made, but no SQL sent to it,
> leaving an Oracle process hanging there.
>
> I need to be able to trap these browser events, and I can then call a
> cleanup routine to close any database connections. I can use the
> Javascript onUnload event, I can't figure how to commmuncate with the Perl
> process.
I don't remember where I saw this, but I think it might be what you're
looking for.
while ($dbh->fetch) {
# format, print, etc.
last if $r->connection->aborted;
}
$dbh->disconnect;
--
Jacob Elder
http://www.lucidpark.net/