Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 14:04
Show Gist options
  • Save earnhardt3rd/386fa27f8efcf14160659909671faeb8 to your computer and use it in GitHub Desktop.
Save earnhardt3rd/386fa27f8efcf14160659909671faeb8 to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:t');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
if (defined $opt_t) { my %TEST = &_WARNING();}
1;
sub _WARNING {
my $warnMsg = shift || "";
if ($warnMsg eq "") {return;}
if (defined($WARN_FILE)) {
if (! -f $WARN_FILE) {
open (WFH,"> $WARN_FILE");
print WFH "DATE :$DT\n";
print WFH "TIME :$TM\n";
print WFH "USER :$USERNAME\n";
print WFH "ACTION :$action\n";
print WFH "------------------------------------\n";
close(WFH);
}
if (-f $WARN_FILE) {
&displayMessageInBox($warnMsg) if $DEBUG > 0;
open (WFH,">> $WARN_FILE");
print WFH "$warnMsg\n";
close(WFH);
}
} else {
print " WARN_FILE NOT DEFINED!\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment