binhvanpham has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I created a server which communicates with several applications using Perl sockets. These applications have their own shell in tcl. How can I access the native data in these applications directly from within my server which is created in Perl? Would you please help? You don't have to give me the solution, please just point me to the right resource. Thank you very much,

Replies are listed 'Best First'.
Re: Socket shell ...
by ww (Archbishop) on Jun 24, 2010 at 23:32 UTC
    Not to be snide, but, "No, we certainly don't have to give you the solution" but we still love to see some evidence that the individual raising a question has put some effort into the problem.

    In this case, the lack of any description of the "native data" is one obstacle to providing assistance. So too is the lack of a spec for what you mean by asking how to "access" that data... and third, you give us no hint of the existing capabilities of your server.

    All told, that's a pretty high hurdle for the Monks who have many calls for help with clearer specs and obvious effort by the OP.

Re: Socket shell ...
by cdarke (Prior) on Jun 25, 2010 at 08:14 UTC
    You cannot access data in other processes (I guess that's what you mean by shell) unless that process wants you to. Well there are hokey ways using debugger techniques, but you probably don't want to go there, and it would involve C and knowing TCL internals. So you have to use some Inter Process Communication method, and using sockets is one way, but the client must take an active part in sending that data.

    I'm guessing that your problem is that the data in the clients is TCL, whereas your server is written in Perl. You will have to convert at each end into a common format, and text strings should do the trick. At the Perl end you can use pack and unpack to convert binary data if need be. An alternative mechanism is to use shared memory shmem but there is work to be done with synchronisation, and it can get very messy - and I have no idea if TCL supports it.
Re: Socket shell ...
by affc (Scribe) on Jun 24, 2010 at 23:38 UTC
    I'm not sure about your meaning of shell but, with sockets involved, just use them (reading/writing). If your server app needs data from other applications, those applications have to write it to the corresponding sockets.

    Am I missing anything here?

Re: Socket shell ...
by Proclus (Beadle) on Jun 26, 2010 at 10:13 UTC
    I would take a look at POE. POE will handle all socket, server and process work for you in a nonblocking manner. POE is a huge framework. If you can give more details and show some code, I can point you to the modules you can use.