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::Early(3) User Contributed Perl Documentation Fork::Early(3)

AnyEvent::Fork::Early - avoid having to exec another perl interpreter

   # only usable in the main program, and must be called
   # as early as possible

   #!/usr/bin/perl
   use AnyEvent::Fork::Early;

   # now you can do other stuff

AnyEvent::Fork normally spawns a new perl process by executing the perl binary. It does this because it is the only way to get a "clean state", as the program using it might have loaded modules that are not fork friendly (event loops, X11 interfaces and so on).

However, in some cases, there is no external perl interpreter to execute, for example, when you use App::Staticperl or PAR::Packer to embed perl into another program, and that program runs on another system without perl installed.

And anyway, forking would still be more efficient, if it were possible.

And, as you hopefully guessed, this module makes this possible - it must be run by the main program (i.e. to cannot be used in a module), and as early as possible. How early? Well, early enough so that any other modules can still be loaded and used, that is, before modules such as AnyEvent or Gtk2 are being initialised.

Upon "use"'ing the module, the process is forked, and the resulting process is used as a template process for "new" and "new_exec", so everything should just work out.

Please resist the temptation to delay "use"ing this module to preload more modules that could be useful for your own purposes, see AnyEvent::Fork::Template for that.

 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.