Subject: | CGI.pm example nph-clock.cgi doesnt work on NetWare / Win32 |
Date: | Wed, 6 Jun 2007 02:59:32 +0200 |
To: | bug-CGI.pm [...] rt.cpan.org |
From: | Guenter Knauf <info [...] gknw.de> |
Hi Lincoln,
on NetWare / Win32 we dont have `/bin/date`;
the patch below makes the sample working on these platforms:
--- nph-clock.cgi.orig Tue Nov 24 13:30:42 1998
+++ nph-clock.cgi Wed Jun 06 02:55:54 2007
@@ -5,7 +5,7 @@
do_push(-next_page=>\&draw_time,-delay=>1);
sub draw_time {
- my $time = `/bin/date`;
+ my $time = localtime();
return start_html('Tick Tock'),
div({-align=>CENTER},
h1('Virtual Clock'),
thanks, Guenter.
###########################################################################
# patch to fix CGI.pm to use binmode() on NetWare -- by G. Knauf. #
###########################################################################
--- CGI.pm.orig Mon Apr 16 18:58:46 2007
+++ CGI.pm Wed Jun 06 02:45:06 2007
@@ -155,12 +155,14 @@
$OS = 'EPOC';
} elsif ($OS =~ /^cygwin/i) {
$OS = 'CYGWIN';
+} elsif ($OS =~ /^NetWare/i) {
+ $OS = 'NETWARE';
} else {
$OS = 'UNIX';
}
# Some OS logic. Binary mode enabled on DOS, NT and VMS
-$needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|MSWin|CYGWIN)/;
+$needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|MSWin|CYGWIN|NETWARE)/;
# This is the default class for the CGI object to use when all else fails.
$DefaultClass = 'CGI' unless defined $CGI::DefaultClass;
@@ -171,7 +173,7 @@
# The path separator is a slash, backslash or semicolon, depending
# on the paltform.
$SL = {
- UNIX => '/', OS2 => '\\', EPOC => '/', CYGWIN => '/',
+ UNIX => '/', OS2 => '\\', EPOC => '/', CYGWIN => '/', NETWARE => '/',
WINDOWS => '\\', DOS => '\\', MACINTOSH => ':', VMS => '/'
}->{$OS};