문제

Could someone provide me a simple expample of a clisp script, that uses

  • CGI
  • /usr/local/bin/clisp
  • CL-WHO or equivalent?

My installation is consisting of apache2, clisp and quicklisp.

Thanks in advance!

도움이 되었습니까?

해결책

Quicklisp is a good choice. Then it doesn't matter if you use clisp, sbcl or ccl as an implementation.

Run this in the shell:

wget http://beta.quicklisp.org/quicklisp.lisp
clisp

Run this in the Lisp:

(load "quicklisp.lisp")
(quicklisp-quickstart:install)
(ql:add-to-init-file)
(ql:quickload "cl-who")
(defpackage :webmaker
  (:use :cl :cl-who))
(in-package :webmaker)
(with-html-output (*standard-output* nil :prologue t)
    (:html (:body "Not much there"))
    (values))

Output:

[...]
;;  Loaded file /home/xxx/quicklisp/setup.lisp
;; Loaded file /home/xxx/.clisprc.lisp
[1]> (ql:quickload "cl-who")
To load "cl-who":
  Load 1 ASDF system:
    cl-who
; Loading "cl-who"

("cl-who")
[2]> (defpackage :webmaker
  (:use :cl :cl-who))
#<PACKAGE WEBMAKER>
[3]> (in-package :webmaker)
#<PACKAGE WEBMAKER>
WEBMAKER[4]> 
(with-html-output (*standard-output* nil :prologue t)
    (:html (:body "Not much there"))
    (values))
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body>Not much there</body></html>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top