Skip to content

Instantly share code, notes, and snippets.

@dfaerch
dfaerch / forkmanager_example.pl
Created March 3, 2016 17:36
Example of Parallel::ForkManager, with setuid() and with returning data to parent, using /dev/shm for temp storage
#!/usr/bin/perl
use strict;
use warnings;
use Parallel::ForkManager 1.7.6;
use Data::Dumper;
use POSIX qw(setuid setgid);
use File::Temp;
# We make a temp tmp dir in memory (/dev/shm/) instead of built in /tmp/ (for speedy access)
my $tmpdir = mkdtemp("/dev/shm/$0.XXXXXXXXX") ;