.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::Message::Field::Address 3" .TH Mail::Message::Field::Address 3 2024-01-06 "perl v5.38.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::Message::Field::Address \- One e\-mail address .SH INHERITANCE .IX Header "INHERITANCE" .Vb 3 \& Mail::Message::Field::Address \& is a Mail::Identity \& is a User::Identity::Item .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& my $addr = Mail::Message::Field::Address\->new(...); \& \& my $ui = User::Identity\->new(...); \& my $addr = Mail::Message::Field::Address\->coerce($ui); \& \& my $mi = Mail::Identity\->new(...); \& my $addr = Mail::Message::Field::Address\->coerce($mi); \& \& print $addr\->address; \& print $addr\->fullName; # possibly unicode! \& print $addr\->domain; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Many header fields can contain e\-mail addresses. Each e\-mail address can be represented by an object of this class. These objects will handle interpretation and character set encoding and decoding for you. .PP Extends "DESCRIPTION" in Mail::Identity. .SH OVERLOADED .IX Header "OVERLOADED" .IP "overload: \fBboolean\fR" 4 .IX Item "overload: boolean" The object used as boolean will always return \f(CW\*(C`true\*(C'\fR .ie n .IP "overload: \fBstring \fR\fB$comparison\fR" 4 .el .IP "overload: \fBstring \fR\f(CB$comparison\fR" 4 .IX Item "overload: string $comparison" Two address objects are the same when their email addresses are the same. .IP "overload: \fBstringification\fR" 4 .IX Item "overload: stringification" When the object is used in string context, it will return the encoded representation of the e\-mail address, just like \fBstring()\fR does. .SH METHODS .IX Header "METHODS" Extends "METHODS" in Mail::Identity. .SS Constructors .IX Subsection "Constructors" Extends "Constructors" in Mail::Identity. .ie n .IP "$obj\->\fBcoerce\fR( , %options )" 4 .el .IP "\f(CW$obj\fR\->\fBcoerce\fR( , \f(CW%options\fR )" 4 .IX Item "$obj->coerce( , %options )" Try to coerce the \f(CW$object\fR into a \f(CW\*(C`Mail::Message::Field::Address\*(C'\fR. In case of a STRING, it is interpreted as an email address. .Sp The \f(CW%options\fR are passed to the object creation, and overrule the values found in the \f(CW$object\fR. The result may be \f(CW\*(C`undef\*(C'\fR or a newly created object. If the \f(CW$object\fR is already of the correct type, it is returned unmodified. .Sp The \f(CW$object\fR may currently be a Mail::Address, a Mail::Identity, or a User::Identity. In case of the latter, one of the user's addresses is chosen at random. .ie n .IP "Mail::Message::Field::Address\->\fBnew\fR( [$name], %options )" 4 .el .IP "Mail::Message::Field::Address\->\fBnew\fR( [$name], \f(CW%options\fR )" 4 .IX Item "Mail::Message::Field::Address->new( [$name], %options )" Inherited, see "Constructors" in Mail::Identity .ie n .IP $obj\->\fBparse\fR(STRING) 4 .el .IP \f(CW$obj\fR\->\fBparse\fR(STRING) 4 .IX Item "$obj->parse(STRING)" Parse the string for an address. You never know whether one or more addresses are specified on a line (often applications are wrong), therefore, the STRING is first parsed for as many addresses as possible and then the one is taken at random. .SS Attributes .IX Subsection "Attributes" Extends "Attributes" in Mail::Identity. .ie n .IP $obj\->\fBaddress\fR() 4 .el .IP \f(CW$obj\fR\->\fBaddress\fR() 4 .IX Item "$obj->address()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBcharset\fR() 4 .el .IP \f(CW$obj\fR\->\fBcharset\fR() 4 .IX Item "$obj->charset()" Inherited, see "Attributes" in Mail::Identity .ie n .IP "$obj\->\fBcomment\fR( [STRING] )" 4 .el .IP "\f(CW$obj\fR\->\fBcomment\fR( [STRING] )" 4 .IX Item "$obj->comment( [STRING] )" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBdescription\fR() 4 .el .IP \f(CW$obj\fR\->\fBdescription\fR() 4 .IX Item "$obj->description()" Inherited, see "Attributes" in User::Identity::Item .ie n .IP $obj\->\fBdomain\fR() 4 .el .IP \f(CW$obj\fR\->\fBdomain\fR() 4 .IX Item "$obj->domain()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBlanguage\fR() 4 .el .IP \f(CW$obj\fR\->\fBlanguage\fR() 4 .IX Item "$obj->language()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBlocation\fR() 4 .el .IP \f(CW$obj\fR\->\fBlocation\fR() 4 .IX Item "$obj->location()" Inherited, see "Attributes" in Mail::Identity .ie n .IP "$obj\->\fBname\fR( [$newname] )" 4 .el .IP "\f(CW$obj\fR\->\fBname\fR( [$newname] )" 4 .IX Item "$obj->name( [$newname] )" Inherited, see "Attributes" in User::Identity::Item .ie n .IP $obj\->\fBorganization\fR() 4 .el .IP \f(CW$obj\fR\->\fBorganization\fR() 4 .IX Item "$obj->organization()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBphrase\fR() 4 .el .IP \f(CW$obj\fR\->\fBphrase\fR() 4 .IX Item "$obj->phrase()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBusername\fR() 4 .el .IP \f(CW$obj\fR\->\fBusername\fR() 4 .IX Item "$obj->username()" Inherited, see "Attributes" in Mail::Identity .SS Collections .IX Subsection "Collections" Extends "Collections" in Mail::Identity. .ie n .IP "$obj\->\fBadd\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBadd\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->add($collection, $role)" Inherited, see "Collections" in User::Identity::Item .ie n .IP "$obj\->\fBaddCollection\fR( $object | <[$type], %options> )" 4 .el .IP "\f(CW$obj\fR\->\fBaddCollection\fR( \f(CW$object\fR | <[$type], \f(CW%options\fR> )" 4 .IX Item "$obj->addCollection( $object | <[$type], %options> )" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBcollection\fR($name) 4 .el .IP \f(CW$obj\fR\->\fBcollection\fR($name) 4 .IX Item "$obj->collection($name)" Inherited, see "Collections" in User::Identity::Item .ie n .IP "$obj\->\fBparent\fR( [$parent] )" 4 .el .IP "\f(CW$obj\fR\->\fBparent\fR( [$parent] )" 4 .IX Item "$obj->parent( [$parent] )" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBremoveCollection\fR($object|$name) 4 .el .IP \f(CW$obj\fR\->\fBremoveCollection\fR($object|$name) 4 .IX Item "$obj->removeCollection($object|$name)" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBtype\fR() 4 .el .IP \f(CW$obj\fR\->\fBtype\fR() 4 .IX Item "$obj->type()" .PD 0 .IP Mail::Message::Field::Address\->\fBtype\fR() 4 .IX Item "Mail::Message::Field::Address->type()" .PD Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBuser\fR() 4 .el .IP \f(CW$obj\fR\->\fBuser\fR() 4 .IX Item "$obj->user()" Inherited, see "Collections" in User::Identity::Item .SS Searching .IX Subsection "Searching" Extends "Searching" in Mail::Identity. .ie n .IP "$obj\->\fBfind\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBfind\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->find($collection, $role)" Inherited, see "Searching" in User::Identity::Item .SS Accessors .IX Subsection "Accessors" .ie n .IP $obj\->\fBencoding\fR() 4 .el .IP \f(CW$obj\fR\->\fBencoding\fR() 4 .IX Item "$obj->encoding()" Character-set encoding, like 'q' and 'b', to be used when non-ascii characters are to be transmitted. .SS "Access to the content" .IX Subsection "Access to the content" .ie n .IP $obj\->\fBstring\fR() 4 .el .IP \f(CW$obj\fR\->\fBstring\fR() 4 .IX Item "$obj->string()" Returns an RFC compliant e\-mail address, which will have character set encoding if needed. The objects are also overloaded to call this method in string context. .Sp example: .Sp .Vb 2 \& print $address\->string; \& print $address; # via overloading .Ve .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" .ie n .IP "Error: $object is not a collection." 4 .el .IP "Error: \f(CW$object\fR is not a collection." 4 .IX Item "Error: $object is not a collection." The first argument is an object, but not of a class which extends User::Identity::Collection. .ie n .IP "Error: Cannot coerce a $type into a Mail::Message::Field::Address" 4 .el .IP "Error: Cannot coerce a \f(CW$type\fR into a Mail::Message::Field::Address" 4 .IX Item "Error: Cannot coerce a $type into a Mail::Message::Field::Address" When addresses are specified to be included in header fields, they may be coerced into Mail::Message::Field::Address objects first. What you specify is not accepted as address specification. This may be an internal error. .ie n .IP "Error: Cannot load collection module for $type ($class)." 4 .el .IP "Error: Cannot load collection module for \f(CW$type\fR ($class)." 4 .IX Item "Error: Cannot load collection module for $type ($class)." Either the specified \f(CW$type\fR does not exist, or that module named \f(CW$class\fR 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. .ie n .IP "Error: Creation of a collection via $class failed." 4 .el .IP "Error: Creation of a collection via \f(CW$class\fR failed." 4 .IX Item "Error: Creation of a collection via $class failed." The \f(CW$class\fR did compile, but it was not possible to create an object of that class using the options you specified. .IP "Error: Don't know what type of collection you want to add." 4 .IX Item "Error: Don't know what type of collection you want to add." If you add a collection, it must either by a collection object or a list of options which can be used to create a collection object. In the latter case, the type of collection must be specified. .ie n .IP "Warning: No collection $name" 4 .el .IP "Warning: No collection \f(CW$name\fR" 4 .IX Item "Warning: No collection $name" The collection with \f(CW$name\fR does not exist and can not be created. .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Mail-Message distribution version 3.015, built on December 11, 2023. Website: \fIhttp://perl.overmeer.net/CPAN/\fR .SH LICENSE .IX Header "LICENSE" Copyrights 2001\-2023 by [Mark Overmeer ]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://dev.perl.org/licenses/\fR