NAME
Myco::Core::Person - Myco Person objects.
- Release
-
1.0
SYNOPSIS
use Myco;
# Constructors. See Myco::Entity for more.
my $p = Myco::Core::Person->new;
# Name.
my $last = $p->get_last;
$p = $p->set_last($last);
my $first = $p->get_first;
$p = $p->set_first($first);
my $middle = $p->get_middle;
$p = $p->set_middle($middle);
my $prefix = $p->get_prefix;
$p = $p->set_prefix($prefix);
my $suffix = $p->get_suffix;
$p = $p->set_suffix($suffix);
my $nick = $p->get_nick;
$p = $p->set_nick($nick);
# Vital Stats.
my $gender = $p->get_gender;
$p = $p->set_gender($gender);
my $birthdate = $p->get_birthdate;
$p = $p->set_birthdate($birthdate);
# Added instance methods.
my $format = "%p% f% M% l%, s";
my $name = $p->strfname($format);
my $uidf = $p->get_unique_id_fmt;
# Persistence methods.
$p->save;
$p->destroy;
DESCRIPTION
This class represents what may well be the central object of any Myco-based application: the Person. Myco::Core::Person provides the absolute bare bones skeleton of what most applications will need in a person object.
COMMON ENTITY INTERFACE
Constructor, accessors, and other methods -- as inherited from Myco::Entity.
ATTRIBUTES
Attributes may be initially set during object construction (with new()
) but otherwise should be accessed solely through accessor methods. Typical usage:
Set attribute value
$p->set_attribute($value);
Check functions (see Class::Tangram) perform data validation. If there is any concern that the set method might be called with invalid data then the call should be wrapped in an
eval
block to catch exceptions that would result.Get attribute value
$value = $p->get_attribute;
A listing of available attributes follows:
last
type: string(64) required: not empty
The person's last name.
first
type: string(64)
The person's first name.
middle
type: string(64)
The person's middle name.
prefix
type: string(32)
The prefix to the person's name.
suffix
type: string(32)
The suffix to the person's name.
nick
type: string(64)
The person's nick name.
birthdate
type: rawdate
The person's birthday.
ADDED CLASS / INSTANCE METHODS
strfname
my $format = "%p% f% M% l%, s";
my $name = $person->strfname($format);
This method allows the parts of the person's name to be formatted according to the strfname formatting template syntax. See Lingua::Strfname for the details of the formatting syntax. Note that the only difference here is that the "first extra name" is always the person's nick name. Thus, the formatting characters are as follows:
%l Last Name
%f First Name
%m Middle Name
%p Prefix
%s Suffix
%a Nick Name
%L Last Name Initial with period
%F First Name Initial with period
%M Middle Name Initial with period
%A Nick Name Initial with period
%T Last Name Initial
%S First Name Initial
%I Middle Name Initial
%1 Nick Name Initial
LICENSE AND COPYRIGHT
Copyright (c) 2006 the myco project. All rights reserved. This software is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHORS
Charles Owens <charles@mycohq.com>, David Wheeler <david@wheeler.net>, and Ben Sommer <ben@mycohq.com>
SEE ALSO
"person.t" in t, Myco::Entity, Myco, Tangram, Class::Tangram,
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 13:
'=item' outside of any '=over'
- Around line 21:
You forgot a '=back' before '=head1'