> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Sender: [EMAIL PROTECTED] > From: Simon Cozens <[EMAIL PROTECTED]> > Date: 06 Dec 2002 14:54:43 +0000 > Organization: Bethnal Green is PEOPLE! > X-Posted-By: 217.204.174.162 > > > Is it clear how attributes accessors on objects are going to work yet? > I need to say something along the lines of: > > sub new { > my $class = shift; > my ($name, $age) = @_; > bless { > name => $name, > age => $age > }, $class; > } > > sub age { my $self=shift; $self->{age} } >
There's nothing decided on how constructors work yet, so I'll use a fill-in syntax. class Person { has $.name is private; # No accessor generated has $.age; method new($n, $a) { ($.name, $.age) = ($n, $a); return bless; # bless me => myself } }