Skip to content
Browse files

Only show LWP progress if attached to a console.

Show status of request for everything other than success.
Bump to version 0.31.
  • Loading branch information...
1 parent 4de0f6e commit b141d8b8155f6e429d2ea39c91bc45b260f3be88 @davorg committed Oct 5, 2009
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/Perlanet.pm
View
7 lib/Perlanet.pm
@@ -20,7 +20,7 @@ require XML::OPML::SimpleGen;
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.30';
+ $VERSION = '0.31';
}
$XML::Atom::ForceUnicode = 1;
@@ -85,7 +85,7 @@ sub BUILD {
$self->ua(LWP::UserAgent->new( agent => $self->cfg->{agent} ||=
"Perlanet/$VERSION" ));
- $self->ua->show_progress(1);
+ $self->ua->show_progress(1) if -t STDOUT;
$self->cfg->{cache_dir}
and $self->cache(CHI->new(
@@ -117,13 +117,14 @@ sub run {
my @entries;
foreach my $f (@{$self->cfg->{feeds}}) {
+
my $response = URI::Fetch->fetch($f->{url},
UserAgent => $self->ua,
Cache => $self->cache || undef,
ForceResponse => 1,
);
- if ($response->is_error) {
+ unless ($response->is_success) {
warn "$f->{url}:\n" . $response->http_response->status_line;
next;
}

0 comments on commit b141d8b

Please sign in to comment.
Something went wrong with that request. Please try again.