API hangs on dropped connection

ISP with thousands of Wireless Subscribers
radios of closed accounts are simply abandoned
and blocked from internet by setting ip in the address list in the core router

now these "Zombies" can live forever (with a static IP)

to release IP and other resources
I would like to kill the Zombies after some delay

using perl and the Mikrotik API module
wrote a script to API login and disable the wireless interface
works fine BUT the API script causes the server to hang immediately after the connection drops
even an "alarm" timeout will not function

any fix or work arounds?

#! /usr/bin/perl -w

Mtik.pm - a simple Mikrotik Router API client

Version 1.0 Beta

Hugh Messenger - hugh at alaweb dot com

Released under Creative Commons license.

Do with it what you will, but don't blame me!

#----------------

$ uname -a
Linux scan 2.6.26.8-57.fc8 #1 SMP Thu Dec 18 19:19:45 EST 2008 i686 i686 i386 GNU/Linux

$ perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi

Instead of immediately disabling the wireless interface, you could set up a scheduler script to do it. The script would wait two seconds, remove itself, and then disable the wireless interface.

The effect is the same as doing the disabling manually, but it gives the server time to disconnect from the router before “shit hits the fan”.