#!/usr/local/bin/perl -w # Server.plx use warnings; use strict; our $root = "/usr/local"; # This should be a very protected location! Different filesystem is even better our ( $GlobalLock, %HashA, @ArrayA . . . ); ## eval { require "functions.pl"; my $ret = Setup(0); ## Setup subroutine initializes the global variables only once ## I usually put the 'require's in the Setup subroutine ## Then I can test with: perl -e 'require Server.plx; my $r = Setup(4);' ## Errors are now run-time errors the (4) is debug level for logging. } if ( $@ ) { ## didn't work, you could retry or whatever } # fork childern while ( 1 ) { # check on children }