aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/aggregate.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-11-17 15:56:15 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-11-17 15:56:15 -0500
commit75f262f44dc1b192644252171e77cab90cc7322c (patch)
tree7c1afb1417eb0685835f9bbb0a9dc3ac89d0a523 /IkiWiki/Plugin/aggregate.pm
parent7aad3b604784a749c1681dbf9dbb89250147cbff (diff)
downloadikiwiki-75f262f44dc1b192644252171e77cab90cc7322c.tar
ikiwiki-75f262f44dc1b192644252171e77cab90cc7322c.tar.gz
call decode_utf8 inside eval
holger reported that decode_utf8 was crashing with perl 5.8.8. Earlier, I thought that passing 0 to the function avoided this with old perls, but that was apparently not enough, it still crashes. So, put it inside the eval, so we can at least recover from it crashing.
Diffstat (limited to 'IkiWiki/Plugin/aggregate.pm')
-rw-r--r--IkiWiki/Plugin/aggregate.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index c9c2880c5..f256b3ac1 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -496,15 +496,19 @@ sub aggregate (@) { #{{{
# that contains invalid UTF-8 sequences. Convert
# feed to ascii to try to work around.
$feed->{message}.=" ".sprintf(gettext("(invalid UTF-8 stripped from feed)"));
- $content=Encode::decode_utf8($content, 0);
- $f=eval{XML::Feed->parse(\$content)};
+ $f=eval {
+ $content=Encode::decode_utf8($content, 0);
+ XML::Feed->parse(\$content)
+ };
}
if ($@) {
# Another possibility is badly escaped entities.
$feed->{message}.=" ".sprintf(gettext("(feed entities escaped)"));
$content=~s/\&(?!amp)(\w+);/&amp;$1;/g;
- $content=Encode::decode_utf8($content, 0);
- $f=eval{XML::Feed->parse(\$content)};
+ $f=eval {
+ $content=Encode::decode_utf8($content, 0);
+ XML::Feed->parse(\$content)
+ };
}
if ($@) {
$feed->{message}=gettext("feed crashed XML::Feed!")." ($@)";