#!/usr/physics/gauche/bin/gosh (use www.cgi) (use www.fastcgi) (use text.html-lite) (use text.csv) (use srfi-13) (use srfi-19) (define DATADIR "/some-directory") (define (generate-filename) (let ((d (current-date))) (format "~a/~a~a~a~a~a~a.csv" DATADIR (date-year d) (date-month d) (date-day d) (date-hour d) (date-minute d) (date-second d) ) ) ) (define (send-params params) (sys-system "echo \"REU Application Submitted\" | mail some-email-address") (let ((csv-proc (make-csv-writer ",")) (vl (map (lambda (p) (cadr p)) params))) (call-with-output-file (generate-filename) (lambda (p) (csv-proc p (cons (date->string (current-date)) vl)) ) ) ) ) (define (body params) (send-params params) `(,(cgi-header) ,(html-doctype) ,(html:html (html:head (html:title "REU Application 2006")) (html:body (html:h1 "REU Application 2006") (html:p "Thank you for your cooperation, citizen.") ) ) ) ) (define (main args) (with-fastcgi (cut cgi-main body)) 0 )