NAME

PersonName::Format::SimpleName - Simple person-name value object

SYNOPSIS

my $name = PersonName::Format::SimpleName->new(
    nameLocale       => 'en-GB',
    preferredOrder   => 'givenFirst',
    given            => 'John',
    given2           => 'Ronald Reuel',
    'given-informal' => 'Johnny',
    surname          => 'Tolkien',
);

my $modifiers = { informal => 1 };
my $given = $name->get_field_value( 'given', $modifiers );

DESCRIPTION

This class is the standard in-memory implementation of the PersonName::Format::Name contract.

It accepts a hash reference or a flat key/value list. Public input may use CLDR-facing hyphenated names, underscore-separated Perl names, or the documented camelCase convenience aliases. Internally all fields use underscore-separated names.

NAME FIELDS

The following fields correspond directly to the CLDR person-name field identifiers defined in UTS #35 Part 8. All fields are optional; supply only the ones relevant to the name being represented.

title

Honorific prefix such as Dr., Prof., or Mr..

given

Primary given name (first name in most Western cultures).

given2

Additional given name(s), often the middle name or names. When a monogram or initial is requested, each word in this field contributes one initial.

given_informal

Informal or familiar given name, such as Johnny for John. Used when the formatter selects the informal usage variant.

surname

Primary family name. When surname_prefix and surname_core are both absent, the full surname value is used for all surname references.

surname2

Secondary family name, used in cultures where a person has two surnames (for example, in Spanish-speaking countries).

surname_prefix

Surname prefix that sorts separately from the core, such as van in Dutch names or de in French names.

surname_core

The sortable core of the surname, without its prefix.

generation

Generational suffix such as Jr., Sr., or III.

credentials

Post-nominal credentials such as PhD, MD, or CBE.

METHODS

as_hash

Returns a plain hash reference using internal underscore-separated field names.

fields

Returns the supported internal name fields.

get_field_value

Returns a field value and consumes any modifiers that this name object resolves itself from the supplied mutable hash reference.

informal, prefix, and core are handled by this class. Modifiers left in the hash are intended to be applied by the formatter.

has_field

Returns true when the requested field exists and is defined.

name_locale

Gets or sets the name locale as a Locale::Unicode object.

preferred_order

Gets or sets givenFirst or surnameFirst.

AUTHOR

Jacques Deguest <jack@deguest.jp>

COPYRIGHT & LICENSE

Copyright(c) 2026 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.