W3C home > Mailing lists > Public > www-validator@w3.org > May 2006

Re: Command Line

From: Chuck Houpt <chuck@habilis.net>
Date: Fri, 26 May 2006 08:52:54 -0400
Message-Id: <a06200702c09caa385aa6@[]>
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.

   weblet      (wrapper script)
      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:


set -eu

export QUERY_STRING="$1"

# Complete the query string if only passed an URL.
if [ ${QUERY_STRING##uri=} == ${QUERY_STRING} ]

WEBLETDIR="`dirname "$0"`"

# Setup for OpenSP

# Setup for validator
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 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 REMOTE_ADDR=''
export SCRIPT_URL='/check'
export SERVER_ADDR=''
export DOCUMENT_ROOT='/'
export HTTP_HOST='validator.w3.org'

perl -T -I"$VDIR"/lib -I"$VDIR"/lib/darwin-thread-multi-2level 
Received on Friday, 26 May 2006 12:53:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:48 UTC