Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Are file scoped variables in a module duplicated with each class instantiation?

Reply
Thread Tools

Are file scoped variables in a module duplicated with each class instantiation?

 
 
sln@netherlands.com
Guest
Posts: n/a
 
      12-11-2008
I have a large hash that is file scoped, a lexical in the module.
Have to make quite a few instantiations of the class.
Is the file scoped lexical hash duplicated each time?
I wouldn't think so but does anybody know the quick answer?

Thanks!

sln

 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      12-11-2008
wrote:
> I have a large hash that is file scoped, a lexical in the module.
> Have to make quite a few instantiations of the class.
> Is the file scoped lexical hash duplicated each time?
> I wouldn't think so but does anybody know the quick answer?


Not unless you specifically do something which causes it be
duplicated.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      12-11-2008
In article <>,
<> wrote:

> I have a large hash that is file scoped, a lexical in the module.
> Have to make quite a few instantiations of the class.
> Is the file scoped lexical hash duplicated each time?
> I wouldn't think so but does anybody know the quick answer?


No. There is only one hash. Your file gets read and compiled only once.
There is only one lexical variable with the name of your hash. Any
instance of your class calls the methods that are defined in your class
file. Each of those methods will access the same lexical variable for
your hash. There is only one.

--
Jim Gibson
 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      12-11-2008
Thank you!

sln
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to identify whether a function is module scoped function orstatic method of a class by using its fully qualified name srinivasan srinivas Python 0 07-02-2008 10:32 AM
Module/file-scoped "global" variables? Pavel Smerk Ruby 1 08-03-2006 12:59 PM
Initial values of File scoped and Block level variables Madhav C Programming 27 01-16-2006 03:29 AM
Initial values of File scoped and Block level variables Madhav C Programming 4 01-08-2006 01:44 PM
Viewing variables within process scoped procedures (Modelsim) Mark VHDL 4 11-09-2004 11:13 PM



Advertisments