1Mail::Message::Field::AUdsderrGrCoounpt(r3i)buted Perl DMoaciulm:e:nMteastsiaogne::Field::AddrGroup(3)
2
3
4
6 Mail::Message::Field::AddrGroup - A group of
7 Mail::Message::Field::Address objects
8
10 Mail::Message::Field::AddrGroup
11 is an User::Identity::Collection::Emails
12 is an User::Identity::Collection
13 is an User::Identity::Item
14
16 my $g = Mail::Message::Field::AddrGroup->new(name => 'name');
17
18 my $a = Mail::Message::Field::Address->new(...);
19 $g->addAddress($a);
20
21 my $f = Mail::Message::Field::Addresses->new;
22 $f->addGroup($g);
23
25 An address group collects a set of e-mail addresses (in this case they
26 are Mail::Message::Field::Address objects).
27
28 Extends "DESCRIPTION" in User::Identity::Collection::Emails.
29
31 Extends "OVERLOADED" in User::Identity::Collection::Emails.
32
33 overload: @{}
34 Inherited, see "OVERLOADED" in User::Identity::Collection
35
36 overload: stringification
37 Returns the string() value.
38
39 overload: stringification
40 Inherited, see "OVERLOADED" in User::Identity::Collection
41
43 Extends "METHODS" in User::Identity::Collection::Emails.
44
45 $obj->string()
46 Returns the address group as string. When no name is specified, it
47 will only be a comma separated list of addresses. With a name, the
48 groups name will be prepended and a semi-colon appended. When no
49 addresses where included and there is no name, then "undef" is
50 returned.
51
52 Constructors
53 Extends "Constructors" in User::Identity::Collection::Emails.
54
55 $obj->coerce($object)
56 Coerce an $object into a Mail::Message::Field::AddrGroup.
57 Currently, you can only coerce User::Identity::Collection::Emails
58 (which is the base class for this one) into this one.
59
60 Mail::Message::Field::AddrGroup->new( [$name], %options )
61 Inherited, see "Constructors" in User::Identity::Collection::Emails
62
63 Attributes
64 Extends "Attributes" in User::Identity::Collection::Emails.
65
66 $obj->description()
67 Inherited, see "Attributes" in User::Identity::Item
68
69 $obj->itemType()
70 Inherited, see "Attributes" in User::Identity::Collection
71
72 $obj->name( [$newname] )
73 Inherited, see "Attributes" in User::Identity::Item
74
75 $obj->roles()
76 Inherited, see "Attributes" in User::Identity::Collection
77
78 Collections
79 Extends "Collections" in User::Identity::Collection::Emails.
80
81 $obj->add($collection, $role)
82 Inherited, see "Collections" in User::Identity::Item
83
84 $obj->addCollection( $object | <[$type], %options> )
85 Inherited, see "Collections" in User::Identity::Item
86
87 $obj->collection($name)
88 Inherited, see "Collections" in User::Identity::Item
89
90 $obj->parent( [$parent] )
91 Inherited, see "Collections" in User::Identity::Item
92
93 $obj->removeCollection($object|$name)
94 Inherited, see "Collections" in User::Identity::Item
95
96 $obj->type()
97 Mail::Message::Field::AddrGroup->type()
98 Inherited, see "Collections" in User::Identity::Item
99
100 $obj->user()
101 Inherited, see "Collections" in User::Identity::Item
102
103 Maintaining roles
104 Extends "Maintaining roles" in User::Identity::Collection::Emails.
105
106 $obj->addRole($role| <[$name],%options> | ARRAY)
107 Inherited, see "Maintaining roles" in User::Identity::Collection
108
109 $obj->removeRole($role|$name)
110 Inherited, see "Maintaining roles" in User::Identity::Collection
111
112 $obj->renameRole( <$role|$oldname>, $newname )
113 Inherited, see "Maintaining roles" in User::Identity::Collection
114
115 $obj->sorted()
116 Inherited, see "Maintaining roles" in User::Identity::Collection
117
118 Searching
119 Extends "Searching" in User::Identity::Collection::Emails.
120
121 $obj->find($name|CODE|undef)
122 Inherited, see "Searching" in User::Identity::Collection
123
124 Addresses
125 $obj->addAddress(STRING|$address|%options)
126 Add one e-mail address to the list which is maintained in the
127 group. This is a wrapper around addRole() adding flexibility on how
128 addresses are specified. An $address can be anything which is
129 acceptable for Mail::Message::Field::Address::coerce() or a list of
130 options which will create such an object.
131
132 example: of adding an address to an address group
133
134 my @data = (full_name => "Myself", address => 'me@tux.org');
135 $group->addAddress(@data);
136
137 my $addr = Mail::Message::Field::Address->new(@data);
138 $group->addAddress(@data);
139
140 my $ma = Mail::Address->new(...);
141 $group->addAddress($ma);
142
143 $obj->addresses()
144 Returns all addresses defined in this group. The addresses will be
145 ordered alphabetically to make automated testing possible: roles
146 are stored in a hash, so have an unpredictable order by default.
147
148 example: getting all addresses from a group
149
150 my @addrs = $group->addresses;
151 my @addrs = map { $_->address } $self->roles; #same
152
153 Error handling
155 Error: $object is not a collection.
156 The first argument is an object, but not of a class which extends
157 User::Identity::Collection.
158
159 Error: Cannot coerce a $type into a Mail::Message::Field::AddrGroup
160 Error: Cannot create a $type to add this to my collection.
161 Some options are specified to create a $type object, which is
162 native to this collection. However, for some reason this failed.
163
164 Error: Cannot load collection module for $type ($class).
165 Either the specified $type does not exist, or that module named
166 $class returns compilation errors. If the type as specified in the
167 warning is not the name of a package, you specified a nickname
168 which was not defined. Maybe you forgot the 'require' the package
169 which defines the nickname.
170
171 Error: Cannot rename $name into $newname: already exists
172 Error: Cannot rename $name into $newname: doesn't exist
173 Error: Creation of a collection via $class failed.
174 The $class did compile, but it was not possible to create an object
175 of that class using the options you specified.
176
177 Error: Don't know what type of collection you want to add.
178 If you add a collection, it must either by a collection object or a
179 list of options which can be used to create a collection object.
180 In the latter case, the type of collection must be specified.
181
182 Warning: No collection $name
183 The collection with $name does not exist and can not be created.
184
185 Error: Wrong type of role for $collection: requires a $expect but got a
186 $type
187 Each $collection groups sets of roles of one specific type
188 ($expect). You cannot add objects of a different $type.
189
191 This module is part of Mail-Message distribution version 3.008, built
192 on February 11, 2019. Website: http://perl.overmeer.net/CPAN/
193
195 Copyrights 2001-2019 by [Mark Overmeer <markov@cpan.org>]. For other
196 contributors see ChangeLog.
197
198 This program is free software; you can redistribute it and/or modify it
199 under the same terms as Perl itself. See http://dev.perl.org/licenses/
200
201
202
203perl v5.30.1 2020-01-30Mail::Message::Field::AddrGroup(3)