]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/aggregate.pm
Merge branch 'ready/chrysn/linkmapenhancement'
[git.ikiwiki.info.git] / IkiWiki / Plugin / aggregate.pm
index 3e3eb6d9301da377b6a72128cde42f25a41da34c..fbf88c62738d783c210d27cf6aa57c1b81c71fef 100644 (file)
@@ -553,7 +553,9 @@ sub aggregate (@) {
                        };
                }
                if ($@) {
-                       $feed->{message}=gettext("feed crashed XML::Feed!")." ($@)";
+                       # gettext can clobber $@
+                       my $error = $@;
+                       $feed->{message}=gettext("feed crashed XML::Feed!")." ($error)";
                        $feed->{error}=1;
                        debug($feed->{message});
                        next;
@@ -628,12 +630,12 @@ sub add_page (@) {
                       -e "$config{srcdir}/".htmlfn($page.$c)) {
                        $c++
                }
+               $page=$page.$c;
 
                $guid->{page}=$page;
                eval { write_page($feed, $guid, $mtime, \%params) };
                if ($@) {
                        # assume failure was due to a too long filename
-                       # (or o
                        $c="";
                        $page=$feed->{dir}."/item";
                        while (exists $IkiWiki::pagecase{lc $page.$c} ||
@@ -641,6 +643,7 @@ sub add_page (@) {
                              -e "$config{srcdir}/".htmlfn($page.$c)) {
                                $c++
                        }
+                       $page=$page.$c;
 
                        $guid->{page}=$page;
                        write_page($feed, $guid, $mtime, \%params);
@@ -674,7 +677,9 @@ sub write_page ($$$$$) {
                $template=template($feed->{template}, blind_cache => 1);
        };
        if ($@) {
-               print STDERR gettext("failed to process template:")." $@";
+               # gettext can clobber $@
+               my $error = $@;
+               print STDERR gettext("failed to process template:")." $error";
                return;
        }
        $template->param(title => $params{title})