- or download this
my $person = People
->new
...
->email( 'dev@null.com' )
->save;
my $id = $person->get_id;
- or download this
my $person = People->new( $id );
print $person->first_name, ' ', $person->last_name;
- or download this
class People {
// Java constructors have the same name as the class
...
// we can now access an object by id
}
}
- or download this
sub new {
my ($class,$id) = @_;
...
%data = $class->_initialize($id) if $id;
bless \%data, $class;
}
- or download this
# no! If this is mapping to a database, you probably don't
# want them to be able to change the id
$person->id( $id );