Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Parallel trigger of different subs

by thanos1983 (Vicar)
on Jan 02, 2018 at 19:39 UTC ( #1206556=note: print w/replies, xml ) Need Help??


in reply to Parallel trigger of different subs

Hello Anonymous Monk,

In reply to your merged thread Running 2 different subs simultaneously. I am not sure exactly why the replies of the fellow Monks did not cover your question but maybe the use of Parallel::Simple a really simple module in parallel processes will help you to understand that your question is answered already.

Sample of code:

#!/usr/bin/perl use strict; use warnings; use feature 'say'; use Parallel::Simple qw(prun); sub myFooSub { say "$$ foo 'clear bgp'"; } sub myBarSub { say "$$ bar 'clear ospf'"; } # style 2: named code blocks (like the Benchmark module) prun( foo => \&myFooSub, bar => \&myBarSub, ) or die( Parallel::Simple::errplus() ); __END__ $ perl test.pl 21120 foo 'clear bgp' 21121 bar 'clear ospf'

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1206556]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2018-07-20 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (431 votes). Check out past polls.

    Notices?