The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JE::LValue - JavaScript lvalue class

SYNOPSIS

  use JE::LValue;

  $lv = new JE::LValue $some_obj, 'property_name';

  $lv->get;         # get property
  $lv->set($value)  # set property

  $lv->some_other_method  # same as $lv->get->some_other_method

DESCRIPTION

This class implements JavaScript lvalues (called "Reference Types" by the ECMAScript specification).

METHODS AND OVERLOADING

If a method is called that is not listed here, it will be passed to the property referenced by the lvalue. (See the last item in the SYNOPSIS, above.) For this reason, you should never call UNIVERSAL::can on a JE::LValue, but, rather, call it as a method ($lv->can(...)), unless you really know what you are doing.

To do: Implement the can method, since it doesn't exist yet.

Similarly, if you try to use an overloaded operator, it will be passed on to the object that the lvalue references, such that !$lvalue is the same as calling !$lvalue-get>. Note, however, that this does not apply to the iterator (<>) operator, the scalar dereference op (${}) and the special copy operator (=).

$lv = new JE::LValue $obj, $property

Creates an lvalue/reference with $obj as the base object and $property as the property name.

$lv->get

Gets the value of the property.

$lv->set($value)

Sets the property to $value and returns $lv.

$lv->call(@args)

If the property is a function, this calls the function with the base object as the 'this' value.

$lv->base

Returns the base object.

$lv->property

Returns the property name.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 142:

=over without closing =back