.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "User::Identity::Item 3" .TH User::Identity::Item 3 2025-12-14 "perl v5.42.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME User::Identity::Item \- general base class for User::Identity .SH INHERITANCE .IX Header "INHERITANCE" .Vb 7 \& User::Identity::Item is extended by \& Mail::Identity \& User::Identity \& User::Identity::Archive \& User::Identity::Collection \& User::Identity::Location \& User::Identity::System .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .SH DESCRIPTION .IX Header "DESCRIPTION" This \f(CW\*(C`User::Identity::Item\*(C'\fR base class is extended into useful modules: it has no use by its own. .SH METHODS .IX Header "METHODS" .SS Constructors .IX Subsection "Constructors" .ie n .IP "$class\->\fBnew\fR( [$name], %options )" 4 .el .IP "\f(CW$class\fR\->\fBnew\fR( [$name], \f(CW%options\fR )" 4 .IX Item "$class->new( [$name], %options )" .Sp .Vb 4 \& \-Option \-\-Default \& description undef \& name \& parent undef .Ve .RS 4 .IP "description => STRING" 2 .IX Item "description => STRING" Free format description on the collected item. .IP "name => STRING" 2 .IX Item "name => STRING" A simple name for this item. Try to give a useful name in the context of the item time. Each time when you lookup items, you need to specify this name, so it should be unique and not to hard to handle in your program. For instance, when a person is addressed, you usually will give him/her this a nickname. .IP "parent => OBJECT" 2 .IX Item "parent => OBJECT" The encapsulating object: the object which collects this one. .RE .RS 4 .RE .SS Attributes .IX Subsection "Attributes" .ie n .IP $obj\->\fBdescription\fR() 4 .el .IP \f(CW$obj\fR\->\fBdescription\fR() 4 .IX Item "$obj->description()" Free format description on this item. Please do not add any significance to the content of this field: if you are in need for an extra attribute, please contact the author of the module to implement it, or extend the object to suit your needs. .ie n .IP "$obj\->\fBname\fR( [$newname] )" 4 .el .IP "\f(CW$obj\fR\->\fBname\fR( [$newname] )" 4 .IX Item "$obj->name( [$newname] )" The new name of this item. Names are unique within a collection... a second object with the same name within any collection will destroy the already existing object with that name. .Sp Changing the name of an item is quite dangerous. You probably want to call \fBUser::Identity::Collection::renameRole()\fR instead. .SS Collections .IX Subsection "Collections" .ie n .IP "$obj\->\fBadd\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBadd\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->add($collection, $role)" The \f(CW$role\fR is added to the \f(CW$collection\fR. The \f(CW$collection\fR is the name of a collection, which will be created automatically with \fBaddCollection()\fR if needed. The \f(CW$collection\fR can also be specified as existing collection object. .Sp The \f(CW$role\fR is anything what is acceptable to \&\fBUser::Identity::Collection::addRole()\fR of the collection at hand, and is returned. \f(CW$role\fR typically is a list of parameters for one role, or a reference to an array containing these values. .Sp » example: .Sp .Vb 3 \& my $ui = User::Identity\->new(...); \& my $home = $ui\->add(location => [home => street => \*(Aq27 Roadstreet\*(Aq, ...] ); \& my $work = $ui\->add(location => work, tel => \*(Aq+31\-2231\-342\-13\*(Aq, ... ); \& \& my $travel = User::Identity::Location\->new(travel => ...); \& $ui\->add(location => $travel); \& \& my $system = User::Identity::Collection::System\->new(...); \& $ui\->add($system => \*(Aqlocalhost\*(Aq); .Ve .ie n .IP "$obj\->\fBaddCollection\fR( $object | <[$type], %options> )" 4 .el .IP "\f(CW$obj\fR\->\fBaddCollection\fR( \f(CW$object\fR | <[$type], \f(CW%options\fR> )" 4 .IX Item "$obj->addCollection( $object | <[$type], %options> )" Add a new collection of roles to an item. This can be achieved in two ways: either create an User::Identity::Collection \f(CW$object\fR yourself and then pass that to this method, or supply all the \f(CW%options\fR needed to create such an object and it will be created for you. The object which is added is returned, and can be used for many methods directly. .Sp For \f(CW%options\fR, see the specific type of collection. Additional options are listed below. .Sp .Vb 2 \& \-Option\-\-Default \& type .Ve .RS 4 .IP "type => STRING|$class" 2 .IX Item "type => STRING|$class" The nickname of a collection class or the \f(CW$class\fR name itself of the object to be created. Required if an object has to be created. Predefined type nicknames are \f(CW\*(C`email\*(C'\fR, \f(CW\*(C`system\*(C'\fR, and \f(CW\*(C`location\*(C'\fR. .RE .RS 4 .Sp » example: .Sp .Vb 3 \& my $me = User::Identity\->new(...); \& my $locs = User::Identity::Collection::Locations\->new(); \& $me\->addCollection($locs); \& \& my $email = $me\->addCollection(type => \*(Aqemail\*(Aq); \& my $email = $me\->addCollection(\*(Aqemail\*(Aq); .Ve .RE .ie n .IP $obj\->\fBcollection\fR($name) 4 .el .IP \f(CW$obj\fR\->\fBcollection\fR($name) 4 .IX Item "$obj->collection($name)" In scalar context the collection object with the \f(CW$name\fR is returned. In list context, all the roles within the collection are returned. .Sp » example: .Sp .Vb 3 \& my @roles = $me\->collection(\*(Aqemail\*(Aq); # list of collected items \& my @roles = $me\->collection(\*(Aqemail\*(Aq)\->roles; # same of collected items \& my $coll = $me\->collection(\*(Aqemail\*(Aq); # a User::Identity::Collection .Ve .ie n .IP "$obj\->\fBparent\fR( [$parent] )" 4 .el .IP "\f(CW$obj\fR\->\fBparent\fR( [$parent] )" 4 .IX Item "$obj->parent( [$parent] )" Returns the parent of an Item (the enclosing item). This may return \f(CW\*(C`undef\*(C'\fR if the object is stand\-alone. .ie n .IP $obj\->\fBremoveCollection\fR($object|$name) 4 .el .IP \f(CW$obj\fR\->\fBremoveCollection\fR($object|$name) 4 .IX Item "$obj->removeCollection($object|$name)" .ie n .IP $any\->\fBtype\fR() 4 .el .IP \f(CW$any\fR\->\fBtype\fR() 4 .IX Item "$any->type()" Returns a nice symbolic name for the type. .ie n .IP $obj\->\fBuser\fR() 4 .el .IP \f(CW$obj\fR\->\fBuser\fR() 4 .IX Item "$obj->user()" Go from this object to its parent, to its parent, and so on, until a User::Identity is found or the top of the object tree has been reached. .Sp » example: .Sp .Vb 1 \& print $email\->user\->fullName; .Ve .SS Searching .IX Subsection "Searching" .ie n .IP "$obj\->\fBfind\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBfind\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->find($collection, $role)" Returns the object with the specified \f(CW$role\fR within the named collection. The collection can be specified as name or object. .Sp » example: .Sp .Vb 2 \& my $role = $me\->find(location => \*(Aqwork\*(Aq); # one location \& my $role = $me\->collection(\*(Aqlocation\*(Aq)\->find(\*(Aqwork\*(Aq); # same \& \& my $email = $me\->addCollection(\*(Aqemail\*(Aq); \& $me\->find($email => \*(Aqwork\*(Aq); \& $email\->find(\*(Aqwork\*(Aq); # same .Ve .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" .ie n .IP "Warning: Unknown option $name for a $class" 4 .el .IP "Warning: Unknown option \f(CW$name\fR for a \f(CW$class\fR" 4 .IX Item "Warning: Unknown option $name for a $class" One used option is not defined. Check the manual page of the class to see which options are accepted. Cast by \f(CWnew()\fR .ie n .IP "Error: cannot load collection module for $type ($class): $@" 4 .el .IP "Error: cannot load collection module for \f(CW$type\fR ($class): $@" 4 .IX Item "Error: cannot load collection module for $type ($class): $@" Either the specified \f(CW$type\fR does not exist, or that module named \f(CW$class\fR returns 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 the \*(Aqrequire\*(Aq the package which defines the nickname. Cast by \f(CWaddCollection()\fR .IP "Error: each item requires a name." 4 .IX Item "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 \f(CWnew()\fR .ie n .IP "Error: nvalid collection $name." 4 .el .IP "Error: nvalid collection \f(CW$name\fR." 4 .IX Item "Error: nvalid collection $name." The collection with \f(CW$name\fR does not exist and can not be created. Cast by \f(CWadd()\fR .ie n .IP "Error: this $object is not a collection." 4 .el .IP "Error: this \f(CW$object\fR is not a collection." 4 .IX Item "Error: this $object is not a collection." Cast by \f(CWaddCollection()\fR .ie n .IP "Warning: unknown option \*(Aq$name\*(Aq for $class." 4 .el .IP "Warning: unknown option \*(Aq$name\*(Aq for \f(CW$class\fR." 4 .IX Item "Warning: unknown option '$name' for $class." One or more parameters are unknown options. Cast by \f(CWnew()\fR .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of User\-Identity version 4.00, built on December 12, 2025. Website: \fIhttp://perl.overmeer.net/CPAN/\fR .SH LICENSE .IX Header "LICENSE" For contributors see file ChangeLog. .PP This software is copyright (c) 2003\-2025 by Mark Overmeer. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.