If you are tired typing "my $self = shift;"
There are modules out there that can build class for you.
http://search.cpan.org/search?query=Class%3A%3AStruct&mode=module

I'm using Class::Struct module coming with perl.

José.
-----Original Message-----
From: Kevin Pfeiffer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 18, 2003 11:03 PM
To: [EMAIL PROTECTED]
Subject: RE: instance variables?


In article <[EMAIL PROTECTED]>, Rob Hanson wrote:

>> But I'm wondering if there is another way
>> (like the Java "private variable") to say
>> "all class variables declared here are unique
>> to each instance"?
> 
> It sounds like you are trying to link how OO-Perl works with 
> OO-Java... and that is only going to make your head spin.  What you 
> really need to do is understand what bless really does, and that 
> OO-Perl isn't really OO in the usual sense (but it works like it is).
[...]

> Now when you talk about instance variables, realize that there is no 
> true object instance in Perl.  It is just a reference tagged with a 
> "type"... the rest is all smoke and mirrors.
> 
> So to emulate instance variables you can use a hash reference instead 
> of a scalar reference, like this:

And this actually works quite fine I think...

> I hope that helps a little.
> 
> Rob

Thanks, that helped a lot! (Thank you also to others who responded.)

Meanwhile my "naive ticketMachine" is chugging along. And I like doing the Perl 
version of something else; it's good practice for me (though I'm getting tired of 
typing "my $self = shift;").  ;-)

-K

-- 
Kevin Pfeiffer
International University Bremen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to