Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 14:03
Show Gist options
  • Select an option

  • Save earnhardt3rd/6cb28255cfe504a178b6715878f1a094 to your computer and use it in GitHub Desktop.

Select an option

Save earnhardt3rd/6cb28255cfe504a178b6715878f1a094 to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:tS:D:');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
my $SLEEP = $opt_S || 5;
my $DOTS = $opt_D || "";
if (defined $opt_t) { my %TEST = &_SLEEPER($SLEEP,$DOTS);}
1;
sub _SLEEPER {
# This allow script to catch SIGS
my $sleepSecs = shift || 5;
my $sleepDots = shift || "";
my $preFlush = $|;
if ($sleepDots ne "") {$|=1;}
for (my $si=0;$si<=$sleepSecs ;$si++) {
if ($sleepDots ne "") {print ".";}
sleep 1;
}
if ($sleepDots ne "") {$|=$preFlush;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment