]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/aggregate.pm
cosmetics patch from Recai
[ikiwiki.git] / IkiWiki / Plugin / aggregate.pm
index 4f4182930165ef7ffcdadc1384d5841b06e8e45a..2a3f36fcebd07be205075b81e57c49737ce35d74 100644 (file)
@@ -9,6 +9,7 @@ use HTML::Entities;
 use HTML::Parser;
 use HTML::Tagset;
 use URI;
+use open qw{:utf8 :std};
 
 my %feeds;
 my %guids;
@@ -24,6 +25,7 @@ sub import { #{{{
 
 sub getopt () { #{{{
         eval q{use Getopt::Long};
+       error($@) if $@;
         Getopt::Long::Configure('pass_through');
         GetOptions("aggregate" => \$config{aggregate});
 } #}}}
@@ -149,7 +151,7 @@ sub loadstate () { #{{{
 
 sub savestate () { #{{{
        eval q{use HTML::Entities};
-       die $@ if $@;
+       error($@) if $@;
        open (OUT, ">$config{wikistatedir}/aggregate" ||
                die "$config{wikistatedir}/aggregate: $!");
        foreach my $data (values %feeds, values %guids) {
@@ -218,9 +220,9 @@ sub expire () { #{{{
 
 sub aggregate () { #{{{
        eval q{use XML::Feed};
-       die $@ if $@;
+       error($@) if $@;
        eval q{use HTML::Entities};
-       die $@ if $@;
+       error($@) if $@;
 
        foreach my $feed (values %feeds) {
                next unless $config{rebuild} || 
@@ -281,7 +283,7 @@ sub add_page (@) { #{{{
        if (exists $guids{$params{guid}}) {
                # updating an existing post
                $guid=$guids{$params{guid}};
-               next if $guid->{expired};
+               return if $guid->{expired};
        }
        else {
                # new post
@@ -315,6 +317,7 @@ sub add_page (@) { #{{{
        # to avoid unneccessary rebuilding. The mtime from rss cannot be
        # trusted; let's use a digest.
        eval q{use Digest::MD5 'md5_hex'};
+       error($@) if $@;
        require Encode;
        my $digest=md5_hex(Encode::encode_utf8($params{content}));
        return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $config{rebuild};