$world->mlsend
$world->mlsend function: Multi-Line SEND
$success = $world->mlsend( |
attributes
) ; |
This function emulates the Multi-line Send feature (see Section 6.3.5, “Multi-line Send”) from perl scripts. Several lines can be sent at once, optionally prefixing and/or suffixing each line with text you specify. It's also possible to send the contents of a file to the MUD. The lines can be sent with customized intervals between them (so as not to cause buffer overflows that lead to a disconnection from the server).
atributes
is a reference to a hash
defining attributes for the timer. Generally the call works like
this:
$world->mlsend({ attribute1 => value1, attribute2 => value2, ... })
Possible attributes:
initialtext
: Lines of text to
be sent to the MUD before anything else. You can specify this
argument in two ways: one is as a string composed of several lines,
KildClient will split the string and send each line separately. The
second option is to pass a reference to an array, where each element
is a line.
The following two call are thus equivalent:
$world->mlsend({ initialtext => "First line\nSecond line\nLast line" })
$world->mlsend({ initialtext => [ "First line", "Second line", "Last line" ]})
file
: The path to a file whose
contents are to be sent, line by line, after sending the
initialtext
(if present), but before sending
finaltext
.
finaltext
: Lines to be sent after
the file contents has been sent (if a file was specified). This is
very similar to initialtext
, and can be given
also as a multi-line string or as a reference to an array of
lines.
linestart
: If present, specifies
a string that is prepended to each line as it is sent to the
MUD.
lineend
: If present, specifies a
string that is appended to each line as it is sent to the
MUD.
delay
: The delay, in seconds,
between each group of lines. If you are getting disconnected for
sending too much text at once, increase this value. If not given,
the value is taken from the Global Preferences (see Section 5.2, “Sending”).
linesatime
: The number of lines
to be sent at a time. If not given, the value is taken from the
Global Preferences (see Section 5.2, “Sending”).
On success, returns true. If the file does not exist or cannot
be open, this function does nothing and returns a false value. It
returns undef
if invalid parameters are
specified.
You might also want to see the $world->sendlines
and $world->sendfile
functions which are simpler ways of
sending several lines or the contents of a file at once,
respectively.