This is how I do what you're talking about and it really doesn't have anything to do with perl.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
  "http://www.phone.com/dtd/wml11.dtd">
<wml> 
<head>
 <meta forua='true' http-equiv='cache-control' content='max-age=0'/>
 <meta forua='true' http-equiv='Cache-Control' content='must-revalidate'/>
</head>
<card>
 <p align="center"><img src="/m/image.cfm" alt=""/></p>
 <do type="accept">
  <go href="page.pl?zipcode=$zipcode"/>
 </do>
 <p align="left">Zipcode: <input name="zipcode" type="text"format="NNNNN"/></p>
</card>
</wml>
 
This method appends the variable that I want the script to have access to on the query string and I can grab it using the standard CGI module, or your get method that you described.  This method works fine for everything I plan to do on these devices, as I don't require massive amounts of input.  There may be a way to post data as well using WML, but I've not figured it out yet.  Remember that when you're doing more than one variable on the querystring in WML you need to escape the "&" symbol, unlike HTML. For instance "page.pl?lat=$lat&amp;lon=$lon"
 
Hope this helps. 
 
--Tom
-----Original Message-----
From: dave fleet <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, March 23, 2000 6:14 PM
Subject: wap/wml and Perl

Is anyone doing Perl and WML/wap programming?
I've just started, and can't work out how to grab data from a wml form.
I have tried the post method : --
 
#parse form data
 
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 
$postinput = $buffer;
 
@pairs = split(/&/, $buffer);
 
$postinput =~ s/&/\n/g;
 
$postinput =~ s/\+/ /g;
 
$postinput =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig;
 
 
 
 
 
foreach $pair (@pairs) {
 
($name, $value) = split(/=/, $pair);
 
$value =~ tr/+/ /;
 
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 
$value =~ s/<!--(.|\n)*-->//g;
 
$FORM{$name} = $value;
 
}
 

and the get method : --
 
if($ENV{'QUERY_STRING'}){
 
$cde="$ENV{'QUERY_STRING'}";
 

#start parsing if a query string
 
@pairs = split(/&/, $cde);
 
# For each name-value pair: #
 
foreach $pair (@pairs) {
 
# Split the pair up into individual variables. #
 
local($name, $value) = split(/=/, $pair);
 

$FORM{$name} = $value;
 
}}
 
 
 
Can I access some type of wml environment variables?
 
 
*****************************
Han Fleet
Programmer
AvaterraUK
www.avaterra.com
www.vzones.com
www.juiceuk.com
 

Reply via email to