OVERLOADED

overload: @{}
See @{} in User::Identity::Collection.
overload: stringification

Returns the string() value.

METHODS

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

Constructors

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

» Error: Cannot coerce a $type into a Mail::Message::Field::AddrGroup
$class->new( [NAME], OPTIONS )
See new in User::Identity::Collection::Emails.

Attributes

$obj->description
See description in User::Identity::Item.
$obj->itemType
See itemType in User::Identity::Collection.
$obj->name( [NEWNAME] )
See name in User::Identity::Item.
$obj->roles
See roles in User::Identity::Collection.

Collections

$obj->add( COLLECTION, ROLE )
See add in User::Identity::Item.
$obj->addCollection( OBJECT | ([TYPE], OPTIONS) )
See addCollection in User::Identity::Item.
$obj->collection( NAME )
See collection in User::Identity::Item.
$obj->parent( [PARENT] )
See parent in User::Identity::Item.
$obj->removeCollection( OBJECT|NAME )
See removeCollection in User::Identity::Item.
$obj->type
$class->type
See type in User::Identity::Item.
$obj->user
See user in User::Identity::Item.

Maintaining roles

$obj->addRole( ROLE| ([NAME],OPTIONS) | ARRAY )
See addRole in User::Identity::Collection.
$obj->removeRole( ROLE|NAME )
See removeRole in User::Identity::Collection.
$obj->renameRole( <ROLE|OLDNAME>, NEWNAME )
See renameRole in User::Identity::Collection.
$obj->sorted
See sorted in User::Identity::Collection.

Searching

$obj->find( NAME|CODE|undef )
See find 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.

» 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.

» Example: getting all addresses from a group
 my @addrs = $group->addresses;
 my @addrs = map { $_->address } $self->roles; #same

Error handling

=encoding utf8