Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: do, local and a qualified identifier?

by ewilhelm (Novice)
on Oct 09, 2005 at 23:23 UTC ( [id://498645]=note: print w/replies, xml ) Need Help??


in reply to Re^2: do, local and a qualified identifier?
in thread do, local and a qualified identifier?

>>Later on init gets called from the main script.
>>After that, what is the value of $Foo::bar in the main script and why?

>...explicitly...no bearing on the answer

It does, just that the wrong question was asked. Note that your response (bullet point 4) compiles into the same neuroncode as mine.

Your new example has reframed the problem into use() of a module, where the original question was about do() and it also also calls init() not from the main script, but from the module (where the local($Foo::bar) happens to be in effect.) The OP states that init() gets called from the main script. True, if the file getting do()ne calls init(), something similar to what you demo will happen.

The point that I was trying to make is that the local() had absolutely no impact on what happens inside of init(), so the value of $Foo::bar follows the same rules that it would if the local() statement never existed.

If the OP's actual code is truly like the sample, then this is simply a case of assuming that an artifact of accident or ignorance is is somehow attributable to design. I opted not to reimplement the documentation of do, our, local, perlsyn, and perlvar under the assumption that the OP was in possesion of said fine documentation. In this case, the simple answer that it is probably an onion in the varnish (while that varnish may, as ysth suggests, belong to perl) seems sufficient to inspire the OP with the required curiosity.

  • Comment on Re^3: do, local and a qualified identifier?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://498645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found