Some time around 9/5/97 9:30 AM CDT, Paul Linder wrote something about >RE>[MacPerl] Environment Variables >I do it by using the perl script as a cgi. I think it's the only way to >do this because it takes server software to take the request header info >and redirect it to your script. > >Use the FORM html tag line in the web page to indicate what Perl script >that awaits on the server: > ><FORM ACTION="/shell/suggestion_form.pl" METHOD="POST" >ENCTYPE="application/x-www-form-urlencoded"> > >Then in you Perl script you have to use something that is available in >many free scrips floating around the net that will split the var/value >pairs like this: > >### Get the input >read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > >### Split the name-value pairs >@pairs = split(/&/, $buffer); > >foreach $pair (@pairs) { > ($name, $value) = split(/=/, $pair); > > ### Un-Webify plus signs and %-encoding > $value =~ tr/+/ /; > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $value =~ s/<!--(.|\n)*-->//g; > > $FORM{$name} = $value; > } > >I don't have the name of the person the previous code is attributed to, >but I do not claim to have written this myself. You can find this also in >Perl books or cgi books. > >-------------------------------------- >Date: 9/5/97 12:03 AM >To: Paul Linder >From: Len >How does one transfer variable key/value pairs from HTML on a web page to >MacPerl ? > >Len or you can use the CGI module, available on CPAN. __BEGIN use CGI; $in = new CGI; $value1 = $in->param( 'key1' ); $value2 = $in->param( 'key2' ); # etc... __END CGI.pm also provides methods for just about any transaction between your script and a user's browser. Dave Beverly webmaster@thecitizennews.com -- http://www.thecitizennews.com/ webmaster@henrynews.com -- http://www.henrynews.com/ Mac Manipulator "I don't do windows!" ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch