[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] QPQ/MacPerl problem



mark@cheers.jsc.nasa.gov helpfully responded:
> Not to knock NetPresenz or anything - but you should
> download Quid Pro Quo (QPQ).  It is available at
> http://www.slaphappy.com, is free, and is only beaten out
> by WebStar in the speed category.  Also, QPQ does not have
> any of the problems with CGI scripts which NetPresenz does
> and the guy who wrote it also gives you the source code to
> write in various languages such as C and Perl (or rather
> MacPerl).
<some snipped>

Hello, I'm new to the list and  a rank newbie to MacPerl
(and not much better with Perl) so please excuse my ignorance.

I downloaded QPQ and like it very much, thank you!
It does beat out NetPresenz and I've already convinced
a friend to change over also.

I could not find the MacPerl examples  mentioned, they
looked to be all in AppleScript or C so I could use some help.

I'm trying to translate some perl scripts used on a Unix server.

I would like to use something like this perl script,
except it should be for the MacOS:

---start script---

#!/usr/local/perl

print "Content-type: terxt/html\n\n";

foreach $k (keys %ENV) {
	print "$k = $ENV{$k}<br>;
}

---end script---

Now I do understand that the MacOS does not use enviornmental variables,
what I would like to get are the CGI arguements returned to me via a
MacPerl CGI.

Can someone translate the following AppleScript (I know *nothing* about
AppleScript) to something in MacPerl I could use with QPQ?

--- start script---

property crlf : (ASCII character 13) & (ASCII character 10)

on Çevent WWW½sdocÈ path_args Â
	given Çclass kforÈ:http_search_args, Çclass postÈ:post_args, Çclass
methÈ:method, Çclass addrÈ:client_address, Çclass userÈ:username, Çclass
passÈ:password, Çclass frmuÈ:from_user, Çclass svnmÈ:server_name, Çclass
svptÈ:server_port, Çclass scnmÈ:script_name, Çclass ctypÈ:content_type,
Çclass refrÈ:referer, Çclass AgntÈ:user_agent
	-- header
	set thereturn to "HTTP/1.0 200 OK" & crlf & "Server:QPQ" & crlf & Â
		"MIME-Version: 1.0" & crlf & "Content-type: text/html" &
crlf & crlf

	-- the rest
	set thereturn to thereturn & Â
		"<title>Example CGI</title>
		<h2>Example CGI</h2><u>CGI arguments sent:</u>" & Â
		"<br><b>path:</b> " & path_args & Â
		"<br><b>search:</b> " & http_search_args & Â
		"<br><b>post_args:</b> " & post_args & Â
		"<br><b>method:</b> " & method & Â
		"<br><b>address:</b> " & client_address & Â
		"<br><b>user:</b> " & username & Â
		"<br><b>password:</b> " & password & Â
		"<br><b>from:</b> " & from_user & Â
		"<br><b>server_name:</b> " & server_name & Â
		"<br><b>server_port:</b> " & server_port & Â
		"<br><b>script_name:</b> " & script_name & Â
		"<br><b>referer:</b> " & referer & Â
		"<br><b>user agent:</b> " & user_agent & Â
		"<br><b>content_type:</b> " & content_type & crlf

	return thereturn
end Çevent WWW½sdocÈ

---end script----

Thanks very much in advance!
I have found very few MacPerl CGI's out there for study
and this will fill in large empty places in my understandings.

Bob Anderson
bazooka@well.com




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch