(getrss url="http://news.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml")
Read More...
(/getrss) ####
my $module = 'LWP::Simple';
my $return_val = $module->use;
if ($return_val)
{
$raw_data = get($command_args->{url});
$result = "";
if ($raw_data =~ m@(.*?) @s)
{
$channel_data = $1;
$channel_data =~ s@\[@ @g;
$channel_data =~ s@\]@ @g;
$channel_data =~ s@\(@ @g;
$channel_data =~ s@\)@ @g;
$channel_data =~ s@\+@ @g;
$channel_data =~ s@\?@ @g;
$channel_data =~ s@\'@ @g;
$channel_data =~ s@\$@ @g;
#these escapes are needed for the regex's below to
#work properly.
while ($channel_data =~ m@- (.*?)
@s)
{
$item_info = $1;
$mask = $data;
#the output mask is set to a copy of the data
#handed to the plugin
while ($mask =~ m@(.*?) @s)
{
$get_item = $1;
my $item_string;
if ($item_info =~ m@<$get_item>(.*?)$get_item>@s) { $item_string = $1; }
$mask =~ s@$get_item @$item_string@;
}
$result .= $mask;
$channel_data =~ s@- $item_info
@@;
}
}
else
{
$result = "Couldnt find channel tag ";
}
}
else
{
$result = "Couldnt retrieve url ";
}