Skip to content

Instantly share code, notes, and snippets.

@pedrofaria
Created February 23, 2012 20:52
Show Gist options
  • Save pedrofaria/1894976 to your computer and use it in GitHub Desktop.
Save pedrofaria/1894976 to your computer and use it in GitHub Desktop.
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>");
@gogo40
Copy link

gogo40 commented Feb 23, 2012

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>");

@gogo40
Copy link

gogo40 commented Feb 23, 2012

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