develooper Front page | perl.perl5.porters | Postings from March 2011

Re: Revising Perl's OO docs - a new OO tutorial

Thread Previous | Thread Next
Steffen Mueller
March 8, 2011 11:02
Re: Revising Perl's OO docs - a new OO tutorial
Message ID:
On 03/07/2011 10:45 PM, Jan Dubois wrote:
> You could also just use hash syntax for your attribute accessors,
> and implement your object using a tied hash.  People seem to assume
> that exposing attributes as hash elements somehow "leak" your
> implementation, but that simply isn't true.  E.g. Win32::OLE
> uses this mechanism to expose property accessors to the underlying
> COM objects:


> You actually need 2 hashes per object for this though, one for the
> externally visible tied interface, and one to store the internal
> object data.

I just encountered such an interface at work in conjunction with 
inside-out objects to expose the IOOs as hashref-alikes.

This must be the single most horrible API in Perl ever. It abuses tie. 
It pretends to be a hash when it is not for no good reason. It can 
return lists from $obj->{foo}. But worst of all: It requires programmers 
to think hard about whether they're violating encapsulation or not! 
Please. Make it stop.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About