in reply to Heresy

Like the doc said, the "dot thing" is covered in RFC 222.

As for wanting to be able to say $self.x1, I have to disagree, because it breaks the whole data-abstraction idea. Objects may very well be implemented with hash-refs 95% of the time, but they need not be. An object may just as well be implemented through a tie.

And saying $self->{'x1'} is bad form, btw. Your class should provide accessor functions to object-variables. Never allow direct access. Or so the object-orientation fairies tell me...

ar0n ]

Replies are listed 'Best First'.
Re: (ar0n) Re: Heresy
by merlyn (Sage) on May 08, 2001 at 18:48 UTC
    You can enforce this rather trivially too. "The Damian"'s book shows how to let the return value from a constructor simply be a blessed scalar that is used as a hash key to a lexical hash -- the value of which is the real object! So there's never a chance that anyone outside the file could ever get at the guts of the object, at the cost of one small indirection during the first step of the call. You want privacy, you can have it!

    -- Randal L. Schwartz, Perl hacker