Преглед изворни кода

Make failure to read PageHead/PageFoot files non-fatal

Christoph Berg пре 21 година
родитељ
комит
8e1134dfb3
2 измењених фајлова са 9 додато и 2 уклоњено
  1. 1 0
      docs/Changelog
  2. 8 2
      modules/Pisg/HTMLGenerator.pm

+ 1 - 0
docs/Changelog

@@ -16,6 +16,7 @@ pisg (0.64) - ??
      LogDirs.
      LogDirs.
    * No "Userpic" headline was shown when there were only DefaultPics.
    * No "Userpic" headline was shown when there were only DefaultPics.
    * Make "most used words" case-insensitive.
    * Make "most used words" case-insensitive.
+   * Make failure to read PageHead/PageFoot files non-fatal.
    * Applied patch by Hanno Hecker to keep only the last 50 quotes for each
    * Applied patch by Hanno Hecker to keep only the last 50 quotes for each
      nick while parsing. Saves memory and is probably saner anyway (thanks!).
      nick while parsing. Saves memory and is probably saner anyway (thanks!).
    * Add version number to documentation title (and let the release Makefile
    * Add version number to documentation title (and let the release Makefile

+ 8 - 2
modules/Pisg/HTMLGenerator.pm

@@ -344,7 +344,10 @@ HTML
 sub _pageheader
 sub _pageheader
 {
 {
     my $self = shift;
     my $self = shift;
-    open(PAGEHEAD, $self->{cfg}->{pagehead}) or die("$0: Unable to open $self->{cfg}->{pagehead} for reading: $!\n");
+    unless(open(PAGEHEAD, $self->{cfg}->{pagehead})) {
+        warn("$0: Unable to open $self->{cfg}->{pagehead} for reading: $!\n");
+        return;
+    }
     while (<PAGEHEAD>) {
     while (<PAGEHEAD>) {
         _html($_);
         _html($_);
     }
     }
@@ -354,7 +357,10 @@ sub _pageheader
 sub _pagefooter
 sub _pagefooter
 {
 {
     my $self = shift;
     my $self = shift;
-    open(PAGEFOOT, $self->{cfg}->{pagefoot}) or die("$0: Unable to open $self->{cfg}->{pagefoot} for reading: $!\n");
+    unless(open(PAGEFOOT, $self->{cfg}->{pagefoot})) {
+        warn("$0: Unable to open $self->{cfg}->{pagefoot} for reading: $!\n");
+        return;
+    }
     while (<PAGEFOOT>) {
     while (<PAGEFOOT>) {
         _html($_);
         _html($_);
     }
     }