had to backrev

This commit is contained in:
JT Smith 2004-09-06 18:24:43 +00:00
parent a06b6dbb00
commit 9076619517

View file

@ -25,7 +25,6 @@ use WebGUI::Session;
use WebGUI::Wobject;
use XML::RSSLite;
use LWP::UserAgent;
use WebGUI::ErrorHandler;
our @ISA = qw(WebGUI::Wobject);
@ -45,8 +44,7 @@ sub new {
rssUrl=>{},
maxHeadlines=>{},
},
-useTemplate=>1,
-useMetaData=>1
-useTemplate=>1
);
bless $self, $class;
}
@ -183,25 +181,11 @@ sub _get_rss_data {
my $ua = LWP::UserAgent->new(timeout => 5);
my $response = $ua->get($url);
if (!$response->is_success()) {
WebGUI::ErrorHandler::warn("Error retrieving url '$url': " .
warn("Error retrieving url '$url': " .
$response->status_line());
return undef;
}
my $xml = $response->content();
# Convert encoding if needed / Perl 5.8.0 or up required.
if ($] >= 5.008) {
$xml =~ /<\?xml.*?encoding=['"](\S+)['"]/i;
my $xmlEncoding = $1;
my $encoding = WebGUI::International::getLanguage($session{page}{languageId},"charset");
if (lc($xmlEncoding) ne lc($encoding)) {
use Encode qw(from_to);
eval { from_to($xml, $xmlEncoding, $encoding) };
WebGUI::ErrorHandler::warn($@) if ($@);
}
}
# there is no encode_entities_numeric that I can find, so I am
# commenting this out. -hal
@ -213,7 +197,7 @@ sub _get_rss_data {
XML::RSSLite::parseXML($rss_lite, \$xml);
};
if ($@) {
WebGUI::ErrorHandler::warn("error parsing rss for url $url");
warn("error parsing rss for url $url");
}
# make sure that the {channel} points to the channel
@ -224,10 +208,10 @@ sub _get_rss_data {
$rss_lite = {channel => $rss_lite};
if (!($rss->{channel} =
_find_record($rss_lite, qr/^channel$/))) {
WebGUI::ErrorHandler::warn("unable to find channel info for url $url");
warn("unable to find channel info for url $url");
}
if (!($rss->{items} = _find_record($rss_lite, qr/^items?$/))) {
WebGUI::ErrorHandler::warn("unable to find item info for url $url");
warn("unable to find item info for url $url");
$rss->{items} = [];
}
@ -345,7 +329,6 @@ sub _view_single_feed {
}
sub www_view {
$_[0]->logView() if ($session{setting}{passiveProfilingEnabled});
my $maxHeadlines = $_[0]->get("maxHeadlines") || 1000000;
my @urls = split(/\s+/,$_[0]->get("rssUrl"));