Myriad::Bootstrap - starts up a Myriad child process ready for loading modules for the main functionality
Controller process for managing an application.
Provides a minimal parent process which starts up a child process for running the real application code. A pipe is maintained between parent and child for exchanging status information, with a secondary UNIX domain socket for filedescriptor handover.
The parent process loads only two additional modules - strict and warnings - with the rest of the app-specific modules being loaded in the child. This is enforced: any other modules found in %INC will cause the process to exit immediately.
%INC
Signals:
HUP - Request to recycle all child processes
HUP
TERM - Shut down all child processes gracefully
TERM
KILL - Immediate shutdown for all child processes
KILL
The purpose of this class is to support development usage: it provides a minimal base set of code that can load up the real modules in separate forks, and tear them down again when dependencies or local files change.
We avoid even the standard CPAN modules because one of the changes we're watching for is cpanfile content changing, if there's a new module or updated version we want to be very sure that it's properly loaded.
cpanfile
One thing we explicitly don't try to do is handle Perl version or executable changing from underneath us - so this is very much a fork-and-call approach, rather than fork-and-exec.
Add modules to the whitelist.
Takes a list of module names in the same format as %INC keys.
Don't ever use this.
use socketpair to establish communication between parent/child later.
Takes a pipe and makes it nonblocking by applying O_NONBLOCK
O_NONBLOCK
Given a target coderef or classname, prepares the fork and communication pipe, then starts the code.
Deriv Group Services Ltd. DERIV@cpan.org
DERIV@cpan.org
Copyright Deriv Group Services Ltd 2020-2021. Licensed under the same terms as Perl itself.
To install Myriad, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Myriad
CPAN shell
perl -MCPAN -e shell install Myriad
For more information on module installation, please visit the detailed CPAN module installation guide.