Re: Script to fork, send data to parent via a tcp conn

2016-05-16 Thread Jim Gibson
rough the loop, the socket will be busy. As Uri suggested, you need to do the listen before the loop so you only do it once. Each iteration of the loop should fork, and the child branch should connect to the socket created by the parent process. The parent branch should do nothing in the loop

Re: Script to fork, send data to parent via a tcp conn

2016-05-16 Thread Unknown User
> > Can you connect? > > On May 14, 2016, at 3:56 PM, Unknown User > wrote: > >>I wrote this scrpt to fork off a few child processes, then the child >>processes process some data, and send the data back to the parent >>through a tcp socket. >>This is not

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread lee
Unknown User writes: > I wrote this scrpt to fork off a few child processes, then the child > processes process some data, and send the data back to the parent > through a tcp socket. > This is not working as i expected it would. Why not? How can it be corrected? > > > #!/

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Uri Guttman
On 05/13/2016 11:30 AM, Unknown User wrote: I wrote this scrpt to fork off a few child processes, then the child processes process some data, and send the data back to the parent through a tcp socket. This is not working as i expected it would. Why not? How can it be corrected? there are many

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Jon E Price
Perhaps port 8989 is in use? Have you tried >telnet 127.0 0.1 8989 Can you connect? On May 14, 2016, at 3:56 PM, Unknown User wrote: >I wrote this scrpt to fork off a few child processes, then the child >processes process some data, and send the data back to the parent >t

Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Unknown User
I wrote this scrpt to fork off a few child processes, then the child processes process some data, and send the data back to the parent through a tcp socket. This is not working as i expected it would. Why not? How can it be corrected? #!/usr/bin/perl -w use strict; use IO::Socket::INET; print

Re: How do I fork a process and return results to the user?

2015-08-30 Thread Shlomi Fish
Hi G, please reply to all recipients. On Sun, 30 Aug 2015 21:47:47 + G M wrote: > Hi, > Can anyone help me with this? > I have two scripts, the first one calls the exec command which then invokes > the second script. The second script then creates a fork process. The child

How do I fork a process and return results to the user?

2015-08-30 Thread G M
Hi, Can anyone help me with this? I have two scripts, the first one calls the exec command which then invokes the second script. The second script then creates a fork process. The child process in the fork does a webservice query which may take a few minutes to return results. What I want to

Re: Perl Fork and writing to stdout

2011-10-18 Thread John W. Krahn
t the counter to zero. We'll print the counter to the log for easier sorting # --- of data where the ssh connections take longer than a minute to return. my $ct = 0; while (1) { my $pid = fork(); if ($pid) { # parent } elsif ($pid == 0) { # child

Re: Perl Fork and writing to stdout

