- From: Chuck Houpt <chuck@habilis.net>
- Date: Fri, 26 May 2006 08:52:54 -0400
- To: <www-validator@w3.org>
>I'm looking to run the validator script from the command line(in >Linux), and no matter what I try I cannot get the script to find a >doctype, and I always have to set the charset manually(that's not >really the problem, all our documents are utf-8). > >So I'm wondering if anyone has ever successfully run the script from >a command line, and if you did get that working, how did you do it? I've been able to run the validator from the command line. I don't think I've encountered the problem you describe, but maybe it would be helpful to compare your setup with mine. I'm running the script on Mac OS X with a relocatable setup (part of the stand-alone Validatelet application http://habilis.net/validatelet/), but it should translate easily to Linux and a fixed-root setup. I run the validator with a wrapper script named 'weblet' (see listing below). Weblet sets up all the environment variable to simulate a CGI call, then calls the Validator's check script. Weblet runs the Validator from a sister directory called 'validator'. The Validator, supporting Perl libraries, and OpenSP are all installed in the validator directory. relocatable-dir/ weblet (wrapper script) validator/ bin/ (OpenSP binary) lib/ (OpenSP libraries, Perl Libraries) share/ (OpenSP data files and Validator templates) htdocs/ (Validator HTML docs and configuration) httpd/ (Validator CGI script) For relocatability, the weblet script sets PATH, DYLD_LIBRARY_PATH (LD_LIBRARY_PATH for Linux), W3C_VALIDATOR_HOME/CFG and passes some Perl -I library arguments. These could mostly be ignored on a fixed root setup. Hope this helps - Chuck ------------------------------------- weblet script: #!/bin/bash set -eu export QUERY_STRING="$1" # Complete the query string if only passed an URL. if [ ${QUERY_STRING##uri=} == ${QUERY_STRING} ] then QUERY_STRING="uri=$QUERY_STRING" fi WEBLETDIR="`dirname "$0"`" VDIR="$WEBLETDIR"/validator # Setup for OpenSP PATH="$VDIR"/bin:$PATH export DYLD_LIBRARY_PATH="$VDIR"/lib # Setup for validator export W3C_VALIDATOR_HOME="$VDIR" export W3C_VALIDATOR_CFG="$W3C_VALIDATOR_HOME"/htdocs/config/validator.conf # Standard CGI variables, probably many are unnecessary. export SCRIPT_NAME='/check' export SERVER_NAME='validator.w3.org' export SERVER_ADMIN='[no address given]' export HTTP_ACCEPT_ENCODING='gzip, deflate' export HTTP_CONNECTION='keep-alive' export REQUEST_METHOD='GET' export SCRIPT_URI='http://validator.w3.org/check' export HTTP_ACCEPT='*/*' export SCRIPT_FILENAME='/check' export SERVER_SOFTWARE='Apache/1.3.33 (Darwin)' export HTTP_USER_AGENT='Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.9.2' export REMOTE_PORT='49478' export SERVER_SIGNATURE='Apache/1.3.33 Server at neptune.local Port 80' export SERVER_PORT='80' export HTTP_ACCEPT_LANGUAGE='en' export REMOTE_ADDR='127.0.0.1' export SERVER_PROTOCOL='HTTP/1.1' export GATEWAY_INTERFACE='CGI/1.1' export SCRIPT_URL='/check' export SERVER_ADDR='127.0.0.1' export DOCUMENT_ROOT='/' export HTTP_HOST='validator.w3.org' perl -T -I"$VDIR"/lib -I"$VDIR"/lib/darwin-thread-multi-2level "$VDIR"/httpd/cgi-bin/check
Received on Friday, 26 May 2006 12:53:18 UTC