##
sub agent_handler {
# ...
$heap->{wheel}->{$wheel->ID} = $wheel;
$heap->{socket}->{$wheel->ID} = $socket;
# ...
}
sub agent_error {
# ...
delete $heap->{wheel}->{$wheel_id};
delete $heap->{socket}->{$wheel_id};
}
####
$heap->{$wheel->ID} =
{ wheel => $wheel,
socket => $socket,
foo => $foo,
};
####
delete $heap->{$wheel_id};