2 Commits 570a6b1f07 ... 7094ec098b

Author SHA1 Message Date
  Alex Schroeder 7094ec098b stuff/server: fix UTF-8 encoding problem 4 years ago
  Alex Schroeder 04fe4d6991 stuff/server: better instructions at the beginning 4 years ago
1 changed files with 21 additions and 0 deletions
  1. 21 0
      stuff/server.pl

+ 21 - 0
stuff/server.pl

@@ -13,6 +13,23 @@
 # You should have received a copy of the GNU General Public License along with
 # this program. If not, see <http://www.gnu.org/licenses/>.
 
+# What is this?
+# =============
+#
+# This is a script that will server a wiki using a web server written in Perl,
+# without a fancy framework like Mojolicious. Instead, it uses
+# HTTP::Server::Simple::CGI.
+#
+# A simple usecase would be that you have had a wiki running years ago but then
+# you forgot all about it and your Apache config no longer works and who knows
+# how the system Perl is doing. So check out the data dir and notice that the
+# files belong to a user called _www... And so you run the following:
+#
+# sudo -u _www perl stuff/server.pl ./wiki.pl 3000 \
+#                   /Users/alex/WebServer/Oddmuse
+#
+# Your old wiki is served on localhost:3000 for you to examine.
+
 my $wiki = $ARGV[0] || './wiki.pl';
 my $port = $ARGV[1] || 8080;
 my $dir  = $ARGV[2];
@@ -33,6 +50,10 @@ $ENV{WikiDataDir} = $dir if $dir;
     package OddMuse;
     $q = shift;
 
+    # The equivalent of use CGI qw(-utf8) because it didn't work as part of
+    # cgi_init.
+    $CGI::PARAM_UTF8++;
+
     # NPH, or "no-parsed-header", scripts bypass the server completely by
     # sending the complete HTTP header directly to the browser.
     $q->nph(1);