Blinkenlites with Perl A case study in driving custom home-made hardware with Perl #14

The driver code: guided tour

Part 4: Subroutine to see if anyone is listening

# is anyone listening to us?
sub radio_listeners {		
   $mech->get( shift );

   our $data = $mech->content;

   while(( $data =~ /Listeners:.*streamdata">(\d+)/g )) {

       return 1 if $1;				

   } 
   return 0;
}  # end
Copyright © 2006 Steve McNabb