NetServer-SMTP
view release on metacpan or search on metacpan
244245246247248249250251252253254255256257258259260261262263264sub
initialise {
=pod
=item initialise()
Called by B<new()> to initialise the new object. Initialisation keys
may be specified as a hash, supplied as a parameter to the new
object, or as a filename or file handle containing a frozen
B<NetServer::SMTP> object which is users to overlay the object.
Recognized keys are:
=over 4
=item myhost
My host name (FQDN)
=item allowed
295296297298299300301302303304305306307308309310311312313314315
my
(
$fn
) =
shift
;
if
(
ref
(
$fn
) !~ /file/i) {
$file
= new IO::File(
$fn
,
"r"
) or croak
"Could not open $fn\n"
;
}
my
(
$frozen
) =
join
(
""
,
$file
->getlines() );
$file
->
close
();
(
$self
,
@junk
) = thaw(
$frozen
);
$self
->{spooledfile} =
$fn
;
return
$self
;
}
elsif
(
scalar
(
@_
) % 2 == 0) {
# it's an initialisation hash -- overlay it on $self
%$self
= (
@_
);
return
$self
;
}
else
{
croak
"Don't know how to initialise from ["
,
join
(
"]["
,
@_
),
"]\n"
;
}
}
sub
respond ($$;@) {
# issue a response code and the corresponding message
# NOTE: SMTP response messages are printf() format strings and
( run in 0.223 second using v1.01-cache-2.11-cpan-8d75d55dd25 )