Mail::...dentity(3pm)
π NAME π
Hiiii bestie, you've landed on Mail::...dentity(3pm), direct from the User Contributed Perl Documentation shelf β¨. And what is this page about? Only Mail::Box::Identity β the module that represents an unopened folder π. Not an opened folder. Not a folder you peeked inside. Just the identity of one. Lowkey iconic, honestly.
𧬠INHERITANCE π§¬
The family tree, and she has two parents:
Mail::Box::Identity
is a User::Identity::Item
Mail::Box::Identity
is a Mail::Reporter
Two whole lineages. Very main character energy π.
πΈ SYNOPSIS πΈ
The vibe, in code:
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 => ...);
See that? You can build the mailbox yourself and add it, or just let the simpler path do all the work for you π«Ά.
π DESCRIPTION π
So, Mail::Box::Identity holds the description of a single mailbox π. All these mailboxes get collected together by an Mail::Box::Collection object. And bestie, this is exactly the same deal as IMAP's \NoSelect, for instance π.
Also, nearly all methods can return undef β so like, always vibe check your return value, fr fr π.
Extends "DESCRIPTION" in Mail::Reporter.
Extends "DESCRIPTION" in User::Identity::Item.
π οΈ METHODS π οΈ
Extends "METHODS" in Mail::Reporter.
Extends "METHODS" in User::Identity::Item.
ποΈ Constructors ποΈ
Extends "Constructors" in Mail::Reporter.
Extends "Constructors" in User::Identity::Item.
$class->new( [$name], %options )
Inherited β see "Constructors" in Mail::Reporter β¨.
Heres the whole option menu, every single one, no skips π :
deletedβ default:<C<false>>deleted => BOOLEANβ The folder is flagged for deletion. This doesn't have any implications yet, because it may still get undeleted π.
descriptionβ Defined inUser::Identity::Itemβ default:undefdescription => STRING
folder_typeβ default: from parentfolder_type => CLASS
inferiorsβ default:1inferiors => BOOLEANβ Can this folder have children? If not, this is cleared π§.
locationβ default:undeflocation => $directory|$fileβ The location of this folder. Often, only the manager can figure-out where this folder really is π.
managerβ default:<from parent>manager => $objectβ AnyMail::Box::ManagerorMail::Box::Manage::User$object.
markedβ default:undefmarked => 0|1|undefβ Whether the folder is flagged for some reason, for instance because new messages have arrived β.
nameβ Defined inUser::Identity::Itemβ default:<required>name => STRING
only_subsβ default:<foldertype and name dependent>only_subs => BOOLEANβ Some folder types can have messages in their toplevel folder, other cannot. That determines the default. SeeMail::Box::topFolderWithMessages()π.
parentβ Defined inUser::Identity::Itemβ default:undefparent => OBJECT
subf_typeβ default:<same as parent>subf_type => $classβ The type for a subfolder collection, must extend classMail::Box::Collectionπ.
π Attributes π
Extends "Attributes" in Mail::Reporter.
Extends "Attributes" in User::Identity::Item.
$obj->deleted( [BOOLEAN] )$obj->description()β Inherited, see "Attributes" in User::Identity::Item$obj->folderType()β Returns the type of this folder πΈ.$obj->fullname( [$delimeter] )β Returns the name of the folder, from the toplevel until this one, with the$delimeterstring between each level.$delimeterdefault to a forward slash (a"/") π¦.$obj->inferiors( [BOOLEAN] )β "Inferiors" are "subfolders". When this flag is set, it is permitted to create subfolders β¨.$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 π.$obj->manager()β Returns the manager (usually aMail::Box::Manage::Userwhich owns the folders. May be undefined, by default from parent π .$obj->marked( [BOOLEAN|undef] )β When something special has happened with the folder, this flag can be set (or cleared). Theundefstatus is an "unknown". In the IMAP4 protocol,0will result in a\Unmarked, a1results in a\Marked, andundefin nothing π.$obj->name( [$newname] )β Inherited, see "Attributes" in User::Identity::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. SeeMail::Box::topFolderWithMessages()π₯.$obj->topfolder()β Run up the tree to find the highest level folder π§βοΈ.
ποΈ 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
π¨ Error handling π¨
Extends "Error handling" in Mail::Reporter.
$obj->AUTOLOAD()β Inherited, see "Error handling" in Mail::Reporter$obj->notImplemented()β Inherited, see "Error handling" in Mail::Reporter
π§Ή Cleanup π§Ή
Extends "Cleanup" in Mail::Reporter.
$obj->DESTROY()β Inherited, see "Cleanup" in Mail::Reporter
π Subfolders π
$obj->addSubfolder(Mail::Box::Identity-object|$data)β Add a new folder into the administration. With$data, a new object will be instantiated first. The identity is returned on success π«Ά.$obj->folder( [..., $name] )β Returns the subfolder's object with$nameorundefif it does not exist. When multiple NAME's are added, those super folders are traverst first. Without any$name, the current object is returned π.
Β» example: get some folder
my $a = $user->folders->folder('b', 'a');
my $name = "a:b:c";
my $delim = ":";
my $f = $user->folders->folder(split $delim, $name);
$obj->foreach(CODE)β For each of the subfolders found below this point callCODE. This current folder is called first. Be warned that you may find identities with thedeleted()flag on β οΈ.$obj->open(%options)β Open the folder which is described by this identity. Returned is someMail::Box. The options are passed toMail::Box::Manager::open()π.$obj->remove( [$name] )β Remove the folder (plus subfolders) with the$name. Without$name, thisMail::Box::Identityitself is removed.
The removed structure is returned, which is undef if not found. This is only an administrative remove, you still need a Mail::Box::Manager::delete() π.
$obj->rename( $folder, [$newsubname] )β Move the folder to a different super-$folder, under a NEW SUBfolder NAME β¨.
Β» example: renaming a folder
my $top = $user->topfolder;
my $new = $top->folder('xyz') or die;
my $f = $top->folder('abc', 'def')->rename($new, '123');
print $f->name; # 123
print $f->fullname; # =/xyz/123
$obj->subfolderNames()β Convenience method: returns the names of the collected subfolders π.$obj->subfolders()β Returns the subfolders orundefif there are none. This information is lazy evaluated and cached. In LIST context, the folder objects are returned (Mail::Box::Identityobjects), in SCALAR context the collection, theMail::Box::Collectionπ¦.
π©Ί 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 the 'require' the package which defines the nickname π. Cast byaddCollection() - Error:
class $package does not implement method $method.Fatal error: the specific$package(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 bynotImplemented() - Error:
invalid collection $name.The collection with$namedoes not exist and can not be created π. Cast byadd() - Error:
it is not permitted to add subfolders to $folder.Theinferiors()flag prohibits the creation of subfolders to this folder π«. Cast byaddSubfolder() - Error:
the toplevel folder cannot be removed this wayTheMail::Box::Identityfolder administration structure requires a top directory. That top is registered somewhere (for instance by aMail::Box::Manage::User). If you need to remove the top, you have to look for a method of that object π§. Cast byremove() - Error:
this $object is not a collection.Cast byaddCollection() - Error:
toplevel directory requires explicit folder type.Cast byfolderType() - Error:
toplevel directory requires explicit location.Cast bylocation()
π SEE ALSO π
This module is part of Mail-Box version 4.02, built on April 10, 2026 β.
Website: http://perl.overmeer.net/CPAN/ π
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2026 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 a wrap bestie πβ¨ this page rode in on perl v5.40.1 and got dated 2026-05-09, so go forth, manage those unopened folders, and slay π
π¦
π¦ where this page comes from
- ubuntu stonking: libmail-box-perl 4.02-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms