NAME
PerlScalar - Encapsulate Perl SCALAR references in JavaScript
DESCRIPTION
The ability to take references to stuff in perl is a basic language feature used by many perl modules. As such, it's important to be able to pass to javascript references to perl scalars and to create in javascript references to scalars.
JAVASCRIPT INTERFACE
Any unblessed SCALAR reference that you pass from perl to javascrip will be wrapped as an instance of PerlScalar
, Blessed ones will be normally a PerlObject.
Contructor
You can construct from javascript new SCALAR references.
- new PerlScalar(somevalue)
-
var ref = new PerlScalar(mystr);
Creates a perl scalar with a copy of somevalue and returns a new reference to it. If you pass this object to perl land it will be undistinguishable from a normal reference.
somevalue
can be any javascript primitive value.
Instance methods
- valueOf
-
var value = ref.valueOf();
Retrive the value from the reference, the returned value will be a javascript primitive.
- toString
-
Returns the perl stringification for the reference. (Subject to change soon).