Re: ANNOUNCE: CGI-various-04.shar
Tim Bunce (Tim.Bunce@ig.co.uk)
Fri, 21 Apr 1995 23:27:48 +0100
> From: Tom Christiansen <tchrist@mox.perl.com>
>
> I'd like to have someone show me the "right" way to use the new CGI
> modules. Here's a script I hacked together last night. It's still
> a little rough around the edges (like netscape 1.0 doesn't like it
> but netscape 1.1 does).
>
> thanks
>
> --tom
>
Here's a very quick untested patch to get you started...
Regards,
Tim.
*** tc.orig Fri Apr 21 23:09:21 1995
--- tc Fri Apr 21 23:23:45 1995
***************
*** 29,32 ****
--- 29,40 ----
require 5.0;
+ use CGI::Base;
+ use CGI::Request;
+
+ CGI::Base::LogFile('cgi.log') unless -t STDIN;
+
+ print PrintHeader();
+
+
##############################################
# BEGIN CONFIG SECTION
***************
*** 54,58 ****
die "No $NGFILE: $!" unless -f $NGFILE && -r _;
! if ($ENV{HTTP_USER_AGENT} =~ m#Mozilla/1.1#) {
$file_icon = "<IMG BORDER=0 SRC=internal-news-newsgroup>";
$dir_icon = "<IMG BORDER=0 SRC=internal-news-newsgroups>";
--- 62,66 ----
die "No $NGFILE: $!" unless -f $NGFILE && -r _;
! if ($HTTP_USER_AGENT =~ m#Mozilla/1.1#) {
$file_icon = "<IMG BORDER=0 SRC=internal-news-newsgroup>";
$dir_icon = "<IMG BORDER=0 SRC=internal-news-newsgroups>";
***************
*** 59,72 ****
}
! if (@ARGV) {
! $Target = shift;
! } else {
! get_request();
!
! if (!($Target = $rqpairs{'newsgroup'})) {
! ($Target) = each %rqpairs; # top level
! }
! }
!
die "Cannot fork: $!" unless defined ($pid = open(INPUT, "-|"));
--- 67,72 ----
}
! $req = GetRequest();
! $Target = $req->param('newsgroup') || $req->keywords;
die "Cannot fork: $!" unless defined ($pid = open(INPUT, "-|"));
***************
*** 169,173 ****
! html_header($what);
if ($Target) {
--- 169,180 ----
! # It's a bad idea to defer output of "Content-type...\n\n" because
! # if your script dies before that point the user sees nothing at all.
! # We now output the header as the very first thing the script does.
!
! # html_iheader($what);
! print "<html><head>\n";
! print "<title>$what</title>\n";
! print "</head>\n<body>\n";
if ($Target) {