Made user() and host() setters as well as getters.

Suggested by mpelzer@gmail.com.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@824 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Peter J. Holzer 2007-12-05 16:43:33 +00:00
parent cfa23dedec
commit 0ea6a89dbe

View File

@ -275,27 +275,35 @@ sub format {
return "<".$self->address().">"; return "<".$self->address().">";
} }
=head2 user() =head2 user([$user])
Returns the "localpart" of the address, per RFC-2821, or the portion Returns the "localpart" of the address, per RFC-2821, or the portion
before the '@' sign. before the '@' sign.
If called with one parameter, the localpart is set and the new value is
returned.
=cut =cut
sub user { sub user {
my ($self) = @_; my ($self, $user) = @_;
$self->{_user} = $user if defined $user;
return $self->{_user}; return $self->{_user};
} }
=head2 host() =head2 host([$host])
Returns the "domain" part of the address, per RFC-2821, or the portion Returns the "domain" part of the address, per RFC-2821, or the portion
after the '@' sign. after the '@' sign.
If called with one parameter, the domain is set and the new value is
returned.
=cut =cut
sub host { sub host {
my ($self) = @_; my ($self, $host) = @_;
$self->{_host} = $host if defined $host;
return $self->{_host}; return $self->{_host};
} }