2011-10-18 Thread Brandon McCaig
ngs' pragma too. :) > $|++; Well I'm out of ideas. :P > if ($pid) { ># parent > } elsif ($pid == 0) { ># child >my $p = _initialize($ct); >waitpid($p, 0); >exit 0; > } else { >die "couldnt fork: $!\n"; > } nitpick:

Perl Fork and writing to stdout

2011-10-18 Thread sunckell
27;r'} : die "need remote host <-r> \n"; my $debug = $opts{'d'}; my $short_name = basename("$0", ".pl"); # --- set the counter to zero. We'll print the counter to the log for easier sorting # --- of data where the ssh conn

how to fork mysqldump in perl cgi script

2011-08-03 Thread Agnello George
connection time out my script breaks , i was told to use fork , but i cant seem to get a workable example of forking process . Can some one help me with this . Thanks a million ( below is my code ) #!/usr/bin/perl use strict ; use warnings ; use

RE: Excessive wait time after fork

2011-04-06 Thread TAO, NENGBING [AG/1005]
- From: TAO, NENGBING [AG/1005] Sent: Saturday, April 02, 2011 11:07 AM To: 'beginners-digest-h...@perl.org'; beginners@perl.org Subject: Excessive wait time after fork Hi, I noticed that after fork, the wait time is excessive (my other test waited for hours). Is this a known

RE: Excessive wait time after fork

2011-04-06 Thread TAO, NENGBING [AG/1005]
id show that less than half of the total memory is used. So I don't believe the server is swamped. Thanks -Original Message- From: Chas. Owens [mailto:chas.ow...@gmail.com] Sent: Monday, April 04, 2011 6:40 AM To: TAO, NENGBING [AG/1005] Cc: beginners-digest-h...@perl.org; begi

Re: Excessive wait time after fork

2011-04-04 Thread Chas. Owens
On Sat, Apr 2, 2011 at 12:06, TAO, NENGBING [AG/1005] wrote: > Hi, > >        I noticed that after fork, the wait time is excessive (my other > test waited for hours). Is this a known problem, how to get around it? snip > child 3 AFTER  sub call :Sat Apr  2 10:45:01 2011 numKeys:40

Excessive wait time after fork

2011-04-04 Thread TAO, NENGBING [AG/1005]
Hi, I noticed that after fork, the wait time is excessive (my other test waited for hours). Is this a known problem, how to get around it? This happens with ForkManager module also. Any pointers on what's going on is appreciated!

Re: Fork ssh

2010-06-20 Thread C.DeRykus
On Jun 17, 7:51 pm, dery...@gmail.com ("C.DeRykus") wrote: > On Jun 16, 7:34 pm, knowsuperunkn...@gmail.com (Unknown User) wrote: > > > > > Hi > > > I wrote the following script to fork ssh processes with perl and > > Parallel::ForkManager: > > &g

Re: Fork ssh

2010-06-18 Thread Kenneth Wolcott
Hi; I've been using IPC::Run3 from CPAN for about six months and it works great! Ken Wolcott

Re: Fork ssh

2010-06-18 Thread C.DeRykus
On Jun 16, 7:34 pm, knowsuperunkn...@gmail.com (Unknown User) wrote: > Hi > > I wrote the following script to fork ssh processes with perl and > Parallel::ForkManager: > > #!/usr/local/bin/perl -w > use strict; > > my @cmd = "@ARGV"; > use Parallel::ForkM

Re: Fork ssh

2010-06-18 Thread Salvador Fandino
On 06/17/2010 04:34 AM, Unknown User wrote: This works pretty well, but Since There is More than One Way to DO it, i wonder if anyone has another version that does not use fork? There is Net::OpenSSH::Parallel. - Salva -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

Re: Fork ssh

2010-06-16 Thread John W. Krahn
Unknown User wrote: Hi Hello, I wrote the following script to fork ssh processes with perl and Parallel::ForkManager: #!/usr/local/bin/perl -w use strict; my @cmd = "@ARGV"; Why would you use an array to store a single scalar value? Either: my $cmd = "@ARGV";

Re: Fork ssh

2010-06-16 Thread Jeff Pang
2010/6/17 Unknown User : > > > This works pretty well, but Since There is More than One Way to DO it, > i wonder if anyone has another version that does not use fork? > Just use the right one for you. Instead of processes, the Threads and Coro may also do that well. Regards. --

Fork ssh

2010-06-16 Thread Unknown User
Hi I wrote the following script to fork ssh processes with perl and Parallel::ForkManager: #!/usr/local/bin/perl -w use strict; my @cmd = "@ARGV"; use Parallel::ForkManager; my @nodes; open(NODE,") { chomp; push(@nodes,$_); } my $pm = new Parallel:

Re: Setting SIG{CHLD} to IGNORE in fork() changes result of system() call

2010-05-18 Thread C.DeRykus
On May 17, 12:35 pm, kelly.terry.jo...@gmail.com (Kelly Jones) wrote: > These 3 lines of code: > > if (fork()) {sleep 10; exit(0);} > $SIG{'CHLD'} = 'IGNORE'; > exit(system("/usr/lib/nagios/plugins/check_ping -H google.com -w > 500,20% -c 1000,40%

Setting SIG{CHLD} to IGNORE in fork() changes result of system() call

2010-05-17 Thread Kelly Jones
These 3 lines of code: if (fork()) {sleep 10; exit(0);} $SIG{'CHLD'} = 'IGNORE'; exit(system("/usr/lib/nagios/plugins/check_ping -H google.com -w 500,20% -c 1000,40% 1> /tmp/stdout.txt 2> /tmp/stderr.txt; echo $? > /tmp/res.txt")); return "PING WA

Re: fork, parallel and global values

2010-05-15 Thread raphael()
don't need to update >> global value like downloading >> multiple files at the same time. I want something like above that forks >> while updating global values. >> Are threads/fork what I am looking for? >> > > If you have a list of file names that need to b

Re: fork, parallel and global values

2010-05-14 Thread Dr.Ruud
thing like above that forks while updating global values. Are threads/fork what I am looking for? If you have a list of file names that need to be processed, and that can be handled independently, then always go for fork-join, don't even consider threading. The parent will detect when th

Re: fork, parallel and global values

2010-05-13 Thread raphael()
> > > > I want to do work on all elements of an array simultaneously. > > I tried Parallel::ForkManager. It works well when you don't need to > update > > global value like downloading > > multiple files at the same time. I want something like above that fo

Re: fork, read from child process and timeout

2010-05-13 Thread C.DeRykus
On May 11, 9:29 pm, dery...@gmail.com ("C.DeRykus") wrote: > On May 11, 12:56 am, weizhong@gmail.com (Weizhong Dai) wrote: > >> ... > > $pid = open(my $readme, "program arguments |") >                   or die "Couldn't fork: $!\n";

Re: fork, read from child process and timeout

2010-05-12 Thread C.DeRykus
On May 11, 12:56 am, weizhong@gmail.com (Weizhong Dai) wrote: > Hi all, > > - > $pid = open(README, "program arguments |")  or die "Couldn't fork: $!\n"; > while () { >     # ...} > > close(README) >

Re: fork, parallel and global values

2010-05-11 Thread C.DeRykus
t keys %hash; > > print "hash is undef\n" unless %hash; > > --- END --- > > I want to do work on all elements of an array simultaneously. > I tried Parallel::ForkManager. It works well when you don't need to update > global value like downloadin

AW: fork, read from child process and timeout

2010-05-11 Thread Thomas Bätzler
Weizhong Dai asked: > - > $pid = open(README, "program arguments |") or die "Couldn't fork: > $!\n"; > while () { > # ... > } > close(README) > -- > > my problem is

Re: fork, read from child process and timeout

2010-05-11 Thread Jeff Pang
2010/5/11 Weizhong Dai : > Hi all, > > - > $pid = open(README, "program arguments |")  or die "Couldn't fork: $!\n"; > while () { >    # ... > } > close(README) > -- > > m

fork, read from child process and timeout

2010-05-11 Thread Weizhong Dai
Hi all, - $pid = open(README, "program arguments |") or die "Couldn't fork: $!\n"; while () { # ... } close(README) -- my problem is: I read from README, but if waiting for next input is timeout,

Re: fork, parallel and global values

2010-05-10 Thread raphael()
On Tue, May 11, 2010 at 1:59 AM, Eric Veith1 wrote: > "raphael()" wrote on 05/10/2010 04:07:58 PM: > > I want to do work on all elements of an array simultaneously. > > To clarify: You want to access an hash defined in the parent process from > all N child processes? > > I'm sorry to tell you, b

Re: fork, parallel and global values

2010-05-10 Thread Eric Veith1
"raphael()" wrote on 05/10/2010 04:07:58 PM: > I want to do work on all elements of an array simultaneously. To clarify: You want to access an hash defined in the parent process from all N child processes? I'm sorry to tell you, but this won't work so easily. When forking, data is *copied*. Whic

fork, parallel and global values

2010-05-10 Thread raphael()
er. It works well when you don't need to update global value like downloading multiple files at the same time. I want something like above that forks while updating global values. Are threads/fork what I am looking for? Any help would be *appreciated.*

Re: Different approaches for Daemon and fork/thread

2010-02-01 Thread Peter Scott
On Mon, 01 Feb 2010 01:26:23 -0600, Alvaro Mantilla Gimenez wrote: > I need to create a perl daemon that split in two process (each has > different data input) and then they split in as many child > (fork)/threads as need it. > >

Different approaches for Daemon and fork/thread

2010-01-31 Thread Alvaro Mantilla Gimenez
Hello, I need to create a perl daemon that split in two process (each has different data input) and then they split in as many child (fork)/threads as need it. Daemon | - | | Process 1 Process 2

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
s. Another problem solved!!! Till next time! --- On Wed, 5/27/09, Chas. Owens wrote: > From: Chas. Owens > Subject: Re: variables gets shared to child but resets back after exiting fork > To: "Michael Alipio" > Cc: "begginers perl.org" > Date: Wedn

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 07:24, Michael Alipio wrote: > > Sorry about the indention... must be the mail client i'm using. > I need to fork because the external program I want to run inside the child > runs infinitely. I want to have a timer running in the parent and after that,

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
Sorry about the indention... must be the mail client i'm using. I need to fork because the external program I want to run inside the child runs infinitely. I want to have a timer running in the parent and after that, kill the child. Without forking, I have to do a pkill myprogname I'

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Chas. Owens
do is: > > my @array; > die "Cannot fork myprog" unless (defined my $pid = fork) > if ($pid==0){ > open MYPROG, "myprog |" or die "Cant run myprog"; > my $timeout = 0; > while (){ > exit(0) if $timeout == 3; > push @array, $_; > sleep 1; >

variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
Hi, I have to run an external program but the program does not termination on some conditions, e.g, ping, will not exit unless you specify -c or some other circumstances. Now I what I want to do is: my @array; die "Cannot fork myprog" unless (defined my $pid = fork) if ($pid

Learning to 'fork()' the right way

2009-03-26 Thread Ron Smith
Hello all, I'd like to learn how to use fork properly. I'm monitoring a running process and when it stops, I use a script to start it. The script will most likely become a cron job. To test everything I created a test script to run as a process which is written as follows: #!/us

Re: Perl fork() system call

2009-02-21 Thread Jenda Krynicky
); > > > > is launched. However, when this is executed, the original GUI freezes, > > and we cannot use it unless we close Putty. We tried using the fork() > > command like this: > > > > my $pid = fork() > > > > if ( $pid == 0 ) { > > System("C

Re: Perl fork() system call

2009-02-19 Thread Raymond Wan
ried using the fork() command like this: my $pid = fork() if ( $pid == 0 ) { System("C:\\Progra~1\\Putty\\putty.exe"); exit 0; } I don't really know much about GUIs with Perl, but I did look into this for a web server running modperl and you might find something helpful ther

Re: Perl fork() system call

2009-02-19 Thread Chuck
(the remote access > > program) is launched using > > > System("C:\\Progra~1\\Putty\\putty.exe"); > > > is launched. However, when this is executed, the original GUI freezes, > > and we cannot use it unless we close Putty. We tried using the fork() > >

Re: Perl fork() system call

2009-02-19 Thread kevin liu
Hi Chuck: I don't think exec will do the right thing. According to perldoc.perl.org, exec will stop the current process to execute another one while system will do a fork() first, so system will be your right choice I think. This is a short example I did rec

Re: Perl fork() system call

2009-02-18 Thread Chas. Owens
l GUI freezes, > and we cannot use it unless we close Putty. We tried using the fork() > command like this: > > my $pid = fork() > > if ( $pid == 0 ) { > System("C:\\Progra~1\\Putty\\putty.exe"); > exit 0; > } > > Now, if we run it, we can use the or

Perl fork() system call

2009-02-18 Thread Chuck
Hello, We have a GUI where, if a button is clicked, Putty (the remote access program) is launched using System("C:\\Progra~1\\Putty\\putty.exe"); is launched. However, when this is executed, the original GUI freezes, and we cannot use it unless we close Putty. We tried using the fork

Re: timing a fork

2008-08-24 Thread Raymond Wan
Hi Rob, Sorry for the delay -- enjoyed the weekend away from the computer. :-) Rob Dixon wrote: Raymond Wan wrote: Rob Dixon wrote: use strict; use warnings; $|++; # autoflush $SIG{CHLD} = 'IGNORE'; my $kid = fork; if ($kid) { print "in parent whose kid is $

Re: timing a fork

2008-08-22 Thread Rob Dixon
Raymond Wan wrote: > Rob Dixon wrote: >> >> use strict; >> use warnings; >> >> $|++; # autoflush >> >> $SIG{CHLD} = 'IGNORE'; >> >> my $kid = fork; >> >> if ($kid) { >> print "in parent whose kid is $kid\

Re: timing a fork

2008-08-22 Thread Raymond Wan
Hi Rob, Rob Dixon wrote: Raymond Wan wrote: Rob Dixon wrote: What do you need to accomplish that something as simple as the code below won't do? use strict; use warnings; my $kid = fork; if ($kid) { print "in parent whose kid is $kid\n"; } elsif ($kid == 0) {

Re: timing a fork

2008-08-22 Thread Rob Dixon
Raymond Wan wrote: > Rob Dixon wrote: >> >> What do you need to accomplish that something as simple as the code below >> won't do? >> >> use strict; >> use warnings; >> >> my $kid = fork; >> >> if ($kid) { >> print &

Re: timing a fork

2008-08-21 Thread Raymond Wan
web page can be shown) and not care when the child completes... Ray Rob Dixon wrote: What do you need to accomplish that something as simple as the code below won't do? Rob use strict; use warnings; my $kid = fork; if ($kid) { print "in parent whose kid is $kid\n"; } e

Re: timing a fork

2008-08-21 Thread Rob Dixon
quot;reap" the child > processes, but in doing so, lost track of the process that I want to > time? (I'm not so sure about this statement...) > > I gave what you suggested a try and it works, but I now have a Zombie > process. They also suggest a "double fork" s

Re: timing a fork

2008-08-20 Thread Raymond Wan
about this statement...) I gave what you suggested a try and it works, but I now have a Zombie process. They also suggest a "double fork" solution, which seems like it will give the best of both worlds...no zombies and I should be able to time it... I'll try that now...thanks

Re: timing a fork

2008-08-20 Thread John W. Krahn
Raymond Wan wrote: Hi all, Hello, I'm trying to fork a process under modperl for a web server, but I've realized that the problem / misunderstanding that I'm having is unrelated to modperl...I get the same problem under Perl. What I want to do is to fork a child pr

timing a fork

2008-08-19 Thread Raymond Wan
Hi all, I'm trying to fork a process under modperl for a web server, but I've realized that the problem / misunderstanding that I'm having is unrelated to modperl...I get the same problem under Perl. What I want to do is to fork a child process (non-perl program), but also

Re: fork

2007-10-29 Thread Tom Phoenix
On 10/29/07, Ryan Dillinger <[EMAIL PROTECTED]> wrote: > #!/usr/bin/perluse warnings;use strict; > > print "PID=$$\n"; > my $child = fork();die "Can't fork: $!" unless defined $child; > if ($child > 0) { # parent process print "Parent

Re: fork

2007-10-29 Thread Jeff Pang
On 10/29/07, Ryan Dillinger <[EMAIL PROTECTED]> wrote: > > #!/usr/bin/perluse warnings;use strict; > > print "PID=$$\n"; > my $child = fork();die "Can't fork: $!" unless defined $child; > if ($child > 0) { # parent process print "Par

fork

2007-10-29 Thread Ryan Dillinger
Hello, I have this script here: #!/usr/bin/perluse warnings;use strict; print "PID=$$\n"; my $child = fork();die "Can't fork: $!" unless defined $child; if ($child > 0) { # parent process print "Parent process: PID=$$, child=$child\n";} else

Re: How to update value of global variable from child process (fork)

2007-10-10 Thread Jeff Pang
2007/10/10, dinesh <[EMAIL PROTECTED]>: > > Issue here is: The global associative array is not getting updated in > the child process. Please suggest me how to do this. childs and parent are separte,things changed on each process can't affect another. Say you have @global in parent,after forking,

Re: How to update value of global variable from child process (fork)

2007-10-10 Thread John W. Krahn
dinesh wrote: Hi, Hello, Subject: How to update value of global variable from child process (fork) The child and parent are separate processes so you have to use some type of InterProcess Communication to update values between them. perldoc perlipc John -- Perl isn't a toolbox,

How to update value of global variable from child process (fork)

2007-10-10 Thread dinesh
Hi, We need to run test in multiple test cycles and in each test cycle multiple operations need to be performed. Currently one test cycle is taking 10 seconds and we need to reduce the time to 4 seconds. I have used fork() to do this as follows (only one operation is given here). I will update

Re: fork example

2007-09-17 Thread Tom Phoenix
On 9/17/07, perllearner <[EMAIL PROTECTED]> wrote: > I am trying to get my mind around using fork() > > I have a text file that has solid, liquid, and gas on it all on new > lines, how I understand fork() is if I wanted to do a print each > statement on each line in the file

fork example

2007-09-17 Thread perllearner
I am trying to get my mind around using fork() I have a text file that has solid, liquid, and gas on it all on new lines, how I understand fork() is if I wanted to do a print each statement on each line in the file, fork() could do all at once with parent and child processes. I can get around

Re: Fork()ing and CGI?

2007-07-17 Thread yitzle
Thanks for the replies! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Fork()ing and CGI?

2007-07-17 Thread Tom Phoenix
On 7/16/07, yitzle <[EMAIL PROTECTED]> wrote: I'm thinking of writing a CGI script that someone can pass some data and set it running. The script may take a few seconds to run. Is it safe/correct/OK to have a CGI script fork, with one thread respondng with a HTTP response while the o

Re: Fork()ing and CGI?

2007-07-17 Thread Ken Foskey
On Tue, 2007-07-17 at 00:44 -0400, yitzle wrote: > I need some guidance... > I'm thinking of writing a CGI script that someone can pass some data > and set it running. The script may take a few seconds to run. > Is it safe/correct/OK to have a CGI script fork, with one thread &

Fork()ing and CGI?

2007-07-16 Thread yitzle
I need some guidance... I'm thinking of writing a CGI script that someone can pass some data and set it running. The script may take a few seconds to run. Is it safe/correct/OK to have a CGI script fork, with one thread respondng with a HTTP response while the other thread does its work? I

Re: Error output from a fork

2006-12-20 Thread Ken Foskey
On Mon, 2006-12-18 at 12:15 -0600, Dukelow, Don wrote: > I'm making two executable file that is just one lines of ping commands > like. > > remsh ping -I > > This file could have a couple hundred line it like this. > Each of the two files will be put off in different forks at the same

Error output from a fork

2006-12-18 Thread Dukelow, Don
I'm making two executable file that is just one lines of ping commands like. remsh ping -I This file could have a couple hundred line it like this. Each of the two files will be put off in different forks at the same time. For trouble shooting purposes I would like to see the out put

Re: A fork problem

2006-12-13 Thread John W. Krahn
Dukelow, Don wrote: > > I got this basic "fork" code right out of the book. Which book? > It is suppose to wait > for both child forks to finish before the parent falls through and excute > the code after this "if" statement. But which ever child fin

A fork problem

2006-12-13 Thread Dukelow, Don
I got this basic "fork" code right out of the book. It is suppose to wait for both child forks to finish before the parent falls through and excute the code after this "if" statement. But which ever child finishes first the parrent will fall through and finish before all t

Re: The fork command

2006-12-08 Thread Jeff Pang
-Original Message- >From: "Dukelow, Don" <[EMAIL PROTECTED]> >Sent: Dec 9, 2006 4:24 AM >To: beginners@perl.org >Subject: The fork command > > > > I'm using the fork command for the first time, and can't find one simple >expiation o

Re: The fork command

2006-12-08 Thread Travis Thornhill
If you're using some flavor of unix, executing 'perldoc perlfork' on the command line is a good place to get started. The books Programming Perl, and Perl Cookbook have good information on how to get rolling with fork. - Travis "Dukelow, Don" <[EMAIL PROT

Re: The fork command

2006-12-08 Thread John W. Krahn
Dukelow, Don wrote: > > >I'm using the fork command for the first time, and can't find one simple > expiation of it. I know it's not simple, but every index I look it up in > has many references all through the book about it. Is there a web page or > whit

The fork command

2006-12-08 Thread Dukelow, Don
I'm using the fork command for the first time, and can't find one simple expiation of it. I know it's not simple, but every index I look it up in has many references all through the book about it. Is there a web page or white paper someplace that could give me one place

RE: fork question

2006-07-26 Thread Travis Thornhill
Yes that helped. I was able to sort out the proper way to handle processes. Thanks, Travis. Venkat Saranathan <[EMAIL PROTECTED]> wrote: No, Remember fork creates a copy of the parent's environment in the child's process, so whenever you change the child's variab

RE: fork question

2006-07-22 Thread Venkat Saranathan
No, Remember fork creates a copy of the parent's environment in the child's process, so whenever you change the child's variable, it won't have any effect on the parent's and vice versa. One idea is to increase the child counter in the parent process and decrement in

Re: fork question

2006-07-21 Thread John W. Krahn
Travis Thornhill wrote: > I thought I understood this but maybe I don't. Have you read the perlipc doc: perldoc perlipc It has examples on how to use fork. > When perl forks it creates an exact copy of itself with open files, same > variables, hashes, arrays, etc. > > Bu

fork question

2006-07-21 Thread Travis Thornhill
riable to track whether or not I still have processes running? #!/usr/local/bin/perl use strict; use warnings; my $pid; my $children = 0; my @args = ( "arg1", "arg2", "arg3", "arg4", );

Re: Perl's fork ... any example please ...

2006-07-05 Thread Tommy Nordgren
6 jul 2006 kl. 08.08 skrev BenBart: Hi all, Am getting confused on how to use fork, does anyone have an example on how to use this or where and what is it used for ??? Not sure if this is what I needed Is fork the equivalent of running the UNIX wait command when writing a UNIX

Perl's fork ... any example please ...

2006-07-05 Thread BenBart
Hi all, Am getting confused on how to use fork, does anyone have an example on how to use this or where and what is it used for ??? Not sure if this is what I needed Is fork the equivalent of running the UNIX wait command when writing a UNIX script where you want to make sure that

Re: [OT] Can't redirect before fork().

2006-07-03 Thread Danijel Tasov
Mumia W. wrote: > In the parent, I want to redirect STDOUT to 'logfile' then fork. In the ^^^ ^^ > Here is my code: > > use strict; > use warnings; > use constant EXIT_OK => 0; > > $SIG{CHLD} = &quo

Re: [OT] Can't redirect before fork().

2006-07-01 Thread dzhuo
open files are attributes of a process. after you fork, you have 2 processes, files locks, open handles, as well as pending signals and such are not shared. ie, when you print to STDOUT in child, it's not the same STDOUT you expect in parent. why not use a pipe? #!/usr/bin/perl use s

Re: [OT] Can't redirect before fork().

2006-07-01 Thread Mumia W.
Tom Phoenix wrote: On 6/30/06, Mumia W. <[EMAIL PROTECTED]> wrote: In the parent, I want to redirect STDOUT to 'logfile' then fork. In the child, I want to print something. That something should end up in the log file, but it's not working. my $child = fork();

Re: [OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
dzhuo wrote: open files are attributes of a process. after you fork, you have 2 processes, files locks, open handles, as well as pending signals and such are not shared. ie, when you print to STDOUT in child, it's not the same STDOUT you expect in parent. why not use a pipe? #!/usr/bin

Re: [OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
Mumia W. wrote: I can't seem to redirect STDOUT to a file before forking in my perl program. [...] Forgive me for sending this three times. I was dealing with MUA braindamage. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: [OT] Can't redirect before fork().

2006-06-30 Thread Tom Phoenix
On 6/30/06, Mumia W. <[EMAIL PROTECTED]> wrote: In the parent, I want to redirect STDOUT to 'logfile' then fork. In the child, I want to print something. That something should end up in the log file, but it's not working. my $child = fork(); exit ($child ? parent() : c

[OT] Can't redirect before fork().

2006-06-30 Thread Mumia W.
I can't seem to redirect STDOUT to a file before forking in my perl program. In the parent, I want to redirect STDOUT to 'logfile' then fork. In the child, I want to print something. That something should end up in the log file, but it's not working. Here is my code: use

Re: Windows: Fork and run a process in the background

2006-06-06 Thread Daniel Kasak
Timothy Johnson wrote: > Try this: > > system( "start evince /path/to/pdf.pdf" ); > > Both cheap and nasty. > That does it. Thanks :) -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7

RE: Windows: Fork and run a process in the background

2006-06-06 Thread Timothy Johnson
Try this: system( "start evince /path/to/pdf.pdf" ); Both cheap and nasty. -Original Message- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 5:37 PM To: beginners@perl.org Subject: Windows: Fork and run a process in the background Greet

Windows: Fork and run a process in the background

2006-06-06 Thread Daniel Kasak
Greetings. I'd like to trigger an application to open ( Acrobat Reader ), and *not* freeze my perl app while it's open. Under Linux, I do: system ( "evince /path/to/pdf.pdf &" ); The ampersand does what I need. This doesn't work under Windows. Is there a cheap & nasty workaround? -- Daniel Kas

Re: Perl fork or system

2006-03-15 Thread Sonika Sachdeva
thank you all. On 3/15/06, Ad Ministrator <[EMAIL PROTECTED]> wrote: > > Sonika Sachdeva <[EMAIL PROTECTED]> wrote: > >Hi, > >thanks for the response, > > > >thats right , system function will block till the command is complete > > > >foreach $filename (@FILES) { > >$retval = system("perl sample.p

Re: Perl fork or system

2006-03-15 Thread Ad Ministrator
Sonika Sachdeva <[EMAIL PROTECTED]> wrote: >Hi, >thanks for the response, > >thats right , system function will block till the command is complete > >foreach $filename (@FILES) { >$retval = system("perl sample.pl $filename"); >if ($retval ==0 ) { print "success with $filename, output shd >be $expe

Re: Perl fork or system

2006-03-15 Thread Sonika Sachdeva
tions > > 1. > > $retval = system("perl sample.pl $filename"); > > I would need a while loop to poll the "$?" for the complete execution of > the > > system command. > > > > 2. > > > > if (!defined($kidpid = fork())) { > >

Re: Perl fork or system

2006-03-15 Thread Tom Phoenix
On 3/15/06, Sonika Sachdeva <[EMAIL PROTECTED]> wrote: > $retval = system("perl sample.pl $filename"); > I would need a while loop to poll the "$?" for the complete execution of the > system command. No; system() waits for the command to complete before it con

  1   2   3   >