Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save earnhardt3rd/fa91ac155ee420755472c61cafb9a62e 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 = &_RFC_REPORT();}
1;
sub _RFC_REPORT {
my $YR = &getDate("YYYY");
RFC_RPT:
chdir $PAK;
opendir(LP,$PAK);
my @PAK_FOLDERS = grep { /^${YR}/ } readdir(LP);
closedir(LP);
if (scalar(@PAK_FOLDERS) > 0) {
my %RFC_RPT;
my @PLIST = &fromARRAY(@PAK_FOLDERS);
for (my $pi=0;$pi<=scalar(@PAK_FOLDERS)-1 ;$pi++) {
my $PACKAGE=$PAK_FOLDERS[$pi];
print " Collecting for for $PACKAGE\n";
my $rfcFile = $PAK . $SLASH . $PACKAGE . $SLASH . $PACKAGE . "_rfc${FET}";
if (-f $rfcFile) {
open (RFH,"< $rfcFile");
my $RFC;
my $devUser="";
while (<RFH>) {
my $line = $_;
chomp($line);
if ($line =~ /DEVELOPER/) {
$devUser=$line;
$devUser =~ s/.*\=//g;
}
$RFC.="$line\n";
}
close(RFH);
$RFC_RPT{$PACKAGE}->{"DEVELOPER"}=$devUser;
$RFC_RPT{$PACKAGE}->{"RFC"}=$RFC;
}
my $scopeFile = $PAK . $SLASH . $PACKAGE . $SLASH . "_scope";
if (-f $scopeFile) {
open (SFH,"< $scopeFile");
my @SCOPE;
while (<SFH>) {
my $line = $_;
chomp($line);
push(@SCOPE,$line);
}
close(SFH);
@{$RFC_RPT{$PACKAGE}->{"SCOPE"}}=@SCOPE;
}
}
if (scalar(keys %RFC_RPT) > 0) {
printf " **********************%-10s*%-6s***\n","**********","******";
printf " ** PACKAGE RFC REPORT %-10s %-6s **\n",$DT,$TM;
printf " **********************%-10s*%-6s***\n","**********","******";
printf " %-55s %-s\n","PACKAGE","DEVELOPER";
foreach my $rptkey(sort keys %RFC_RPT) {
printf " %-55s %-s\n","-------------------------------------------------------","----------------------------------------------------";
printf " %-55s %-s\n",$rptkey,$RFC_RPT{$rptkey}->{"DEVELOPER"};
printf " %-55s %-s\n","-------------------------------------------------------","----------------------------------------------------";
if (ref $RFC_RPT{$rptkey}->{"SCOPE"} eq 'ARRAY') {
#printf " %-55s.%-s\n",".......................................................","....................................................";
printf " SCOPE:\n";
for (my $si=0;$si<=scalar(@{$RFC_RPT{$rptkey}->{"SCOPE"}})-1 ;$si++) {
printf " %-s\n",${$RFC_RPT{$rptkey}->{"SCOPE"}}[$si];
}
#printf " %-55s.%-s\n",".......................................................","....................................................";
}
}
}
} else {
print " No pacakges found for current Year ( $YR )\n";
my $PYR = $YR - 1;
print " Enter new year as XXXX [$PYR] (x ~ exit):";
my $ans = <STDIN>;
chomp($ans);
if ($ans eq ""){$ans=$PYR;}
if (lc($ans) eq "x") {
return;
}
$YR=$ans;
goto RFC_RPT;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment