From 0ea6a89dbe82beac4e09c4b87b5384cc338c7639 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Wed, 5 Dec 2007 16:43:33 +0000 Subject: [PATCH] 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 --- lib/Qpsmtpd/Address.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Qpsmtpd/Address.pm b/lib/Qpsmtpd/Address.pm index f1381e1..e313177 100644 --- a/lib/Qpsmtpd/Address.pm +++ b/lib/Qpsmtpd/Address.pm @@ -275,27 +275,35 @@ sub format { return "<".$self->address().">"; } -=head2 user() +=head2 user([$user]) Returns the "localpart" of the address, per RFC-2821, or the portion before the '@' sign. +If called with one parameter, the localpart is set and the new value is +returned. + =cut sub user { - my ($self) = @_; + my ($self, $user) = @_; + $self->{_user} = $user if defined $user; return $self->{_user}; } -=head2 host() +=head2 host([$host]) Returns the "domain" part of the address, per RFC-2821, or the portion after the '@' sign. +If called with one parameter, the domain is set and the new value is +returned. + =cut sub host { - my ($self) = @_; + my ($self, $host) = @_; + $self->{_host} = $host if defined $host; return $self->{_host}; }