1Mail::Message::Field::AUdsderrGrCoounpt(r3i)buted Perl DMoaciulm:e:nMteastsiaogne::Field::AddrGroup(3)
2
3
4

NAME

6       Mail::Message::Field::AddrGroup - A group of
7       Mail::Message::Field::Address objects
8

INHERITANCE

10        Mail::Message::Field::AddrGroup
11          is a User::Identity::Collection::Emails
12          is a User::Identity::Collection
13          is a User::Identity::Item
14

SYNOPSIS

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

DESCRIPTION

25       An address group collects a set of e-mail addresses (in this case they
26       are Mail::Message::Field::Address objects).
27

OVERLOADED

29       overload: @{}
30           See "OVERLOADED" in User::Identity::Collection
31
32       overload: stringification
33           Returns the string() value.
34

METHODS

36   Constructors
37       $obj->coerce(OBJECT)
38           Coerce an OBJECT into a Mail::Message::Field::AddrGroup.
39           Currently, you can only coerce User::Identity::Collection::Emails
40           (which is the base class for this one) into this one.
41
42       Mail::Message::Field::AddrGroup->new([NAME], OPTIONS)
43           See "Constructors" in User::Identity::Collection::Emails
44
45   Attributes
46       $obj->description
47           See "Attributes" in User::Identity::Item
48
49       $obj->itemType
50           See "Attributes" in User::Identity::Collection
51
52       $obj->name([NEWNAME])
53           See "Attributes" in User::Identity::Item
54
55       $obj->roles
56           See "Attributes" in User::Identity::Collection
57
58   Collections
59       $obj->add(COLLECTION, ROLE)
60           See "Collections" in User::Identity::Item
61
62       $obj->addCollection(OBJECT | ([TYPE], OPTIONS))
63           See "Collections" in User::Identity::Item
64
65       $obj->collection(NAME)
66           See "Collections" in User::Identity::Item
67
68       $obj->parent([PARENT])
69           See "Collections" in User::Identity::Item
70
71       $obj->removeCollection(OBJECT|NAME)
72           See "Collections" in User::Identity::Item
73
74       $obj->type
75           Mail::Message::Field::AddrGroup->type
76
77           See "Collections" in User::Identity::Item
78
79       $obj->user
80           See "Collections" in User::Identity::Item
81
82   Maintaining roles
83       $obj->addRole(ROLE| ( [NAME],OPTIONS ) | ARRAY-OF-OPTIONS)
84           See "Maintaining roles" in User::Identity::Collection
85
86       $obj->removeRole(ROLE|NAME)
87           See "Maintaining roles" in User::Identity::Collection
88
89       $obj->renameRole(ROLE|OLDNAME, NEWNAME)
90           See "Maintaining roles" in User::Identity::Collection
91
92       $obj->sorted
93           See "Maintaining roles" in User::Identity::Collection
94
95   Searching
96       $obj->find(NAME|CODE|undef)
97           See "Searching" in User::Identity::Collection
98
99   Addresses
100       $obj->addAddress(STRING|ADDRESS|OPTIONS)
101           Add one e-mail address to the list which is maintained in the
102           group. This is a wrapper around addRole() adding flexibility on how
103           addresses are specified.  An ADDRESS can be anything which is
104           acceptable for Mail::Message::Field::Address::coerce() or a list of
105           options which will create such an object.
106
107           example: of adding an address to an address group
108
109            my @data = (full_name => "Myself", address => 'me@tux.org');
110            $group->addAddress(@data);
111
112            my $addr = Mail::Message::Field::Address->new(@data);
113            $group->addAddress(@data);
114
115            my $ma = Mail::Address->new(...);
116            $group->addAddress($ma);
117
118       $obj->addresses
119           Returns all addresses defined in this group.  The addresses will be
120           ordered alphabetically to make automated testing possible: roles
121           are stored in a hash, so have an unpredictable order by default.
122
123           example: getting all addresses from a group
124
125            my @addrs = $group->addresses;
126            my @addrs = map { $_->address } $self->roles; #same
127
128   Error handling
129       $obj->string
130           Returns the address group as string.  When no name is specified, it
131           will only be a comma separated list of addresses.  With a name, the
132           groups name will be prepended and a semi-colon appended.  When no
133           addresses where included and there is no name, then "undef" is
134           returned.
135

DIAGNOSTICS

137       Error: $object is not a collection.
138           The first argument is an object, but not of a class which extends
139           User::Identity::Collection.
140
141       Error: Cannot coerce a $type into a Mail::Message::Field::AddrGroup
142       Error: Cannot create a $type to add this to my collection.
143           Some options are specified to create a $type object, which is
144           native to this collection.  However, for some reason this failed.
145
146       Error: Cannot load collection module for $type ($class).
147           Either the specified $type does not exist, or that module named
148           $class returns compilation errors.  If the type as specified in the
149           warning is not the name of a package, you specified a nickname
150           which was not defined.  Maybe you forgot the 'require' the package
151           which defines the nickname.
152
153       Error: Cannot rename $name into $newname: already exists
154       Error: Cannot rename $name into $newname: doesn't exist
155       Error: Creation of a collection via $class failed.
156           The $class did compile, but it was not possible to create an object
157           of that class using the options you specified.
158
159       Error: Don't know what type of collection you want to add.
160           If you add a collection, it must either by a collection object or a
161           list of options which can be used to create a collection object.
162           In the latter case, the type of collection must be specified.
163
164       Warning: No collection $name
165           The collection with $name does not exist and can not be created.
166
167       Error: Wrong type of role for $collection: requires a $expect but got a
168       $type
169           Each $collection groups sets of roles of one specific type
170           ($expect).  You cannot add objects of a different $type.
171

SEE ALSO

173       This module is part of Mail-Box distribution version 2.097, built on
174       January 26, 2011. Website: http://perl.overmeer.net/mailbox/
175

LICENSE

177       Copyrights 2001-2011 by Mark Overmeer. For other contributors see
178       ChangeLog.
179
180       This program is free software; you can redistribute it and/or modify it
181       under the same terms as Perl itself.  See
182       http://www.perl.com/perl/misc/Artistic.html
183
184
185
186perl v5.12.3                      2011-01-26Mail::Message::Field::AddrGroup(3)
Impressum