it before actually spawning a command. This is important
if you want
to modify the terminal settings for the slave. See slave()
below.
The object returned is actually a reblessed IO::Pty
filehandle, so see
there for additional methods.
=item Expect->exp_init(\*FILEHANDLE) I<or>
=item Expect->init(\*FILEHANDLE)
Initializes $new_handle_object for use with other Expect
functions. It must
be passed a B<_reference_> to FILEHANDLE if you want it to
work properly.
IO::File objects are preferable. Returns a reference to the
newly created
object.
=item Expect->spawn($command, @parameters) I<or>
=item $object->spawn($command, @parameters) I<or>
=item new Expect ($command, @parameters)
Forks and execs $command. Returns an Expect object upon
success or
C<undef> if the fork was unsuccessful or the command could
not be
found. spawn() passes its parameters unchanged to Perls
exec(), so
look there for detailed semantics.
Note that if spawn cannot exec() the given command, the
Expect object
is still valid and the next expect() will see "Cannot exec",
so you
can use that for error handling.
Also note that you cannot reuse an object with an already
spawned
command, even if that command has exited. Sorry, but you
have to
allocate a new object...
评论2
最新资源