Created
February 23, 2012 20:52
-
-
Save pedrofaria/1894976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std; | |
import web; | |
println("Content-Type: text/html\n"); | |
println("<html><head><title>Cgicc example</title></head>"); | |
println("<body> hello world<p>"); | |
println("Value1=",web.request.params['Value1'],"<p>"); | |
println("Value2=",web.request.params['Value2'],"<p>"); | |
println("Int1=",web.request.params['Int1'].toInteger(),"<p>"); | |
println("Double1=",web.request.params['Double1'].toDouble(),"<p>"); | |
println("</body></html>"); |
Ok, i did.
Using the pedrofaria's sugestion, i modified the web package:
#!/home/pericles/clever/clever -f
import std;
import web;
String value;
value = getCookie("AA");
value+="a";
String name=params("name");
setCookie(name,name);
setCookie("AA",value);
header();
println("<html><head><title>Cgicc example</title></head>");
println("<body> hello world<p>");
println("Cookie=",value,"<p>");
println("Value1=",params("Value1"),"<p>");
println("Value2=",params("Value2"),"<p>");
println("Int1=",params("Int1"),"<p>");
println("Double1=",params("Double1"),"<p>");
println("</body></html>");
Or you can use a more prolix form:
#!/home/pericles/clever/clever -f
import std;
import web;
String value;
value = web.session::getCookie("AA");
value += "a";
String name = web.request::params("name");
web.session::setCookie(name,name);
web.session::setCookie("AA",value);
web.session::header();
println("<html><head><title>Cgicc example</title></head>");
println("<body> hello world<p>");
println("Cookie=", value, "<p>");
println("Value1=", web.request::params("Value1"), "<p>");
println("Value2=", web.request::params("Value2"), "<p>");
println("Int1=", web.request::params("Int1"), "<p>");
println("Double1=", web.request::params("Double1"), "<p>");
println("</body></html>");
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dae teriamos: