On Wednesday, Jan 8, 2003, at 12:09 US/Pacific, Susan Aurand wrote:

thanks.
the simplest rule of thumb is

	start with GET until you have a good excuse for POST

When you shift towards the 'all POST' approach, then you
also want to be effectively using JavaScripting for the
stuff that needs to be resolved at the browser before coming
back to you....

one trick that has become constant for me at this point
is the basic form:

#--------- begin code fragment ------------

 my $request = $ENV{'REQUEST_METHOD'};
 #
 # solve for the basic case
 #
 if( defined($request) && $request =~ m/^POST|GET|HEAD$/)
 {
	#
	# here we deal with the legit side
 	#
	my $queryString = ($request eq 'POST' )?
					<STDIN> : $ENV{'QUERY_STRING'};
	#
	# do something with the query string
    #
 }
 else
 {
	#
	# we were called with something other than a GET, POST or HEAD
	# or odd thought, without anything.....
	# put together a Whine about that Unpleasantry
	#
 }

#--------- end code fragment ------------

This way even I later on plan to use all POSTS I can still
check it with a simple test.sh script like:

	#!/bin/sh

	METHOD=$1
	SCRIPT=$2
	QUERY_STRING=$3
	DEBUG=$4

	REQUEST_METHOD=${METHOD}
	dir=`pwd`
	dir=`echo $dir | sed s'!.*\(/home\)!\1!'`
	SCRIPT_FILENAME="${dir}/$SCRIPT"

	export REQUEST_METHOD SCRIPT_FILENAME QUERY_STRING

	perl ${DEBUG} $SCRIPT

which I would target with say

	sh test.sh FooBar.cgi GET "sysname=bob&config_host=alice" -d

which would allow me to invoke the perl debuggger on the code
and set the basic players in the environment....

and/or go at it with the usual LWP Agent....

ciao
drieux

---


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to