User::I...y::Item(3)
πΈ NAME πΈ
User::Identity::Item β the general base class for User::Identity, bestie π
π¦ INHERITANCE π¦
User::Identity::Item is extended by:
Mail::IdentityUser::IdentityUser::Identity::ArchiveUser::Identity::CollectionUser::Identity::LocationUser::Identity::System
β¨ SYNOPSIS β¨
okay so bestieβ¦ there is literally nothing here π the original page has this heading and then justβ¦ vibes. Empty. No code block, no example, nothing. So we move. π
π DESCRIPTION π
So this User::Identity::Item base class is the blueprint-y thing that gets extended into the actually-useful modules. On its own it has no use whatsoever β it's giving "main character who only shows up in flashbacks" energy. It's just the base. Periodt. π
π METHODS π
π Constructors π
$class->new( [$name], %options )
Here's the options table, exactly as the original lays it out:
-Option --Default
description undef
name <required>
parent undef
description => STRINGβ a free-format description of the collected item. Say whatever you want, no rules π«Άname => STRINGβ a simple name for this item. Try to give it a name that's actually useful in the context of the item's time, okay? Every single time you look up items you have to specify this name, so it should be unique and not too hard to handle in your program. Like, when a person is addressed, you'll usually give them a nickname β same vibe π«parent => OBJECTβ the encapsulating object, aka the object that collects this one. Its parent. Its keeper. π
π§ Attributes π§
$obj->description()β free-format description of this item. Please do NOT read any deep significance into the content of this field: if you need an extra attribute, hit up the author of the module to implement it, or just extend the object to suit your needs. Live your truth π$obj->name( [$newname] )β the new name of this item. Names are unique within a collectionβ¦ and a second object with the same name inside any collection will destroy the already existing object with that name. π
Changing the name of an item is quite dangerous. You probably want to call User::Identity::Collection::renameRole() instead. Like, seriously, that's the move.
π Collections π
$obj->add($collection, $role)β the$rolegets added to the$collection. The$collectionis the name of a collection, and it'll be created automatically withaddCollection()if it's needed. The$collectioncan also be specified as an existing collection object, no problem β¨
The $role is anything that's acceptable to User::Identity::Collection::addRole() of the collection at hand, and it gets returned. $role is typically a list of parameters for one role, or a reference to an array containing those values. Slay.
Β» example:
my $ui = User::Identity->new(...);
my $home = $ui->add(location => [home => street => '27 Roadstreet', ...] );
my $work = $ui->add(location => work, tel => '+31-2231-342-13', ... );
my $travel = User::Identity::Location->new(travel => ...);
$ui->add(location => $travel);
my $system = User::Identity::Collection::System->new(...);
$ui->add($system => 'localhost');
$obj->addCollection( $object | <[$type], %options> )β add a new collection of roles to an item. Two ways to do it, bestie: either you create aUser::Identity::Collection$objectyourself and hand it over to this method, or you supply all the%optionsneeded to create such an object and it gets created for you. The object that gets added is returned, and you can use it directly for loads of methods. Obsessed. π
For %options, check the specific type of collection. Additional options are listed below:
-Option--Default
type <required>
type => STRING|$classβ the nickname of a collection class, or the$classname itself, of the object to be created. Required if an object has to be created. The predefined type nicknames are"email","system", and"location". π
Β» example:
my $me = User::Identity->new(...);
my $locs = User::Identity::Collection::Locations->new();
$me->addCollection($locs);
my $email = $me->addCollection(type => 'email');
my $email = $me->addCollection('email');
$obj->collection($name)β in scalar context, the collection object with that$namegets returned. In list context, all the roles within the collection get returned. Both. Depends on the context. Iconic behaviour, honestly π¦
Β» example:
my @roles = $me->collection('email'); # list of collected items
my @roles = $me->collection('email')->roles; # same of collected items
my $coll = $me->collection('email'); # a User::Identity::Collection
$obj->parent( [$parent] )β returns the parent of an Item (the enclosing item). This may return"undef"if the object is stand-alone. Alone. Independent. Main character. π§$obj->removeCollection($object|$name)β takes it away. That's the whole description, no cap.$any->type()β returns a nice symbolic name for the type β¨$obj->user()β go from this object to its parent, to its parent, and so on and so on, until aUser::Identityis found or the top of the object tree has been reached. Climbing the family tree, fr fr π³
Β» example:
print $email->user->fullName;
π₯ Searching π₯
$obj->find($collection, $role)β returns the object with the specified$rolewithin the named collection. The collection can be specified as a name or as an object, either one π
Β» example:
my $role = $me->find(location => 'work'); # one location
my $role = $me->collection('location')->find('work'); # same
my $email = $me->addCollection('email');
$me->find($email => 'work');
$email->find('work'); # same
π DIAGNOSTICS π
- Warning: Unknown option
$namefor a$classβ one of the options you used isn't defined. Check the manual page of the class to see which options are accepted. Cast bynew()π - Error: cannot load collection module for
$type($class):$@β either the specified$typedoesn't exist, or that module named$classis returning compilation errors. If the type as specified in the warning is not the name of a package, then you specified a nickname which was not defined β maybe you forgot to'require'the package which defines the nickname. Cast byaddCollection()π - Error: each item requires a name. β you have to specify a name for each item. These names need to be unique within one collection, but feel free to give the same name to an e-mail address and a location. Cast by
new()β¨ - Error: nvalid collection
$name. β the collection with$namedoes not exist and can not be created. Cast byadd()π - Error: this
$objectis not a collection. β cast byaddCollection()π«Ά - Warning: unknown option
'$name'for$class. β one or more parameters are unknown options. Cast bynew()πΈ
π 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!! this was User::I...y::Item(3) from the User Contributed Perl Documentation section, rendered with perl v5.42.0 on 2026-01-17. go forth and name your items wisely π
β¨π
π¦ 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