in reply to RSperl & threads
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.#!/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, 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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RSperl & threads
by sperlyjinx (Initiate) on Apr 14, 2008 at 04:09 UTC | |
by Anonymous Monk on Apr 23, 2008 at 23:29 UTC | |
by Anonymous Monk on Jul 12, 2008 at 15:23 UTC | |
by lsm (Initiate) on Jul 12, 2008 at 15:27 UTC | |
by amesdaq (Initiate) on Oct 21, 2010 at 18:56 UTC |