Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I was just meditating last night, and thought about your problem. I had a thought( better duck :-) ). If the RSPerl is an interpreter, which you send commands to stdin and get results out of stdout, you probably should run it thru IPC::Open3. I have sample code below
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; $|=1; #my $pid=open3(\*IN,\*OUT,\*ERR,'/bin/bash'); my $pid=open3(\*IN,\*OUT,0,'/bin/bash'); # set \*ERR to 0 to send STDERR to STDOUT my $cmd = 'date'; #my $cmd = 'top'; #send cmd to bash print IN "$cmd\n"; #getresult my $result = <OUT>; print $result;
Now you should be able to do a similar thing with the RSPerl interpreter. Of course, in a real script, you may want to separate stdout and stderr, and use IO::Select. Search for examples of IPC::Open3 for more detailed usage.

Now, once you get IPC::Open3 to run the interpreter, you can put the code into a thread, and pass in strings to be eval'd thru ther shared variable mechanism.


I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: RSperl & threads by zentara
in thread RSperl & threads by sperlyjinx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-24 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found