Struggling with scopes....

Enkidu enkidu at cliffp.com
Sun Dec 22 00:57:48 CST 2002


I'm trying to make a program into a package.......

Sooo, 

I've renamed the .pl to .pm
I've added a package line to the file.
I've converted the "mainline" to a procedure.
I've created a constructor for the package which creates the object
hash.
In the mainline procedure I've stashed the values I need in the
subroutine in the hash,

eg 
my $self = shift ;
my $proximity = $self->{proximity} = "near" ;

and in the "nearness" subroutine

my $self = shift ;
my $proximity = $self->{proximity} ;

and $proximity contains "near".

How the heck do I do it with a %??

How do I stash %mindex or a pointer to it in the object hash, and how
do I access it in the "nearness" subroutine?

I guess I could always var it....... but I should be able to do it the
other way. No doubt the solution is obvious....

Cheers,

Cliff

--  

The Nats held a Party and no one came.



More information about the Wellington-pm mailing list