Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: symbol tables and class data members

by stephen (Priest)
on May 06, 2002 at 18:32 UTC ( #164404=note: print w/replies, xml ) Need Help??


in reply to symbol tables and class data members

You must qualify @aa because it's a package variable, and under 'use strict' you must qualify all package variables. If something is in the symbol table, it must be fully-qualified under strict unless you've declared it with 'our'. (Or use vars if you're not on the latest Perl.)

It seems to me that what you want is a way of doing symbol-table hacking with lexical vars, and I'm afraid that that's not possible because lexical vars don't appear in the symbol table.

I'd suggest declaring your vars with 'our'.

stephen

  • Comment on Re: symbol tables and class data members

Replies are listed 'Best First'.
Re: Re: symbol tables and class data members
by amazotron (Novice) on May 06, 2002 at 18:39 UTC
    I guess I should explain that the package Foo is functioning as a class and Test as a method of that class. I was trying to find an easy way of converting existing package-oriented code into class-based code. That is, move globals to be data members and not have to struggle rewriting all the uses of those globals.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://164404]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2016-12-04 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (61 votes). Check out past polls.