Home arrow Perl Programming arrow Parsing a Querystring With Perl

Parsing a Querystring With Perl

Having trouble parsing a querystring with Perl? If so, then Jeff's step-by-step guide will save you headaches and have you up and running in no time!

TABLE OF CONTENTS:
  1. Parsing a Querystring With Perl
  2. A Simple ISINDEX Query
  3. A Simple POST Query
By: Jeff Pinyan
Rating: starstarstarstarstar / 7
December 18, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
At first, parsing a CGI query sounds like a simple task. A query is just a list of key-value pairs, so a hash sounds like the right tool. But many CGI query parsers fail for anything other than what the specific query is they expect. What if it's a POST when you expected GET? What if the pairs are delimited by ; instead of &? What if the query is encoded via m/fd instead of a/xwfu? What if there's more than one value for a field? And what about file uploads, a topic I've not covered yet?

How quickly a simple function becomes complex. But if we break the cases down into simple procedures, we'll see it's not as bad as we thought.

 
 
>>> More Perl Programming Articles          >>> More By Jeff Pinyan
 

blog comments powered by Disqus
   

PERL PROGRAMMING ARTICLES

- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions
- Hashes
- Scalars: Building a Currency Converter
- Scalars and Variables
- Scalars and Boolean and String Operators
- Scalars and Operators
- Scalars


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: