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. AbigailThread Previous | Thread Next