Mail::M...ddrGroup(3)

πŸ’– Mail::Message::Field::AddrGroup πŸ’–

okay so bestie, welcome to Mail::M...ddrGroup(3) from the User Contributed Perl Documentation ✨ This one is literally a whole group of Mail::Message::Field::Address objects. Like a little squad. A friend group. A vibe. 🫢


🌸 NAME 🌸

Mail::Message::Field::AddrGroup β€” a group of Mail::Message::Field::Address objects. That's it, that's the whole thing, and honestly? iconic. πŸ’…


πŸ¦‹ INHERITANCE πŸ¦‹

the family tree, no cap:

Mail::Message::Field::AddrGroup
  is a User::Identity::Collection::Emails
  is a User::Identity::Collection
  is a User::Identity::Item

so she's got ancestors, she's got lore, she's got main character energy all the way down the chain πŸ‘‘


✨ SYNOPSIS ✨

here's the vibe check, run it:

my $g = Mail::Message::Field::AddrGroup->new(name => 'name');

my $a = Mail::Message::Field::Address->new(...);
$g->addAddress($a);

my $f = Mail::Message::Field::Addresses->new;
$f->addGroup($g);

πŸ’œ DESCRIPTION πŸ’œ

An address group collects a set of e-mail addresses (in this case they are Mail::Message::Field::Address objects). that's the whole job bestie, she holds the little address besties together πŸŽ€

Extends "DESCRIPTION" in User::Identity::Collection::Emails.


🌈 OVERLOADED 🌈

Extends "OVERLOADED" in User::Identity::Collection::Emails.

  • overload: "" stringification β€” Returns the string() value. simple as that, no drama 🫢
  • overload: '""' stringification β€” Inherited, see "OVERLOADED" in User::Identity::Collection
  • overload: '@{}' array dereference β€” Inherited, see "OVERLOADED" in User::Identity::Collection

πŸ’… METHODS πŸ’…

Extends "METHODS" in User::Identity::Collection::Emails.

  • $obj->string() β€” Returns the address group as string. When no name is specified, it will only be a comma separated list of addresses. With a name, the groups name will be prepended and a semi-colon appended. When no addresses where included and there is no name, then undef is returned. so like, sometimes she gives you undef and that's just her mood fr fr 😭

🧚 Constructors 🧚

Extends "Constructors" in User::Identity::Collection::Emails.

  • $obj->coerce($object) β€” Coerce an $object into a Mail::Message::Field::AddrGroup. Currently, you can only coerce User::Identity::Collection::Emails (which is the base class for this one) into this one. just the one option bestie, she's picky πŸ’…
  • $class->new( [$name], %options ) β€” Inherited, see "Constructors" in User::Identity::Collection::Emails

⭐ Attributes ⭐

Extends "Attributes" in User::Identity::Collection::Emails.

  • $obj->description() β€” Inherited, see "Attributes" in User::Identity::Item
  • $obj->itemType() β€” Inherited, see "Attributes" in User::Identity::Collection
  • $obj->name( [$newname] ) β€” Inherited, see "Attributes" in User::Identity::Item
  • $obj->roles() β€” Inherited, see "Attributes" in User::Identity::Collection

πŸŽ€ Collections πŸŽ€

Extends "Collections" in User::Identity::Collection::Emails.

  • $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

πŸ’– Maintaining roles πŸ’–

Extends "Maintaining roles" in User::Identity::Collection::Emails.

  • $obj->addRole($role|([$name], %options)) β€” Inherited, see "Maintaining roles" in User::Identity::Collection
  • $obj->removeRole($role|$name) β€” Inherited, see "Maintaining roles" in User::Identity::Collection
  • $obj->renameRole( <$role|$oldname>, $newname ) β€” Inherited, see "Maintaining roles" in User::Identity::Collection
  • $obj->sorted() β€” Inherited, see "Maintaining roles" in User::Identity::Collection

πŸ”₯ Searching πŸ”₯

Extends "Searching" in User::Identity::Collection::Emails.

  • $obj->find($name|CODE|undef) β€” Inherited, see "Searching" in User::Identity::Collection

πŸ“ Addresses πŸ“

  • $obj->addAddress(STRING|$address|%options) β€” Add one e-mail address to the list which is maintained in the group. This is a wrapper around addRole() adding flexibility on how addresses are specified. An $address can be anything which is acceptable for Mail::Message::Field::Address::coerce() or a list of options which will create such an object. she's flexible like that, she contains multitudes 🫢

Β» example: of adding an address to an address group

my @data = (full_name => "Myself", address => 'me@tux.org');
$group->addAddress(@data);

my $addr = Mail::Message::Field::Address->new(@data);
$group->addAddress(@data);

my $ma = Mail::Address->new(...);
$group->addAddress($ma);
  • $obj->addresses() β€” Returns all addresses defined in this group. The addresses will be ordered alphabetically to make automated testing possible: roles are stored in a hash, so have an unpredictable order by default. yeah bestie, hashes do be like that, no order, chaos gremlin behavior πŸ’€

Β» example: getting all addresses from a group

my @addrs = $group->addresses;
my @addrs = map $_->address, $self->roles; #same

πŸ™ˆ Error handling πŸ™ˆ

that's literally the whole heading. no content. she said "error handling" and then said nothing else. the silence is the statement. πŸ’€


😭 DIAGNOSTICS 😭

  • Error: cannot coerce a $type into a $class. β€” Cast by coerce()
  • Error: cannot create a $type to add this to my collection. β€” Some options are specified to create a $type object, which is native to this collection. However, for some reason this failed. Cast by addRole()
  • Error: cannot load collection module for $type ($class): $@ β€” Either the specified $type does not exist, or that module named $class 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 'require' the package which defines the nickname. Cast by addCollection()
  • Error: cannot rename $from into $to: already exists. β€” Cast by renameRole()
  • Error: cannot rename $from into $to: doesn't exist. β€” Cast by renameRole()
  • Error: invalid 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()
  • Error: wrong type of role for $collection: requires a $expect but got a $type. β€” Each $collection groups sets of roles of one specific type ($expect). You cannot add objects of a different $type. Cast by addRole()

πŸ‘‘ SEE ALSO πŸ‘‘

This module is part of Mail-Message version 4.04, built on February 04, 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.


okay that's the whole page bestie, you ate that πŸ’… β€” this was perl v5.42.0, dated 2026-02-05, and she's Mail::M...ddrGroup(3) forever. periodt. πŸŒˆπŸ’–πŸ¦‹

πŸ“¦ where this page comes from