User::Identity(3)
π User::Identity β the manual, but make it a group chat π
Okay bestie, so this is User::Identity(3) from the User Contributed Perl Documentation set β it's the module that keeps track of info about a whole entire physical human person. Not a login, not an account, a human. Iconic concept, honestly. π«Ά
β¨ NAME β¨
User::Identity β maintain info about a physical person π§
πΈ INHERITANCE πΈ
User::Identity
is a User::Identity::Item
π¦ SYNOPSIS π¦
use User::Identity;
my $me = User::Identity->new(
'john',
firstname => 'John',
surname => 'Doe'
);
print $me->fullName # prints "John Doe"
print $me; # same
π DESCRIPTION π
So the User-Identity distribution exists to maintain a whole little set of informational objects that are all related to one single user. And User::Identity itself is trying to be smart about it β it gives you defaults, it does conversions, and it handles the combos people keep asking for. Lowkey a service. β¨
β οΈ Real talk: this module, versions 4.0 and up, is not fully compatible with older releases β mainly the exception handling changed. So if you're upgrading, please go read the wiki <https://github.com/markov2/perl5-Mail-Box/wiki/>. Version 3 is still maintained and may see new releases as well. No cap, go read it. π
The identities do not implement any kind of storage, which means you can create them from literally any simple or complex Perl program you want. And that's the whole point β it's more flexible than an XML file for storing the data. Like, you can decide to store the data with Data::Dumper, Storable, DBI, AddressBook, or whatever you feel like. Extensions to simplify this task are still to be developed. (Somebody get on that bestie π)
If you need more kinds of user information, then please contact the module author. They wanna know. π
Extends "DESCRIPTION" in User::Identity::Item.
π OVERLOADED π
- overload:
""stringification β when aUser::Identitygets used as a string, it is automatically translated into thefullName()of the user involved. The way that just works. π«
Β» example:
my $me = User::Identity->new(...)
print $me; # same as print $me->fullName
print "I am $me\n"; # also stringification
π₯ METHODS π₯
Extends "METHODS" in User::Identity::Item.
π Constructors
Extends "Constructors" in User::Identity::Item.
$class->new( [$name], %options )β creates a brand new user identity, which will contain all the data related to a single physical human being. Most user data can only be specified at object construction, because it should never change. A$namemay be specified as the first argument, but also as an option β one way or the other is required, bestie. No name, no identity. π«
-Option --Defined in --Default
birth undef
charset $ENV{LC_CTYPE}
courtesy undef
description User::Identity::Item undef
firstname undef
formal_name undef
full_name undef
gender undef
initials undef
language 'en'
name User::Identity::Item <required>
nickname undef
parent User::Identity::Item undef
prefix undef
surname undef
titles undef
Here's every single one of them, spelled out, no skipping:
birth => DATEcharset => STRINGcourtesy => STRINGdescription => STRINGfirstname => STRINGformal_name => STRINGfull_name => STRINGgender => STRINGinitials => STRINGlanguage => STRINGname => STRINGnickname => STRINGparent => OBJECTprefix => STRINGsurname => STRINGtitles => STRING
π Attributes
Extends "Attributes" in User::Identity::Item.
$obj->age()β calculated from the date of birth to the current moment, as an integer. And on the birthday, the number is incremented already. π (yes, you get the new number on the day, not after)$obj->birth()β returns the date in standardized format:YYYYMMDD, easy to sort and select. This may returnundef, even if thedateOfBirth()contains a value, simply because the format is not understood. Month or day may contain'00'to indicate that those values are not known. π$obj->charset()β the user's preferred character set, which defaults to the value of theLC_CTYPEenvironment variable.$obj->courtesy()β the courtesy is used to address people in a very formal way. Values are like"Mr.","Mrs.","Sir","Frau","Heer","de heer","mevrouw". This often provides a way to find the gender of someone addressed. π©$obj->dateOfBirth()β returns the date of birth, as specified during instantiation.$obj->description()β inherited, see "Attributes" in User::Identity::Item$obj->firstname()β returns the first name of the user. If it is not defined explicitly, it is derived from the nickname, and then capitalized if needed. π$obj->formalName()β returns a formal name for the user. If not defined as an instantiation parameter (seenew()), it is constructed from other available information, which may result in an incorrect or an incomplete name. The result is built from"courtesy initials prefix surname title". So yeah β sometimes it's giving perfect, sometimes it's giving mystery. π$obj->fullName()β if this is not specified as a value during object construction, it is guessed based on other known values like"firstname prefix surname". If a surname is provided without a firstname, the nickname is taken as firstname. When a firstname is provided without a surname, the nickname is taken as surname. And if both are not provided, then the nickname is used as fullname. It's doing its best fr fr. π«Ά$obj->gender()β returns the specified gender of the person, as specified during instantiation, which could be like'Male','m','homme','man'. There is no smart behavior on this one: the exact specified value is returned. The methodsisMale(),isFemale(), andcourtesy()are the smart ones.$obj->initials()β the initials, which may be derived from the first letters of the firstname. π€$obj->isFemale()β seeisMale(): returns"true"if we are sure the user is a woman.$obj->isMale()β returns"true"if we are sure that the user is male. This is specified as gender at instantiation, or derived from the courtesy value. MethodsisMaleandisFemaleare not complementatory: they can both return"false"for the same user, in which case the gender is undetermined. Yeah. Both false. That's allowed. π$obj->language()β can contain a list or a single language name, as defined by the RFC. Examples are'en','en-GB','nl-BE'. The default language is'en'(English). π¬π§$obj->name( [$newname] )β inherited, see "Attributes" in User::Identity::Item$obj->nickname()β returns the user's nickname, which could be used as username, e-mail alias, or such. When no nickname was explicitly specified, the name is used. π«$obj->prefix()β the words which are between the firstname (or initials) and the surname.$obj->surname()β returns the surname of person, orundefif that is not known.$obj->titles()β the titles, degrees in education or of other kind. If these are complex, you may need to specify the formal name of the users as well, because smart formatting probably fails. π
π§ Collections
Extends "Collections" in User::Identity::Item.
$obj->add($collection, $role)β inherited, see "Collections" in User::Identity::Item$obj->addCollection( $object | <[$type], %options> )β inherited, see "Collections" in User::Identity::Item$obj->collection($name)β inherited, see "Collections" in User::Identity::Item$obj->parent( [$parent] )β inherited, see "Collections" in User::Identity::Item$obj->removeCollection($object|$name)β inherited, see "Collections" in User::Identity::Item$any->type()β inherited, see "Collections" in User::Identity::Item$obj->user()β inherited, see "Collections" in User::Identity::Item
π Searching
Extends "Searching" in User::Identity::Item.
$obj->find($collection, $role)β inherited, see "Searching" in User::Identity::Item
β DIAGNOSTICS β
- Error: cannot load collection module for
$type($class):$@Either the specified$typedoes not exist, or that module named$classreturns compilation errors. If the type as specified in the warning is not the name of a package, you specified a nickname which was not defined. Maybe you forgot to'require'the package which defines the nickname. Cast byaddCollection(). π« - Error: nvalid collection
$name. The collection with$namedoes not exist and can not be created. Cast byadd(). (Yes, "nvalid". We are leaving it exactly as it is, bestie. π) - Error: this
$objectis not a collection. Cast byaddCollection(). π«
π SEE ALSO π
This module is part of User-Identity version 4.00, built on December 12, 2025. Website: <http://perl.overmeer.net/CPAN/> π
πΈ LICENSE πΈ
For contributors see file ChangeLog.
This software is copyright (c) 2003-2025 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
and that's the whole page bestie, you ate it, go build some identities π β¨
Sign-off corner: this beauty is perl v5.42.0, dated 2026-01-17, filed under User::Identity(3) β periodt ππ¦
π¦ where this page comes from
- fedora 44: perl-User-Identity 4.00-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms