JE::Scope(3pm) | User Contributed Perl Documentation | JE::Scope(3pm) |
JE::Scope - JavaScript scope chain (what makes closures work)
JavaScript code runs within an execution context which has a scope chain associated with it. This class implements this scope chain. When a variable is accessed the objects in the scope chain are searched till the variable is found.
A JE::Scope object can also be used as global (JE) object. Any methods it does not understand will be delegated to the object at the bottom of the stack (the far end of the chain), so that "$scope->null" means the same thing as "$scope->[0]->null".
Objects of this class consist of a reference to an array, the elements of which are the objects in the chain (the first element being the global object). (Think of it as a stack.)
The variable object is the first object in the scope chain (searching from the top of the stack) that is a call object, or "$scope->[0]" if no call object is found.
None. Just bless an array reference. You should not need to do this because it is done for you by the "JE" and "JE::Object::Function" classes.
2022-11-19 | perl v5.36.0 |