CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
What is the best way to pass the single flag info to parent process?

 



masaniparesh
Novice

Nov 30, 2009, 9:20 PM

Post #1 of 4 (652 views)
What is the best way to pass the single flag info to parent process? Can't Post

Hi,

I have parent P and child-C processes. Child-C runs the command using open3 like below:

my $pid = open3( \*CMD_IN, \*CMD_OUT, \*CMD_ERR, $cmd );

I am reading the error and output of this process successfully. I am setting one flag when some error encountered in the execution of $cmd. I want to pass this flag to main parent P. Could any one please tell me what is the best way to do this?

I am aware of using named Pipes, shared memory and socket IPC mechanisms but I think they are overhead when you have need to share just one flag.

Thanks,
Paresh


shawnhcorey
Enthusiast


Dec 1, 2009, 5:20 AM

Post #2 of 4 (636 views)
Re: [masaniparesh] What is the best way to pass the single flag info to parent process? [In reply to] Can't Post

Send it a signal. See:
perldoc -f kill
perldoc perlipc and search for /Signals/

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


masaniparesh
Novice

Dec 1, 2009, 5:38 AM

Post #3 of 4 (634 views)
Re: [shawnhcorey] What is the best way to pass the single flag info to parent process? [In reply to] Can't Post

I think we cannot send data using signal. Can we?

Thanks,
Paresh


shawnhcorey
Enthusiast


Dec 1, 2009, 5:53 AM

Post #4 of 4 (631 views)
Re: [masaniparesh] What is the best way to pass the single flag info to parent process? [In reply to] Can't Post

No, no data, just an indication that something happened.

Perhaps you can use threads? They can pass data via a shared data structure.

See:
perlodc perlthrtut
perldoc threads
perldoc Threads::Queue

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives