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

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

Thread Previous | Thread Next
From:
Abigail
Date:
July 30, 2001 11:09
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
20010730180947.28720.qmail@foad.org
On Tue, Jul 24, 2001 at 02:21:24PM -0400, Michael G Schwern wrote:
> 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.

Nah. Just get a good editor. Or a simple Perl program. ;-)

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


If you don't want total privacy, you might as well just use structs.



Abigail

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