Yes, but a good tutorial for beginners doesn't include all the advanced things. It should be the simplest possible. It should be not fully correct for all the cases but simple to understand.
The reason most people that want to start programming in Perl change their mind and use another programming language like PHP, or ASP, etc, is that most examples are very complicated. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] ----- Original Message ----- From: "Ovid" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 10:52 PM Subject: Re: tutorials --- [EMAIL PROTECTED] wrote: > The www.cgi101.com site is awsome i read the first 6 chapters of the book > online yesterday and bought the book today, Anyone with knowledge of html can > write cgi with this book, with no prior knowlege of any programmin, it is a > must for begginger Hi Ambrose, I hope you don't take this personally, but that site was one of my motivations for writing my own CGI course. I was frequently asked to recommend a decent online tutorial for CGI programming with Perl and I simply couldn't find one. (japhy had a great one started, but I can't find it now. Also, it was not, IMHO, aimed at novices). Taking some examples from that site (http://www.cgi101.com/class/ch4/text.html): 1. read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); 2. @pairs = split(/&/, $buffer); 3. foreach $pair (@pairs) { 4. ($name, $value) = split(/=/, $pair); 5. $value =~ tr/+/ /; 6. $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 7. $FORM{$name} = $value; 8. } Line 1: it doesn't check to ensure that the read was successful or that the content length matched the length of data being read. Also, it doesn't allows for the GET method. Form processing code should hide such implementation details. Line 2: the semicolon is an alternate (and preferred) delimiter. This code will break if that is used. Line 3: $pair is not declared with 'my'. Lines 5 & 6: $name can also contain special characters, but they're not dealt with here (the author may be aware of this because she deliberately uses names like "favorite_color"). Also, these values are not declared with 'my'. Line 7: does not allow for multiple values for a given name. Also, %FORM not declared with 'my' (outside of the loop, of course). Putting all of that together, try feeding the following to the above routine: primary%20color=red;alternate%20colors=blue;alternate%20colors=green That is a correctly formatted query string and not at all unlikely, but the broken code above will not parse it. Not that I blame the author, mind you, or the people who read it without understanding the implications, but code like this should not be used except as an example of why it doesn't work. You can find more detail at lesson two of my CGI course: http://users.easystreet.com/ovid/cgi_course/lesson_two/lesson_two.html The rest of the course has many similar issues. For example, in one of the FAQs (http://www.cgi101.com/class/ch4/), we have the following: print "Content-type:text/html\n\n"; There should be a space after the semi-colon. This is such a common error that many browsers detect and correct for it, but many will not, thus causing the page to not render. Cheers, Ovid ===== "Ovid" on http://www.perlmonks.org/ Web Programming with Perl: http://users.easystreet.com/ovid/cgi_course/ Silence Is Evil: http://users.easystreet.com/ovid/philosophy/decency.txt __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]