[AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Andrew Piskorski
I have an Expect script which I'm exec'ing from AOLserver.  This
works, and the inefficiency of forking doesn't really matter in this
case.  But it's annoying, as it means I can only communicate with the
Expect script via command line arguments and stdin/stdout/stderr.

I'd much rather just have the Expect Tcl API directly available in
AOLserver.  But is that in fact feasible?  Is there any version of
Expect which can be dynamically loaded into AOLserver (or plain tclsh
for that matter), via 'package require', the modules list in
AOLserver's config file, or some other such mechanism?  For AOLserver
3.3, or 4.0?

--
Andrew Piskorski [EMAIL PROTECTED]
http://www.piskorski.com


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Brett Schwarz
I haven't tried it from AS, but I always load Expect from within tclsh:

this works for me:

package require Expect

If  you are on  Windows, then I think the Expect for windows is still a
little shaky...



On Sun, 2003-09-14 at 12:44, Andrew Piskorski wrote:
 I have an Expect script which I'm exec'ing from AOLserver.  This
 works, and the inefficiency of forking doesn't really matter in this
 case.  But it's annoying, as it means I can only communicate with the
 Expect script via command line arguments and stdin/stdout/stderr.

 I'd much rather just have the Expect Tcl API directly available in
 AOLserver.  But is that in fact feasible?  Is there any version of
 Expect which can be dynamically loaded into AOLserver (or plain tclsh
 for that matter), via 'package require', the modules list in
 AOLserver's config file, or some other such mechanism?  For AOLserver
 3.3, or 4.0?

 --
 Andrew Piskorski [EMAIL PROTECTED]
 http://www.piskorski.com


 --
 AOLserver - http://www.aolserver.com/

 To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with 
 the
 body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field 
 of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Nathan Folkman
This should work with AOLserver 4.0 assuming the Expect package is
thread-safe.

- Nathan

Brett Schwarz wrote on 9/14/03, 4:00 PM:

  package require Expect


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Wojciech Kocjan
Andrew Piskorski wrote:

I have an Expect script which I'm exec'ing from AOLserver.  This
works, and the inefficiency of forking doesn't really matter in this
case.  But it's annoying, as it means I can only communicate with the
Expect script via command line arguments and stdin/stdout/stderr.
I'd much rather just have the Expect Tcl API directly available in
AOLserver.  But is that in fact feasible?  Is there any version of
Expect which can be dynamically loaded into AOLserver (or plain tclsh
for that matter), via 'package require', the modules list in
AOLserver's config file, or some other such mechanism?  For AOLserver
3.3, or 4.0?
My guess is that you really should separate expect scripts from
AOLserver. If you really have to, you can create a separate thread,
communicate with it and have it do all the expect commands (to avoid
some of thread safety :).
Although it would be better to spawn another process and communicate via
tcp/ip or perhaps using http (tclhttpd+expect should work quite nice :).
I usually work with a separate thread, for example my antivirus scanner
has a separate thread, which does [open |mks32] and communicates with it.
--
WK
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Lane S. Wimberley
Nathan Folkman writes:
 This should work with AOLserver 4.0 assuming the Expect package is
 thread-safe.

Coincidentally, I recently tried this (and even loaded/used Expect in
a separate thread).   Aolserver crashed hard.  I seem to recall that I
tried several different things, including the latest versions of both
Expect and Aolserver, but no luck.

I recall searching around for any info on Expect thread safety, and
someone (Don Libes?) said that they had gotten it (ie, a thread-safe
implementation Expect) close, but never completed the work.

In the end, I aborted and implemented what I needed (a port of legacy
non-Aolserver code originally implemented using Expect) in Aolserver
in a completely different way -- ie, rewrite.

-Lane

___
Lane Wimberley 8303 N. MoPac, Suite A-300  Austin, TX 78759
Wayport, Inc.512.519.6195 (voice)512.519.6200 (fax)

- The majority of men...are not capable of thinking, but only of believing, and...are 
not accessible to reason, but only to authority.
 Arthur Schopenhauer:
 Supplements to the World as Will and Idea.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Jeff Hobbs
 I have an Expect script which I'm exec'ing from AOLserver.  This
 works, and the inefficiency of forking doesn't really matter in this
 case.  But it's annoying, as it means I can only communicate with the
 Expect script via command line arguments and stdin/stdout/stderr.

 I'd much rather just have the Expect Tcl API directly available in
 AOLserver.  But is that in fact feasible?  Is there any version of
 Expect which can be dynamically loaded into AOLserver (or plain tclsh
 for that matter), via 'package require', the modules list in
 AOLserver's config file, or some other such mechanism?  For AOLserver
 3.3, or 4.0?

Expect is not a thread-safe extension.  It would be easy to make
thread-safe with large locks (which you could even do with the
tcl level apis), but fine-grained thread-safety would be hard due
to the type of unix APIs used.

That said, you should be able to make it work, but I would recommend
a pass through the APIs for gross thread-safety abuses first.

  Jeff Hobbs The Tcl Guy
  Senior Developer   http://www.ActiveState.com/
  Tcl Support and Productivity Solutions


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.


Re: [AOLSERVER] Expect in AOLserver?

2003-09-14 Thread Andrew Piskorski
On Sun, Sep 14, 2003 at 04:51:38PM -0700, Jeff Hobbs wrote:

 Expect is not a thread-safe extension.  It would be easy to make
 thread-safe with large locks (which you could even do with the
 tcl level apis), but fine-grained thread-safety would be hard due
 to the type of unix APIs used.

 That said, you should be able to make it work, but I would recommend
 a pass through the APIs for gross thread-safety abuses first.

In that case, I won't be doing it, not right now anyway, as I don't
anticipate using Expect much more than for this one thing I already
have an exec solution for.

But, it does sounds like something I might want to do sometime in the
future, so:  How sure are you that JUST adding mutex locks around
chunks of Expect code would fix the thread-safety?  Or would some of
these locks likely need to be coordinated with AOLserver locks?

AOLserver does some of its own internal mutex locking of non
thread-safe library calls (maybe other resources too, I don't know),
so I'd worry about Expect trying to call some of the same stuff, but
not using the same lock...  In which case the thread-safety problem
should still be solvable, but noticeably more difficult, as AOLserver
and Expect have to be made to share a lock.  I've seen this before
with other code.

Actually, what is Tcl's mechanism for coordinating such locking across
multiple C coded Tcl extensions?  Does it have one?

--
Andrew Piskorski [EMAIL PROTECTED]
http://www.piskorski.com


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of 
your email blank.