GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
JE::Scope(3) User Contributed Perl Documentation JE::Scope(3)

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.)

find_var($name, $value)
find_var($name)
This method searches through the scope chain, starting at the end of the array, until it finds the variable named by the first argument. If the second argument is present, it sets the variable. It then returns an lvalue (a JE::LValue object) that references the variable.
new_var($name, $value)
new_var($name)
This method creates (and optionally sets the value of) a new variable in the variable object (the same thing that JavaScript's "var" keyword does) and returns an lvalue.

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.

JE
JE::LValue
JE::Object::Function
2014-10-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.