use zUtil;


sub cbcRssHandler
{
    $html = shift;
   my( @rValue ) = ();
   my( $count, $item );
   my( $done, $title, $link, $desc );

   print "=------------------ cbc rss handler --------------------=\n";
   print "xml: $html\n";
   #exit 1;
   
   $count = 1;
   $item = zUtil::getNthItemNew( $count, $html, "<item", "</item>" );
   while( defined( $item ) )
   {
       if( $item =~ /<title>(.*?)<\/title>.*?<link>(.*?)<\/link>/gsi )
       {
           $title = $1;
           $link = $2;
           $desc = "n/a";
           
           $title =~ s/<\!\[CDATA\[(.*?)\]\]\>/$1/gsix;
           $link =~ s/(http:\/\/.*?)\?.*/$1/gsix;
           
           print "title: $title\n";
           print "link: $link\n";
           print "desc: $desc\n";

           push @rValue,
           {
	           'headline' => $title,
	           'url'  => $link,
	           'desc'  => $desc
           };
       }
        
        $count++;
        $item = zUtil::getNthItemNew( $count, $html, "<item", "</item>" );
        if( $item =~ /^$/gsi )
        {
            $item = undef;
        }

     }
  
   return @rValue;
}

return 1;

