NAME
PersonName::Format::Compiled - Precompiled CLDR person name formatter
SYNOPSIS
use PersonName::Format;
my $formatter = PersonName::Format->new(
locale => 'en-US',
);
my $compiled = $formatter->compile(
nameLocale => 'ja-JP',
nameScript => 'Jpan',
);
my $string = $compiled->format(
{
given => '太郎',
surname => '山田',
}
);
DESCRIPTION
This class represents a precompiled formatter created by "compile" in PersonName::Format.
Compiling a formatter freezes all context-resolution steps that depend only on the formatter configuration and the name characteristics: the formatting locale, the name locale, the script, the preferred name order, the selected CLDR pattern group, the space replacement rules, and the field modifier resolver.
The final CLDR pattern is still selected for each individual name, since CLDR chooses the best pattern according to the fields actually present in that name.
Compiled formatters are intended for high-throughput applications that format many names sharing the same locale and script characteristics.
Objects of this class are created by "compile" in PersonName::Format and should not normally be instantiated directly.
METHODS
format
my $string = $compiled->format( $name );
Formats a name and returns the resulting string.
This method behaves identically to "format" in PersonName::Format, but avoids repeating the context derivation performed during normal formatting.
format_to_parts
my $parts = $compiled->format_to_parts( $name );
my $parts = $compiled->format_to_parts( $name );
Formats a name and returns an array reference describing the generated parts.
The returned structure is identical to that returned by "format_to_parts" in PersonName::Format.
formatToParts
This is an alias for "format_to_parts"
The returned structure is identical to that returned by "formatToParts" in PersonName::Format.
resolvedOptions
my $options = $compiled->resolvedOptions;
# or
my $options = $compiled->resolved_options;
Returns a hash reference describing the effective formatting options frozen into this compiled formatter.
SEE ALSO
PersonName::Format, PersonName::Format::Name, https://www.unicode.org/reports/tr35/tr35-personNames.html
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.