CGI Programming on the World Wide Web by Shishir Gundavaram This errata page lists errors outstanding in the most recent printing, 1/98. If you have any error reports or technical questions, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was updated on February 23, 1999. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: {11} The backquotes/backtics are backwards. The line: $uptime = '/usr/ucb/uptime'; should be: $uptime = `/usr/ucb/uptime`; {20} The lines: $host_address = "bu\.edu"; $ip_address = "128\.197"; should read: $host_address = 'bu\.edu'; $ip_address = '128\.197'; We need single quotes to preserve the backslashes. {45} The backquotes/backtics are backwards. The line: $uptime = '/usr/ucb/uptime'; should be: $uptime = `/usr/ucb/uptime`; {46} The line of code now reads: chop ($current_date = '/bin/date'); It should read: chop ($current_date = `/bin/date`); {54} The query information: install.x=250&install_y=20 should be: install.x=250&install.y=20 {64} code 1: | meet you ", should be: | meet you, ", {65} The "simple_data" on the third line of the first paragraph should be "simple_form" instead. {66} The second sentence of the page ("The result is ... into the array.") should read as follows: The result is to fill the array key_value_pairs with entries in the form of "key=value". {75} The line: printf("Unrecognized method\n", cgi->request_method); should read: printf("Unrecognized method: %s\n", cgi->request_method); {100} The first sentence reads: "The %D format specifies that the date should be in dd/mm/yy format..." That's incorrect -- the %D format produces a date in mm/dd/yy format. {100} The second sentence reads: "%r format specifies "hh/mm/yy AM|PM" format..." It should read: "%r format specifies "hh/mm/ss AM|PM" format..." [100] There are a few errors in the table. Here is the original table along with the corrections: Format Value Example ------ ----- ------- %a Day of the week abbreviation Sun %A Day of the week Sunday %b Month name abbreviation (also %h) Jan %B Month name January %d Date 1 (NOT 01) This is incorrect; %d actually returns "01" -- just the opposite of what's stated. %D Date as "%m/%d/%y" 06/23/95 %e Date 01 %e returns "1" and not "01". The %d and %e are mixed up. %H 24-hour clock hour 13 %I 12-hour clock hour 1 %I returns the hour with a leading zero (i.e "01"). This explains the leading zero in the example for %r. %j Decimal day of the year 360 %m Month number 11 %M Minutes 08 %p AM | PM a.m. %p returns am and pm as "AM" and "PM", respectively. %r Time as "%I:%M:%S AM|PM" 07:17:39 PM This is equivalent to: "%I:%M:%S %p" %S Seconds 09 %T 24-hour time as "%H:%M:%S" 16:55:15 %U Week of the year 49 %w Day of the week number 05 %w returns the number WITHOUT a leading zero. BTW, the information returned by %w is slightly confusing. It returns the day of the week starting from Sunday (where Sunday is day 0). For example, Sat, May 4 would be returned as 6. %y Year of the century 95 %Y Year 1995 %Z Time zone EST {133} The while loop is missing a matching brace in the text. However, it exists in the online examples: while (){ if (m|\[\d+/\w+/\d+:([^:]+)|) { $time[$1]++; } } {159} 'Percentage' mentioned at various points - use of this term is not strictly correct. {162} line 29: 'Each element of the slices array is modified to contain the percentage value...' Not stricly correct: it is a 'normalised' value, not a 'percentage'. (250) line 3: "Fah" should be "FaH" {255} The fgrep used in the example is GNU fgrep version 2.0 which supports the -A and -B options. {265} The line: chop ($hostname = `bin/hostname`); should read: chop ($hostname = `/bin/hostname`); (269) The word "posses" should be "possess" on the 6th line of the largest paragraph. (306) In the second question, "Perl CGI rogram" should be "Perl CGI program". {326} Modern versions of the NCSA HTTPd server no longer use the imagemap.conf file. You can pass the map file as extra path information to the imagemap program directly, like so: where the map file (dragon.map) is stored in the /graphics directory. Note that this is a virtual path. {368} The line: % chmod 711 clock.pl should be: % chmod 755 clock.pl {369} In the first code snippet, the line: {374} 'Server Simulation' section: 'setenv REQUEST_METHOD ...' line is duplicated (385) There is an extraneous closing paren after "Special Edition Using Perl". (402) On Line 12: '/p..l/' 'l' wrong font (should be Roman) {421} RFC 1341 has been replaced by RFC 1521.