From: HACKATHORN, T. \(SWBT\) <th...@at...> - 2006-12-20 21:43:11
|
Hello, I am new to this group, but have been using Expect for Perl for some time now. I am starting to think what I am trying to do is not going to work, so I thought I would ask the experts. =20 What I am doing is: I use expect for Perl in centos 4.4, and Perl 5.8.5 I have a wrapper that makes a object by spawning a s3270 process and allowing a interface like get_string($row, $col, $len), put_string($str, $row, $col) and so on.... All that has worked great for some time. =20 I am trying to create a "connection manager" of sorts, it would keep 3 live connections up logged in and ready to go at all times, then when my client programs need a connection to our legacy 3270 systems, it would be able to ask for an existing connection and start running with out the overhead time of logging in. Sounds easy enough. Where I am stuck is getting an Expect object to move from one process to another. I have tried IPC::Sharable but it keeps giving me an error saying it can't use a GLOB, I guess that is what a reference to the Expect object is. My question is does anyone here know of a way I can convert this Expect object to a reference that can be passed in this way? Or is there a way I can export the connection as a normal file handle, and pass that reference to the other process and init a new Expect object on a existing connection(already logged in)? =20 I have though about making a client/server set up through TCP, the server would open a connection, and do what ever is needed to keep it alive, then the "worker processes" could send it simple request to put, and get strings and what not. But that seems like a lot of overhead. I already have a fair amount of overhead. I don't really want to go down the road of writing my own 3270 emulator from scratch, the s3270 already works well. =20 I greatly appreciate any advice, or suggestions you can give. =20 Thanks, =20 Todd Hackathorn Th...@at... =20 |
From: Austin S. <te...@of...> - 2006-12-20 22:10:55
|
On Wed, Dec 20, 2006 at 03:42:56PM -0600, HACKATHORN, TODD (SWBT) wrote: > > I am trying to create a "connection manager" of sorts, it would keep 3 > live connections up logged in and ready to go at all times, then when my > client programs need a connection to our legacy 3270 systems, it would > be able to ask for an existing connection and start running with out the > overhead time of logging in. This sounds a lot like screen. If I were to try something like this, I would figure out how to do it manually using screen and then figure out how to interface expect with screen. > Sounds easy enough. Where I am stuck is > getting an Expect object to move from one process to another. I have > tried IPC::Sharable but it keeps giving me an error saying it can't use > a GLOB, I guess that is what a reference to the Expect object is. My > question is does anyone here know of a way I can convert this Expect > object to a reference that can be passed in this way? Or is there a way > I can export the connection as a normal file handle, and pass that > reference to the other process and init a new Expect object on a > existing connection(already logged in)? an Expect object is a glob reference. A glob is what perl uses to hold other data types, more or less. This is useful because there is no "filehandle" data type native to perl 5, so filehandles are accessed via their glob. Some things, such as print(), will automatically dereference the glob when you call them, such as 'print $expect "sending this to expect";'. Other processes don't expect a reference, so you need to dereference the glob before you pass it to the receiving sub, e.g. my_print(*$expect, "print this using the dereferenced glob"); > I have though about making a client/server set up through TCP, the > server would open a connection, and do what ever is needed to keep it > alive, then the "worker processes" could send it simple request to put, > and get strings and what not. But that seems like a lot of overhead. I > already have a fair amount of overhead. I don't really want to go down > the road of writing my own 3270 emulator from scratch, the s3270 already > works well. > Sounds like work. Again, I would use screen, then maybe have some aliased script which would access screen. You could have users do something like 'ssh terminalhost screenscript' for access. Or whatever makes sense. Austin |
From: HACKATHORN, T. \(SWBT\) <th...@at...> - 2006-12-21 13:48:49
|
Austin, Thanks for the idea. I don't think screen will work for my needs based on the documentation I read about it. This system is meant to be non-interactive. A script runs and interacts with databases, and does automated screen scraping, to a 3270 terminal. Really no need for additional terminals, or a way for someone to interact with the script. Usually these scripts run many times a day, on systems that are not even logged in, I use the s3270 so it doesn't have to create a window at all. I have found that is faster that way. Dereferencing sounds like what I need to do, but I am not familiar with how to do that. Can you give any further information about the syntax of dereferencing a glob? Thanks, Todd Hackathorn Th...@at... -----Original Message----- From: Austin Schutz [mailto:te...@of...]=20 Sent: Wednesday, December 20, 2006 4:06 PM To: HACKATHORN, TODD (SWBT) Cc: exp...@li... Subject: Re: [Expectperl-discuss] Connection Manager using Expect On Wed, Dec 20, 2006 at 03:42:56PM -0600, HACKATHORN, TODD (SWBT) wrote: >=20 > I am trying to create a "connection manager" of sorts, it would keep 3 > live connections up logged in and ready to go at all times, then when my > client programs need a connection to our legacy 3270 systems, it would > be able to ask for an existing connection and start running with out the > overhead time of logging in. This sounds a lot like screen. If I were to try something like this, I would figure out how to do it manually using screen and then figure out how to interface expect with screen. > Sounds easy enough. Where I am stuck is > getting an Expect object to move from one process to another. I have > tried IPC::Sharable but it keeps giving me an error saying it can't use > a GLOB, I guess that is what a reference to the Expect object is. My > question is does anyone here know of a way I can convert this Expect > object to a reference that can be passed in this way? Or is there a way > I can export the connection as a normal file handle, and pass that > reference to the other process and init a new Expect object on a > existing connection(already logged in)? an Expect object is a glob reference. A glob is what perl uses to hold other data types, more or less. This is useful because there is no "filehandle" data type native to perl 5, so filehandles are accessed via their glob. Some things, such as print(), will automatically dereference the glob when you call them, such as 'print $expect "sending this to expect";'. Other processes don't expect a reference, so you need to dereference the glob before you pass it to the receiving sub, e.g.=20 my_print(*$expect, "print this using the dereferenced glob"); > I have though about making a client/server set up through TCP, the > server would open a connection, and do what ever is needed to keep it > alive, then the "worker processes" could send it simple request to put, > and get strings and what not. But that seems like a lot of overhead. I > already have a fair amount of overhead. I don't really want to go down > the road of writing my own 3270 emulator from scratch, the s3270 already > works well. >=20 Sounds like work. Again, I would use screen, then maybe have some aliased script which would access screen. You could have users do something like 'ssh terminalhost screenscript' for access. Or whatever makes sense. Austin |
From: Austin S. <te...@of...> - 2006-12-22 03:08:18
|
On Thu, Dec 21, 2006 at 07:48:38AM -0600, HACKATHORN, TODD (SWBT) wrote: > Austin, > Thanks for the idea. > I don't think screen will work for my needs based on the documentation I > read about it. This system is meant to be non-interactive. A script > runs and interacts with databases, and does automated screen scraping, > to a 3270 terminal. Really no need for additional terminals, or a way > for someone to interact with the script. The basic use of screen is to detach active terminals so you can go back to them later. That sounds a lot like what you are considering. > Dereferencing sounds like what I need to do, but I am not familiar with > how to do that. Can you give any further information about the syntax > of dereferencing a glob? > > > my_print(*$expect, "print this using the dereferenced glob"); > Austin |
From: Roland G. <rgi...@cp...> - 2006-12-22 12:33:25
|
Moving Expect objects between processes would mean moving open filehandles between processes, which IS possible on some architectures; but I don't know of a perl module that does that. This definitively would have a lot hack-value, but I doubt that it warrants the trouble... ;-) So yes, your idea with a connection manager server seems the most feasible.= .. Best regards, Roland On 12/20/06, HACKATHORN, TODD (SWBT) <th...@at...> wrote: > > > > > Hello, > > I am new to this group, but have been using Expect for Perl for some time > now. I am starting to think what I am trying to do is not going to work,= so > I thought I would ask the experts. > > > > What I am doing is: > > I use expect for Perl in centos 4.4, and Perl 5.8.5 I have a wrapper that > makes a object by spawning a s3270 process and allowing a interface like > get_string($row, $col, $len), put_string($str, $row, $col) and so on=85. = All > that has worked great for some time. > > > > I am trying to create a "connection manager" of sorts, it would keep 3 li= ve > connections up logged in and ready to go at all times, then when my clien= t > programs need a connection to our legacy 3270 systems, it would be able t= o > ask for an existing connection and start running with out the overhead ti= me > of logging in. Sounds easy enough. Where I am stuck is getting an Expec= t > object to move from one process to another. I have tried IPC::Sharable b= ut > it keeps giving me an error saying it can't use a GLOB, I guess that is w= hat > a reference to the Expect object is. My question is does anyone here kno= w > of a way I can convert this Expect object to a reference that can be pass= ed > in this way? Or is there a way I can export the connection as a normal f= ile > handle, and pass that reference to the other process and init a new Expec= t > object on a existing connection(already logged in)? > > > > I have though about making a client/server set up through TCP, the server > would open a connection, and do what ever is needed to keep it alive, the= n > the "worker processes" could send it simple request to put, and get strin= gs > and what not. But that seems like a lot of overhead. I already have a f= air > amount of overhead. I don't really want to go down the road of writing m= y > own 3270 emulator from scratch, the s3270 already works well. > > > > I greatly appreciate any advice, or suggestions you can give. > > > > Thanks, > > > > Todd Hackathorn > > Th...@at... > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share y= our > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > |