If you could find a copy of "Perl Cookbook" (Pub: O'Reilly, Authors: Tom
Christiansen & Nathan Torkington, ISBN: 1-56592-243-3) look at recipes
17.11 Forking Servers
17.12 Pre-Forking Servers
17.13 Non-Forking Servers
Ahh, I found these two links that show the same code as in the Cookbook
for the forking and non-forking server:
http://grand-rapids.pm.org/resources/sockets/fork_server.pl
http://grand-rapids.pm.org/resources/sockets/nonfork_server.pl
Those links were found on
http://grand-rapids.pm.org/resources/sockets/sockets.html
And that page was found after doing a search on google for "perl forking
server".
They may not be exactly what you're looking for but they should give you
an excellent foundation for your situation.
Hope this helps.
Dan
Chip Cuntz wrote:
>
> Hello list,
>
> I have got a test automation script that I use to test code running in a
> Solaris envrionment. The script is written in Perl 5.6.1 and makes system
> calls via system and open( FD, "the command |"). The script currently runs
> in serial mode where one function has to wait on the previous function.
> This is very slow since the system commands are rsh commands that tell other
> boxes in the network to do things. Since these functions are essentially
> running on "other processors" I would like to spawn/fork/thread two of them
> and wait for both there completion. The current sudo code is as follows:
>
> #!/usr/local/bin/perl
>
> bounce_destination_nodes # rsh that tells other nodes they need to bounce.
> # only this one is running
> # wait
>
> build_test_data # rsh that tells test box it needs to build data.
> # only this one is running
> # wait
>
> What I would like is:
>
> #!/usr/local/bin/perl
>
> bounce_destination_nodes # rsh that tells other nodes they need to bounce.
> build_test_data # rsh that tells test box it needs to build data.
> # both are running at this point.
> # wait for both to complete, thus cutting down on time...
>
> What I am looking for is code snippets, an example someone has seen or for
> someone to give me a clue where to start. Any ideas would be appreciated.
>
> Chip Cuntz
> Worldcom Test Lead
> NIC System Test
> DCS System/Integration Test
> v622.1305/719.535.1305