WebL Interactive

Compaq's Web Language (abbreviated as WebL) is a scripting language for automating tasks on the World-Wide Web. It is an imperative, interpreted language that has built-in support for common web protocols like HTTP and FTP, and popular data types like HTML and XML.  I highly recommend this language for all tasks that involve simple scripting, scraping, form filling, or data accessing from the Web.

WebL's home page is located at:  http://www.compaq.com/webl. Here you can find documentation, videos, mailing archives and downloads. 

WebL Interactive is a WebL interpreter written in WebL that enables fast, iterative development of WebL programs and scripts. WebL Interactive lets you load in a URL or WebL source file and play with it: testing functions, performing queries on the URL, etc. The interactive process is much faster than the alternative, namely lots of PrintLn's in code.

It's written in WebL, so here's how to run it, along with a sample interaction to give you the idea.


C:> java -jar WebL.jar interact.webl 


WebL Interactive, v1.0 
by Adam Cheyer (acheyer@verticalnet.com) 
Type help for instructions. 

WEBL 1> 
loadUrl("http://sine.ni.com/apps/we/nioc.vp?lang=US&pc=bypl&cid=1000") 
Loading URL http://sine.ni.com/apps/we/nioc.vp?lang=US&pc=bypl&cid=1000... 
Loaded URL into variable P. 
OK. 

WEBL 2> A = Elem(P, "a") 
A = Elem(P, "a") 

WEBL 3> Size(A) 
34 

WEBL 4> Pt = Pat(P, "Software") 
Pt = Pat(P, "Software") 

WEBL 5> Size(A contain Pt) 
3 

WEBL 6> history 
2: A = Elem(P, "a") 
3: Size(A) 
4: Pt = Pat(P, "Software") 
5: Size(A contain Pt) 
6: history 
OK. 

WEBL 7> help 

Type a WebL expression and see it's evaluated results (no need for PrintLn) 

Special additions to WebL: 
  - variables do NOT need to be predefined 
      (e.g. can do X = 1 without first defining var X 
  - imports do NOT need to be predefined for commands 
      (e.g. can use Str_Search() without first importing Str 

Interpreter Commands: 
  - loadUrl(URL) Loads URL and saves it to variable P (and cache) 
      Use this when possible instead of P = GetURL(URL) as is more 
      efficient in this interpreter (see release notes) 
  - loadUrl Fetches last page P from cache (doesn't access web) 
      Cache persists even after quitting interpreter in file "cache.html" 
  - loadWebL(FILE) Loads a webl file into memory (one only, overwrites last) 
  - loadWebL Reloads last webl file 
  - clear Clears session: var defs, loaded file and loaded url 
  - history Prints command history 
  - vars See current vars and their values 
  - !! Repeat last command 
  - ! Repeats a command in saved history 
  - release Prints release notes (known bugs etc) 
  - help Prints this message 
  - exit, quit Quits interpreter 

OK. 

Download


Adam Cheyer, March 1, 2001