my $file = $UserID . '.' . md5_hex($url) . '.atom';
$FETCH = 1 if ! -e $file;
-warn "# $url -> $file\n";
+warn "# mirror $FETCH $url -> $file\n";
if ( $FETCH && mirror( $url => $file ) == RC_NOT_MODIFIED ) {
warn "not modified";
-# exit 0;
}
-my $feed = XMLin( $file );
+my $feed = eval { XMLin( $file ) };
+if ( $! ) {
+ warn "ERROR $file $!\n";
+ goto skip_url;
+}
#warn "# feed ",dump($feed);
sub link_to_id {
if ( $link->{rel} eq 'up' ) {
push @{ $tree->{$key} }, $id;
+ } elsif ( $link->{rel} eq 'self' && $link->{href} =~ m{/collections/} ) {
+ warn "# get items in this collection";
+ push @urls, "$link->{href}/items";
}
}
goto restart;
}
+skip_url:
+
if ( $url = shift @urls ) {
warn "## next url $url";
goto restart;