26 Jan 2022 16:44:27 UTC
- Distribution: AnyEvent-Fork
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (8 / 1 / 0)
- KwaliteeBus factor: 1
- 68.73% Coverage
- License: unknown
- Download (30.72KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:8 non-PAUSE users
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.
use'ing the module, the process is forked, and the resulting process is used as a template process for
new_exec, so everything should just work out.
Please resist the temptation to delay
useing this module to preload more modules that could be useful for your own purposes, see AnyEvent::Fork::Template for that.
Marc Lehmann <firstname.lastname@example.org> http://home.schmorp.de/
Module Install Instructions
To install AnyEvent::Fork, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install AnyEvent::Fork
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|