[ home | me | » projects« | links ] @ 

WebL-Perl bridge

 [ WebL - Perl bridge ]
You can download the latest distribution of the WebL - Perl bridge here.

 [ WebL ]
Some links for the WebL language:

NAME

WebL - The WebL-Perl bridge


SYNOPSIS

        use WebL;
        my $webl = new WebL     (
                        -baseURL => 'http://127.0.0.1:8081/servlet/webl',
                        -execURL => 'worker_eval',
                        -cacheTIME => 9000,
                        -cacheDIR => '/tmp/webl/cache';
                                );

        # We can exec a piece of WebL code
        my $webl_source=<<EOT;
                var P = GetURL("http://www.vandenbrande.com";);
                Text(P);
        EOT
        my $http_response = $webl->exec( $webl_source );
        print $http_response->content;  

        # We can access a WebL script that runs as a servlet, or that has 
        # some webserver functionality
        my $http_response = $webl->get("scriptname_function", "cachefilename", [ param1 => $value1 ]);
        my $obj = eval( $webl->perlit( $http_response->content ) );


DESCRIPTION

With the WebL-Perl bridge it is possible to access WebL scripts from Perl. The idea is having a WebL script running either as a servlet, or as a webserver. We can now pass a piece of WebL script to the servlet, for evaluation with the eval function. Or we can access functions in the WebL script. The script returns a WebL structure back to Perl, which will be converted into a Perl object.

You can find some examples in the distribution, in the directory samples.


INSTALL

You will need to get WebL from <http://www.research.digital.com/SRC/WebL>. Please follow the install guide in the distribution (.pdf). Then configure your servlet engine, so you can access a webl script in a servlet environment (an example is included in the WebL docs). Copy the both example WebL scripts (worker.webl and example.webl) into the WebL scripts directory, configured in the servlet properties (webl.path). Now you should be able to run the test scripts.


TODO


CACHING

Implement a better caching scheme. Something like sending through the HTTP headers from the original page to Perl (if necessary).


STANDALONE WEBL WORKER

Now, you will have to run webl in a servlet environment. But is also possible to use WebL webservers for running this bridge. So, I should make a standalone example for the worker.webl and an example webl script that uses the same principle.


INTERFACE

I think it is better to move the 'perlit' to a subclass of type WebLObject. So we can have WeblObject::asText, WeblObject::asPerlText, WeblObject::asPerlObject, or something like this.


AUTHOR

Johan Van den Brande
johan@vandenbrande.com
http://www.vandenbrande.com


SEE ALSO

http://www.webl.org
http://www.research.digital.com/SRC/WebL

(c) 1999-2000 vandenbrande.com