develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [PATCH for discussion] new feature: clamp %hash

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
July 29, 2001 01:49
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
20010724142124.A535@blackrider
On Mon, Jul 23, 2001 at 07:40:03PM +0200, Abigail wrote:
>      my (%Family, %Given, %DOB, %EmpNum, %Manager);
> 
>      sub Employee::New ($$$) {
>          my $class        = shift;
>          my $lastname     = shift;
>          my $firstname    = shift;
> 
>          my $self         = bless [] => $class;
> 
>          $Family  {$self} = $lastname;
>          $Given   {$self} = $firstname;
>          $DOB     {$self} = undef;
>          $EmpNum  {$self} = undef;
>          $Manager {$self} = undef;
> 
>          $self;
>      }

Okay, now THAT is clever!  

Unfortunately, it makes automated accessor generation a little
tricky... in fact, probably impossible.  You'd have to define your
automation code in the same scope as your class, so you can't simply
subclass off an automator (like Class::Accessor).  And that sucks,
since you now *must* write accessors.  Carpal Tunnel.

But then I guess that's what you pay for total privacy. :(


-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
Jesus hates me.
	http://www.unamerican.com/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About