package require mypack 1.0
spawn telnet host
mypack::op1
mypack::op2
...
close
Is there anyway I can move the spawn into my package and have the package
track the session? I suppose I can pass a handle in and out, perhaps. Is
that the way to go?
BTW, I probably only ever have a single session but I suppose handling
multiples would be useful.
Cheers,
Paul DS
--
Please remove the "x-" if replying to sender.
On Fri, 29 Jul 2005, Paul D.Smith wrote:
> I have created a package of simple "telnet"ed commands but can't find a way
> to have a "session" span the package. Currently, my expect script locks
> like this...
>
> package require mypack 1.0
> spawn telnet host
> mypack::op1
> mypack::op2
> ...
> close
>
> Is there anyway I can move the spawn into my package and have the package
> track the session? I suppose I can pass a handle in and out, perhaps. Is
> that the way to go?
>
> BTW, I probably only ever have a single session but I suppose handling
> multiples would be useful.
>
You could check one of the OO package (itcl, snit or stooop).
It will easily allow to bind your spawned process
within an object instance.
The session could be opened in the constructor and closed in the destructor.
It is also an easy way to handle several expect session.
snit and stooop are pure tcl implementation and delivered within the tcl lib
=> no package compilation is required.
------------------------------
David Bariod
For email replace spam by tel
Thanks for the info. OO in TCL - no there's something new for me to look
into ;-).
Paul DS.