package Person;
use strict;

my %default = (NAME=>"Shirley", SEX=>"f", AGE=>26);

# the object constructor
sub new {
        my( $class, %arg ) = @_;
	my $obj      = bless( {}, $class );
	$obj->{NAME} = $arg{NAME} || $default{NAME};
	$obj->{SEX}  = $arg{SEX}  || $default{SEX};
	$obj->{AGE}  = $arg{AGE}  || $default{AGE};
	return $obj;
}

# get/set methods - set the value if given extra arg
sub name {
	my( $self, $value ) = @_;
	$self->{NAME} = $value if defined $value;
	return $self->{NAME};
}

sub sex {
	my( $self, $value ) = @_;
	$self->{SEX} = $value if defined $value;
	return $self->{SEX};
}

sub age {
	my( $self, $value ) = @_;
	$self->{AGE} = $value if defined $value;
	return $self->{AGE};
}

1;
