JE, version 0.018

JE is a pure-Perl ECMAScript (JavaScript) engine. Here are some of its
advantages:

    - Easy to install (no C compiler necessary)
    - Compatible with Data::Dump::Streamer, so the runtime environment
      can be serialised
    - The parser can be extended/customised to support extra (or
      fewer) language features (not yet complete)
    - All JavaScript datatypes can be manipulated directly from Perl
      (they all have overloaded operators)

Here are its main weakness:
    - It's slow (well, what did you expect?).
    - It uses lots of memory.
    - It leaks memory (to be fixed).

This is still an alpha release. The core objects are not yet complete,
but as long as you don't need dates or methods of regular expressions,
this module is actually usable.

If  you have the time and the interest,  please experiment  with  this
module (or maybe even lend a hand :-). If you have any ideas as to how
the API could be improved or reworked, please e-mail me.


CHANGES IN THIS RELEASE

I've improved the documentation a little. I have plans for some API
changes (see JE::Types).

JE's bind_class method now allows one to bind classes that have hash
or array deref overloading, like this:

    $je->bind_class( name => '...', hash => 1 );

It also allows you to specify the return type of methods and proper-
ties, like this:

    $je->bind_class( name => '...',
                     methods => [qw/ foo:String bar:Number /] );

Properties registered with bind_class can now be inherited by sub-
classes that are also registered with bind_class, as long as 'isa =>'
is given a class name (not a prototype object).

If you don't specify 'to_primitive'  et al.  when you call bind_class,
JE will now check to see whether the object has string/number/boolean
overloading, and will use that. If it doesn't, it continues to do the
default JS thing (use the valueOf and toString methods).


TO DO

- Solve the problem of scalar leak warnings in perl 5.8.8 that occur
  with certain JS syntax errors (perl 5.9.5 is fine) (I may have fixed
  this; I can't reproduce it now)
- Make the parser extensible/customisable
- Finish the core object classes
- Add more helpful error messages
- Determine some logical way of dealing with locale settings (for
  String.prototype.localeCompare, et al.)
- Write lots and lots and lots of tests, at the same time fixing all
  the bugs they bring to light.
- Make tainted JS code run safely
- Deal with circular references
- Autoload built-in JS properties
- Optimise JS functions by turning them into Perl subs (but run bench-
  marks first to see whether this would actually speed things up) (I'm
  having second thoughts about this one)


INSTALLATION

The easiest way to install this module is to use the CPAN module or
the cpan script:

    [sudo] perl -MCPAN -e "install JE"

    [sudo] cpan
    cpan> install JE

Or you can use the following:

    perl Makefile.PL
    make
    make test
    [sudo] make install


DEPENDENCIES

This module requires perl 5.8.3 or later.

For perl versions earlier than 5.9.4 it requires Tie::RefHash::Weak.

Later it will probably require Unicode::Collate and Date::Parse.


DOCUMENTATION

After installing, you can find documentation for this module with the 
perldoc command.

    perldoc JE

Or try using man (it's faster, in my experience):

    man JE


ACKNOWLEDGEMENTS

Thanks to Max Maischein [ webmaster  corion net ] for letting me use
his tests,

to Andy Armstrong [ andy        hexten net ] and
   Yair Lenga     [ yair lenga  gmail com  ] for their suggestions,

and to the CPAN Testers for their helpful bug reports.


COPYRIGHT AND LICENCE

Copyright (C) 2007 Father Chrysostomos

This program is free software; you may redistribute it and/or modify
it under the same terms as perl.
