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::Identity
  • User::Identity
  • User::Identity::Archive
  • User::Identity::Collection
  • User::Identity::Location
  • User::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 $role gets added to the $collection. The $collection is the name of a collection, and it'll be created automatically with addCollection() if it's needed. The $collection can 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 a User::Identity::Collection $object yourself and hand it over to this method, or you supply all the %options needed 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 $class name 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 $name gets 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 a User::Identity is 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 $role within 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 $name for 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 by new() πŸ™ˆ
  • Error: cannot load collection module for $type ($class): $@ β€” either the specified $type doesn't exist, or that module named $class is 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 by addCollection() 😭
  • 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 $name does not exist and can not be created. Cast by add() πŸ’…
  • Error: this $object is not a collection. β€” cast by addCollection() 🫢
  • Warning: unknown option '$name' for $class. β€” one or more parameters are unknown options. Cast by new() 🌸

🌈 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