Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Expect, sessions and packages

7 views
Skip to first unread message

Paul D.Smith

unread,
Jul 29, 2005, 4:33:31 AM7/29/05
to
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.

Cheers,
Paul DS


--
Please remove the "x-" if replying to sender.


dba...@norspam.com

unread,
Aug 1, 2005, 5:42:54 AM8/1/05
to

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

Paul D.Smith

unread,
Aug 2, 2005, 3:46:10 AM8/2/05
to
> 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
>
David,

Thanks for the info. OO in TCL - no there's something new for me to look
into ;-).

Paul DS.


0 new messages