.\" -*- 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 "Mail::Box::Identity 3" .TH Mail::Box::Identity 3 2026-04-11 "perl v5.42.2" "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 Mail::Box::Identity \- represents an unopened folder .SH INHERITANCE .IX Header "INHERITANCE" .Vb 2 \& Mail::Box::Identity \& is a User::Identity::Item \& \& Mail::Box::Identity \& is a Mail::Reporter .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 3 \& use User::Identity; \& use Mail::Box::Identity; \& my $me = User::Identity\->new(...); \& \& my $mailbox = Mail::Box::Identity\->new(...); \& $me\->add(folders => $mailbox); \& \& # Simpler \& \& use User::Identity; \& my $me = User::Identity\->new(...); \& my $addr = $me\->add(folders => ...); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The \f(CW\*(C`Mail::Box::Identity\*(C'\fR object contains the description of a single mailbox. The mailboxes are collected by an Mail::Box::Collection object. This corresponds with IMAP\*(Aqs \f(CW\*(C`\eNoSelect\*(C'\fR, for instance. .PP Nearly all methods can return \f(CW\*(C`undef\*(C'\fR. .PP Extends "DESCRIPTION" in Mail::Reporter. .PP Extends "DESCRIPTION" in User::Identity::Item. .SH METHODS .IX Header "METHODS" Extends "METHODS" in Mail::Reporter. .PP Extends "METHODS" in User::Identity::Item. .SS Constructors .IX Subsection "Constructors" Extends "Constructors" in Mail::Reporter. .PP Extends "Constructors" in User::Identity::Item. .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 )" Inherited, see "Constructors" in Mail::Reporter .Sp .Vb 12 \& \-Option \-\-Defined in \-\-Default \& deleted > \& description User::Identity::Item undef \& folder_type from parent \& inferiors 1 \& location undef \& manager \& marked undef \& name User::Identity::Item \& only_subs \& parent User::Identity::Item undef \& subf_type .Ve .RS 4 .IP "deleted => BOOLEAN" 2 .IX Item "deleted => BOOLEAN" The folder is flagged for deletion. This not have any implications yet, because it may still get undeleted. .IP "description => STRING" 2 .IX Item "description => STRING" .PD 0 .IP "folder_type => CLASS" 2 .IX Item "folder_type => CLASS" .IP "inferiors => BOOLEAN" 2 .IX Item "inferiors => BOOLEAN" .PD Can this folder have children? If not, this is cleared. .ie n .IP "location => $directory|$file" 2 .el .IP "location => \f(CW$directory\fR|$file" 2 .IX Item "location => $directory|$file" The location of this folder. Often, only the manager can figure\-out where this folder really is. .ie n .IP "manager => $object" 2 .el .IP "manager => \f(CW$object\fR" 2 .IX Item "manager => $object" Any Mail::Box::Manager or Mail::Box::Manage::User \f(CW$object\fR. .IP "marked => 0|1|undef" 2 .IX Item "marked => 0|1|undef" Whether the folder is flagged for some reason, for instance because new messages have arrived. .IP "name => STRING" 2 .IX Item "name => STRING" .PD 0 .IP "only_subs => BOOLEAN" 2 .IX Item "only_subs => BOOLEAN" .PD Some folder types can have messages in their toplevel folder, other cannot. That determines the default. See \fBMail::Box::topFolderWithMessages()\fR .IP "parent => OBJECT" 2 .IX Item "parent => OBJECT" .PD 0 .ie n .IP "subf_type => $class" 2 .el .IP "subf_type => \f(CW$class\fR" 2 .IX Item "subf_type => $class" .PD The type for a subfolder collection, must extend class Mail::Box::Collection. .RE .RS 4 .RE .SS Attributes .IX Subsection "Attributes" Extends "Attributes" in Mail::Reporter. .PP Extends "Attributes" in User::Identity::Item. .ie n .IP "$obj\->\fBdeleted\fR( [BOOLEAN] )" 4 .el .IP "\f(CW$obj\fR\->\fBdeleted\fR( [BOOLEAN] )" 4 .IX Item "$obj->deleted( [BOOLEAN] )" .ie n .IP $obj\->\fBdescription\fR() 4 .el .IP \f(CW$obj\fR\->\fBdescription\fR() 4 .IX Item "$obj->description()" Inherited, see "Attributes" in User::Identity::Item .ie n .IP $obj\->\fBfolderType\fR() 4 .el .IP \f(CW$obj\fR\->\fBfolderType\fR() 4 .IX Item "$obj->folderType()" Returns the type of this folder. .ie n .IP "$obj\->\fBfullname\fR( [$delimeter] )" 4 .el .IP "\f(CW$obj\fR\->\fBfullname\fR( [$delimeter] )" 4 .IX Item "$obj->fullname( [$delimeter] )" Returns the name of the folder, from the toplevel until this one, with the \f(CW$delimeter\fR string between each level. \f(CW$delimeter\fR default to a forward slash (a \f(CW\*(C`/\*(C'\fR). .ie n .IP "$obj\->\fBinferiors\fR( [BOOLEAN] )" 4 .el .IP "\f(CW$obj\fR\->\fBinferiors\fR( [BOOLEAN] )" 4 .IX Item "$obj->inferiors( [BOOLEAN] )" \&\f(CW\*(C`Inferiors\*(C'\fR are \f(CW\*(C`subfolders\*(C'\fR. When this flag is set, it is permitted to create subfolders. .ie n .IP "$obj\->\fBlocation\fR( [$filename|$directory|undef] )" 4 .el .IP "\f(CW$obj\fR\->\fBlocation\fR( [$filename|$directory|undef] )" 4 .IX Item "$obj->location( [$filename|$directory|undef] )" Returns the directory or filename of the folder. If this is not pre\-defined, it is computed based on the knowledge about the folder type. Be sure to set the location of the toplevel folder to the folderdir of the user to get this to work. .ie n .IP $obj\->\fBmanager\fR() 4 .el .IP \f(CW$obj\fR\->\fBmanager\fR() 4 .IX Item "$obj->manager()" Returns the manager (usually a Mail::Box::Manage::User which owns the folders. May be undefined, by default from parent. .ie n .IP "$obj\->\fBmarked\fR( [BOOLEAN|undef] )" 4 .el .IP "\f(CW$obj\fR\->\fBmarked\fR( [BOOLEAN|undef] )" 4 .IX Item "$obj->marked( [BOOLEAN|undef] )" When something special has happened with the folder, this flag can be set (or cleared). The \f(CW\*(C`undef\*(C'\fR status is an "unknown". In the IMAP4 protocol, \f(CW0\fR will result in a \f(CW\*(C`\eUnmarked\*(C'\fR, a \f(CW1\fR results in a \f(CW\*(C`\eMarked\*(C'\fR, and \f(CW\*(C`undef\*(C'\fR in nothing. .ie n .IP "$obj\->\fBname\fR( [$newname] )" 4 .el .IP "\f(CW$obj\fR\->\fBname\fR( [$newname] )" 4 .IX Item "$obj->name( [$newname] )" Inherited, see "Attributes" in User::Identity::Item .ie n .IP "$obj\->\fBonlySubfolders\fR( [BOOLEAN] )" 4 .el .IP "\f(CW$obj\fR\->\fBonlySubfolders\fR( [BOOLEAN] )" 4 .IX Item "$obj->onlySubfolders( [BOOLEAN] )" Than this folder be opened (without trying) or not? The default depends on the folder type, and whether this is the toplevel folder or not. See \fBMail::Box::topFolderWithMessages()\fR .ie n .IP $obj\->\fBtopfolder\fR() 4 .el .IP \f(CW$obj\fR\->\fBtopfolder\fR() 4 .IX Item "$obj->topfolder()" Run up the tree to find the highest level folder. .SS Collections .IX Subsection "Collections" Extends "Collections" in User::Identity::Item. .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)" Inherited, see "Collections" in User::Identity::Item .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> )" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBcollection\fR($name) 4 .el .IP \f(CW$obj\fR\->\fBcollection\fR($name) 4 .IX Item "$obj->collection($name)" Inherited, see "Collections" in User::Identity::Item .ie n .IP "$obj\->\fBparent\fR( [$parent] )" 4 .el .IP "\f(CW$obj\fR\->\fBparent\fR( [$parent] )" 4 .IX Item "$obj->parent( [$parent] )" Inherited, see "Collections" in User::Identity::Item .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)" Inherited, see "Collections" in User::Identity::Item .ie n .IP $any\->\fBtype\fR() 4 .el .IP \f(CW$any\fR\->\fBtype\fR() 4 .IX Item "$any->type()" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBuser\fR() 4 .el .IP \f(CW$obj\fR\->\fBuser\fR() 4 .IX Item "$obj->user()" Inherited, see "Collections" in User::Identity::Item .SS Searching .IX Subsection "Searching" Extends "Searching" in User::Identity::Item. .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)" Inherited, see "Searching" in User::Identity::Item .SS "Error handling" .IX Subsection "Error handling" Extends "Error handling" in Mail::Reporter. .ie n .IP $obj\->\fBAUTOLOAD\fR() 4 .el .IP \f(CW$obj\fR\->\fBAUTOLOAD\fR() 4 .IX Item "$obj->AUTOLOAD()" Inherited, see "Error handling" in Mail::Reporter .ie n .IP $obj\->\fBnotImplemented\fR() 4 .el .IP \f(CW$obj\fR\->\fBnotImplemented\fR() 4 .IX Item "$obj->notImplemented()" Inherited, see "Error handling" in Mail::Reporter .SS Cleanup .IX Subsection "Cleanup" Extends "Cleanup" in Mail::Reporter. .ie n .IP $obj\->\fBDESTROY\fR() 4 .el .IP \f(CW$obj\fR\->\fBDESTROY\fR() 4 .IX Item "$obj->DESTROY()" Inherited, see "Cleanup" in Mail::Reporter .SS Subfolders .IX Subsection "Subfolders" .ie n .IP $obj\->\fBaddSubfolder\fR(Mail::Box::Identity\-object|$data) 4 .el .IP \f(CW$obj\fR\->\fBaddSubfolder\fR(Mail::Box::Identity\-object|$data) 4 .IX Item "$obj->addSubfolder(Mail::Box::Identity-object|$data)" Add a new folder into the administration. With \f(CW$data\fR, a new object will be instantiated first. The identity is returned on success. .ie n .IP "$obj\->\fBfolder\fR( [..., $name] )" 4 .el .IP "\f(CW$obj\fR\->\fBfolder\fR( [..., \f(CW$name\fR] )" 4 .IX Item "$obj->folder( [..., $name] )" Returns the subfolder\*(Aqs object with \f(CW$name\fR or \f(CW\*(C`undef\*(C'\fR if it does not exist. When multiple NAMEs are added, those super folders are traverst first. Without any \f(CW$name\fR, the current object is returned .Sp » example: get some folder .Sp .Vb 1 \& my $a = $user\->folders\->folder(\*(Aqb\*(Aq, \*(Aqa\*(Aq); \& \& my $name = "a:b:c"; \& my $delim = ":"; \& my $f = $user\->folders\->folder(split $delim, $name); .Ve .ie n .IP $obj\->\fBforeach\fR(CODE) 4 .el .IP \f(CW$obj\fR\->\fBforeach\fR(CODE) 4 .IX Item "$obj->foreach(CODE)" For each of the subfolders found below this point call \f(CW\*(C`CODE\*(C'\fR. This current folder is called first. Be warned that you may find identities with the \fBdeleted()\fR flag on. .ie n .IP $obj\->\fBopen\fR(%options) 4 .el .IP \f(CW$obj\fR\->\fBopen\fR(%options) 4 .IX Item "$obj->open(%options)" Open the folder which is described by this identity. Returned is some Mail::Box. The options are passed to \fBMail::Box::Manager::open()\fR. .ie n .IP "$obj\->\fBremove\fR( [$name] )" 4 .el .IP "\f(CW$obj\fR\->\fBremove\fR( [$name] )" 4 .IX Item "$obj->remove( [$name] )" Remove the folder (plus subfolders) with the \f(CW$name\fR. Without \f(CW$name\fR, this \&\f(CW\*(C`Mail::Box::Identity\*(C'\fR itself is removed. .Sp The removed structure is returned, which is \f(CW\*(C`undef\*(C'\fR if not found. This is only an administrative remove, you still need a \&\fBMail::Box::Manager::delete()\fR. .ie n .IP "$obj\->\fBrename\fR( $folder, [$newsubname] )" 4 .el .IP "\f(CW$obj\fR\->\fBrename\fR( \f(CW$folder\fR, [$newsubname] )" 4 .IX Item "$obj->rename( $folder, [$newsubname] )" Move the folder to a different super\-\f(CW$folder\fR, under a NEW SUBfolder NAME. .Sp » example: renaming a folder .Sp .Vb 3 \& my $top = $user\->topfolder; \& my $new = $top\->folder(\*(Aqxyz\*(Aq) or die; \& my $f = $top\->folder(\*(Aqabc\*(Aq, \*(Aqdef\*(Aq)\->rename($new, \*(Aq123\*(Aq); \& \& print $f\->name; # 123 \& print $f\->fullname; # =/xyz/123 .Ve .ie n .IP $obj\->\fBsubfolderNames\fR() 4 .el .IP \f(CW$obj\fR\->\fBsubfolderNames\fR() 4 .IX Item "$obj->subfolderNames()" Convenience method: returns the names of the collected subfolders. .ie n .IP $obj\->\fBsubfolders\fR() 4 .el .IP \f(CW$obj\fR\->\fBsubfolders\fR() 4 .IX Item "$obj->subfolders()" Returns the subfolders or \f(CW\*(C`undef\*(C'\fR if there are none. This information is lazy evaluated and cached. In LIST context, the folder objects are returned (Mail::Box::Identity objects), in SCALAR context the collection, the Mail::Box::Collection. .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" .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 .ie n .IP "Error: class $package does not implement method $method." 4 .el .IP "Error: class \f(CW$package\fR does not implement method \f(CW$method\fR." 4 .IX Item "Error: class $package does not implement method $method." Fatal error: the specific \f(CW$package\fR (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by \f(CWnotImplemented()\fR .ie n .IP "Error: invalid collection $name." 4 .el .IP "Error: invalid collection \f(CW$name\fR." 4 .IX Item "Error: invalid 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: it is not permitted to add subfolders to $folder." 4 .el .IP "Error: it is not permitted to add subfolders to \f(CW$folder\fR." 4 .IX Item "Error: it is not permitted to add subfolders to $folder." The \fBinferiors()\fR flag prohibits the creation of subfolders to this folder. Cast by \f(CWaddSubfolder()\fR .IP "Error: the toplevel folder cannot be removed this way" 4 .IX Item "Error: the toplevel folder cannot be removed this way" The Mail::Box::Identity folder administration structure requires a top directory. That top is registered somewhere (for instance by a Mail::Box::Manage::User). If you need to remove the top, you have to look for a method of that object. Cast by \f(CWremove()\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 .IP "Error: toplevel directory requires explicit folder type." 4 .IX Item "Error: toplevel directory requires explicit folder type." Cast by \f(CWfolderType()\fR .IP "Error: toplevel directory requires explicit location." 4 .IX Item "Error: toplevel directory requires explicit location." Cast by \f(CWlocation()\fR .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Mail\-Box version 4.02, built on April 10, 2026. Website: \fIhttp://perl.overmeer.net/CPAN/\fR .SH LICENSE .IX Header "LICENSE" For contributors see file ChangeLog. .PP This software is copyright (c) 2001\-2026 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.