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