# VladimirBot::News - Vladimir's sense of newsness # # This module knows about the world, or at least can tell you where to find more info # # History/Notes # 2003.09.17 # - Added notes package VladimirBot::News; use strict; use LWP::Simple; use XML::RSS; # Here I push myself onto the module call stack push @VladimirBot::vladimir_module, 'News'; # Parse a sentence or decide its not for me sub parse { my $sentence = shift; if($sentence =~ /news/i) { return getnews(); } else { return 0; } } sub getnews { my $content = get("http://news.bbc.co.uk/rss/newsonline_world_edition/front_page/rss091.xml"); my $rss = new XML::RSS; my $out = ''; $rss->parse($content); $out .= "Here are headlines from the BBC:\n"; # print the title and link of each RSS item foreach my $item (@{$rss->{'items'}}) { $out .= "{'link'}\">$item->{'title'}\n"; } return $out; } 1;