in reply to Re: Acessing an object's variable
in thread Acessing an object's variable

This is very good! Thanks a lot for your reply. I just realized that each call to setname() reset the $name value causing it to keep only the last one. I didnt know about refaddr by the way. So the code you wrote ties values to a hash with the refaddr as the key. This is very nice but it is not what i would call object orientation really. I have been writing in java for the past few years so this looks to me more like hack than an OO solution. Is this the best way to do what i originally intended to? (i find it a bit hard to fully understand perlboot/toot) Again thanks very much

Replies are listed 'Best First'.
Re^3: Acessing an object's variable
by Perl Mouse (Chaplain) on Dec 13, 2005 at 11:49 UTC
    Perl OO is a hack. As Larry has said, it was an exercise in minimalism - it proves that you can do OO with extremely little support from the language.

    That's why OO in perl6 will look quite different - it has solved the problem of needing hacks to have objects with data.

    I'm afraid that as long as you hava a Java mindset (nothing wrong with that), Perl OO will remain a major disappointment to you. And I can't disagree with you - I don't like Java, but I vastly prefer its OO system over Perls'.

    Perl --((8:>*

      I'm afraid that as long as you hava a Java mindset (nothing wrong with that), Perl OO will remain a major disappointment to you.

      I always just figured I'd just plod along and use Perl5's hash-based objects until Perl6 really arrives, then happily switch over and use whatever OO-support Perl6 provides.

        If that works for you, then you should do that. Perl6 has been taking a bit too long for my annoyances with OO though.
        Perl --((8:>*