while ( $stomp->can_read ( {timeout => 0.5 } ) ){ # do stuff }