[campy, 50's cinema version] Coming Soon to an Internet Near You! * SEE * The Way to Form Proper HTTP Headers! * ASTOUND * and * AMAZE * Your Friends with CGI Programs! * UNDERSTAND * the Magic of File Uploads! * LEARN * How GET and POST Really Work! * SEE * a Query Parser Broken Down and Explained! Yes, folks! It's true! CGI.pm is the preferred Perl way to parse your CGI queries, but it does a great deal more, and the code is a beast to try and wade through! Now, you have a once-in-a-lifetime opportunity to see the workings behind a proper, working, general, all-cases-covered-for query parser. See it built IN FRONT OF YOUR VERY EYES! But wait! THERE'S MORE! Yes, you can see how to SET AND RETRIEVE HTTP cookies! And learn about ways to ensure SECURITY in all your Perl programs! EVEN a section on FORMING HTTP REQUESTS! [Sponsor] Remember kids! Drink rich chocolatey Ovaltine! [shaft version] Hey cats. Dig this crazy scene. All them dope mothers out there tryin' to scope the CGI deal -- they got it allllllll wrong. It's a tough job, gettin' all the sweet data from your user to your program, and it's damn easy to mess up your action, and look like a foo'. Damn right. So shake that thang on over here, and demystify all that good lovin' you haven't gotten your paws on. It's all here, a sexy parser, a tough look at HTTP requests and responses, a tight little number called cookies. I know you want it. The Shaft knows you want it. [newbie version] For (months, weeks, days), you've heard that you shouldn't try parsing CGI queries by hand, and that you should use program X, Y, or Z. Chances are you've heard of cgi-lib.pl and/or CGI.pm. If you're using cgi-lib.pl, you're working with a legacy, one that really doesn't need all the attention he's getting. If you're using CGI.pm, you probably don't know WHY you're using it, and you're probably a bit confused with all this param() business ("why can't I just use %input?"). I'm not saying I'm going to step through the lines of code in CGI.pm for you (although I have done it... I HAVE BEEN TO THE EDGE AND BACK) but I will explain why it's so easy to make a query parser that will break when it gets something it doesn't expect. I'll put together a working parser piece by piece, showing you how to parse a simple ISINDEX query first, then a more complex GET query, then a POST, and then finally, a file upload. You'll even see WHAT these HTTP requests look like when your server sees them. You'll get a better understanding of how the HTTP request-response cycle works. Coming later in the tutorial will be sections on cookies, MAKING HTTP requests, and Perl security in general. [programmer's version] Ok. You've looked at CGI.pm. You've probably vomited or gasped for air or contemplated autoflagellation with one of the many blunt instruments you can find in your home. You're pretty you sure you know what it's all doing (and why it does it all via AUTOLOAD), but there are still some things that mystify you. Like, WHY does CGI.pm exist? And I'm not talking about all that HTML shortcut stuff. I mean, how hard could it possibly be to unravel a query? More than you think, most likely. There's no reason to write a SPECIFIC "GET only" parser, and then a SPECIFIC "POST only" parser, and then another, and another. Rather, you should solve these all with one parser, and use a multiplexor to decide what functionality to use. That's where my tutorial comes in. You might want to read over the HTTP section at the beginning, just in case. But the real meat is when I show how to break a query down into parts, and break the query parser down as well. It's a good, interesting read, and there's more to come after it. General Perl security (like taint checking), cookie parsing, and information on how to make and SEND HTTP requests (like the LWP:: suite of modules). [the actual url] It's on my web site right now, and it's still in development (thus the "trailer"). It'll be hosted on my site as long as I want it there, and it will also appear on "The Learning Center" portion of The Perl Archive's site (http://www.perlarchive.com/tlc/) in monthly installments. Right now, it sits at http://www.pobox.com/~japhy/articles/ideas/CGI.html and is broken down into (so far) four pieces. Once the first four sections are finished to my liking, it will appear at: http://www.pobox.com/~japhy/CGItutorial/ There will also be a link from the main page of my web site to the tutorial when it reaches that location, so you won't need to wait for word from me. [credits] I hope you had as much fun reading this email as I did writing it. I'm just trying to put a little frivolity into the Perl community (not like it doesn't already have it). Thanks for your time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: japhy's CGI Tutorial Trailer
by Adam (Vicar) on Sep 27, 2000 at 01:26 UTC | |
|
RE: japhy's CGI Tutorial Trailer
by Maclir (Curate) on Sep 27, 2000 at 01:13 UTC |