05-05-2005
seems like homework to me. If not forgive me, but How are you trying to apply this?
Give us something to work with.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am using system running on red hat linux 4.
I had connected health measuring machine to the serial port and configured it
stty -F /dev/ttyS0 9600 -parenb cs8 -cstopb
this machine requires a command to be passed to it for giving output. I am unable to pass command hexa format(0x68) to the... (4 Replies)
Discussion started by: netsavant
4 Replies
2. Solaris
I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I would like to know if it is possible to communicate between two terminals on seperate computers for free - e.g. not using proprietary software or using the built in UNIX terminals on operating systems of the UNIX flavor.
Thanks,
photray94 (2 Replies)
Discussion started by: photray94
2 Replies
4. Filesystems, Disks and Memory
Hi everybody
I need to find out the execution time of a proccess. how can I find it out?
Note that the proccess execution are snap.
Thanks in advance. (4 Replies)
Discussion started by: Zaxon
4 Replies
5. AIX
i want to know that my serial port ( pci slot with 2 port ) is working fine and communicating
is there any way to know the serialport is working and communicating?
please help (3 Replies)
Discussion started by: pchangba
3 Replies
6. Programming
$./a.out smtp.gmail.com 25
220 mx.google.com ESMTP 9sm2923369yxf.23
250 mx.google.com at your service
220 2.0.0 Ready to start TLS
after handshake
Common Name: smtp.gmail.com
after get cert dn
-----BEGIN SSL SESSION PARAMETERS-----... (0 Replies)
Discussion started by: darshan.ghumare
0 Replies
7. Shell Programming and Scripting
Hi All,
I have a requirment, i need to get the list of all the process which are running from last two days on my unix server and also to put this list into an another file.
i am giving you a sample example :
$ ps -ef
UID PID PPID C STIME TTY TIME CMD (1 Reply)
Discussion started by: akshu.agni
1 Replies
8. Shell Programming and Scripting
Hi, i was looking for an answer for some trouble im having runing a script in the cron, thing is, that when i run it manually it works just fine. But when cron runs it, it just doenst work. I saw a reply on a similar subject, suggesting that the . .profile worked for you, but im kind of... (0 Replies)
Discussion started by: blacksteel1988
0 Replies
9. Programming
I have a simple client/server program I am using for learning purposes.
I have it setup so that after server is setup and listening it than goes into a loop where it accepts incoming client connections. After each connection, the client socket is than passed to a thread routine where it can be... (3 Replies)
Discussion started by: Majortom71
3 Replies
10. Shell Programming and Scripting
I have a london-electronics LED sign I picked up on eBay which I would like to display custom messages on programmatically. It is working ok.
Opening it up, it has an ethernet to serial connection currently plugged in and a serial connection currently unplugged internally (same connectors).... (9 Replies)
Discussion started by: windswept321
9 Replies
LEARN ABOUT REDHAT
apache::subprocess
SUBPROCESS(1) User Contributed Perl Documentation SUBPROCESS(1)
NAME
Apache::SubProcess -- Executing SubProcesses from mod_perl
SYNOPSIS
use Apache::SubProcess ();
use Config;
use constant PERLIO_IS_ENABLED => $Config{useperlio};
# pass @ARGV / read from the process
$command = "/tmp/argv.pl";
@argv = qw(foo bar);
$out_fh = Apache::SubProcess::spawn_proc_prog($r, $command, @argv);
$output = read_data($out_fh);
# pass environment / read from the process
$command = "/tmp/env.pl";
$r->subprocess_env->set(foo => "bar");
$out_fh = Apache::SubProcess::spawn_proc_prog($r, $command);
$output = read_data($out_fh);
# write to/read from the process
$command = "/tmp/in_out_err.pl";
($in_fh, $out_fh, $err_fh) =
Apache::SubProcess::spawn_proc_prog($r, $command);
print $in_fh "hello
";
$output = read_data($out_fh);
$error = read_data($err_fh);
# helper function to work w/ and w/o perlio-enabled Perl
sub read_data {
my($fh) = @_;
my $data;
if (PERLIO_IS_ENABLED || IO::Select->new($fh)->can_read(10)) {
$data = <$fh>;
}
return defined $data ? $data : '';
}
DESCRIPTION
"Apache::SubProcess" provides the Perl API for running and communicating with processes spawned from mod_perl handlers.
API
spawn_proc_prog()
$out_fh =
Apache::SubProcess::spawn_proc_prog($r, $command, [@argv]);
($in_fh, $out_fh, $err_fh) =
Apache::SubProcess::spawn_proc_prog($r, $command, [@argv]);
spawn_proc_prog() spawns a sub-process which exec()'s $command and returns the output pipe filehandle in the scalar context, or input, out-
put and error pipe filehandles in the list context. Using these three pipes it's possible to communicate with the spawned process.
The third optional argument is a reference to an array which if passed becomes ARGV to the spawned program.
It's possible to pass environment variables as well, by calling:
$r->subprocess_env->set($key => $value);
before spawning the subprocess.
There is an issue with reading from the read filehandle ($in_fh)):
A pipe filehandle returned under perlio-disabled Perl needs to call select() if the other end is not fast enough to send the data, since
the read is non-blocking.
A pipe filehandle returned under perlio-enabled Perl on the other hand does the select() internally, because it's really a filehandle
opened via ":APR" layer, which internally uses APR to communicate with the pipe. The way APR is implemented Perl's select() cannot be used
with it (mainly because select() wants fileno() and APR is a crossplatform implementation which hides the internal datastructure).
Therefore to write a portable code, you want to use select for perlio-disabled Perl and do nothing for perlio-enabled Perl, hence you can
use something similar to the read_data() wrapper shown in the SYNOPSIS section.
perl v5.8.0 2002-09-02 SUBPROCESS(1)