GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Fork::Template(3) User Contributed Perl Documentation Fork::Template(3)

AnyEvent::Fork::Template - generate a template process from the main program

   # only usable in the main program

   # preload some harmless modules (just examples)
   use Other::Module;
   use Some::Harmless::Module;
   use My::Worker::Module;

   # now fork and keep the template
   use AnyEvent::Fork::Template;

   # now do less harmless stuff (just examples)
   use Gtk2 -init;
   my $w = AE::io ...;

   # and finally, use the template to run some workers
   $AnyEvent::Fork::Template->fork->run ("My::Worker::Module::run_worker", sub { ... });

By default, this module forks when it is used the first time and stores the resulting AnyEvent::Fork object in the $AnyEvent::Fork::Template variable (mnemonic: same name as the module itself).

It must only be used in the main program, and only once. Other than that, the only requirement is that you can handle the results of a fork at that time, i.e., when you use this module after AnyEvent has been initialised, or use it after you opened some window with Gtk2 or Tk for example then then you can't easily use these modules in the forked process. Choosing the place to use this module wisely is key.

There is never a need for this module - you can always create a new empty process and loading the modules you need into it.

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/
2021-07-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.