From 91a637a4a353a9edad8a2ce9c4ea125a42eb3488 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 29 Jun 2023 22:05:10 -0500 Subject: [PATCH] Remove unused helper functions --- gatekeeper.pl | 70 --------------------------------------------------- 1 file changed, 70 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 40f8997..055a150 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1585,76 +1585,6 @@ sub read_directive_from_string { return $records; } -=item @values = find_directive_elements ( $directive, $key ) - -=item $count = find_directive_elements ( $directive, $key ) - -Search the DIRECTIVE arrayref for KEY elements and return their associated -values. An empty list is returned if no KEY elements are found in -DIRECTIVE. The KEY comparison is case-insensitive. - -The values returned from this procedure are tainted. - -In scalar context, return the number of entries that would be returned in -list context. - -=cut - -sub find_directive_elements { - my $directive = shift; - my $key = lc shift; - - if (wantarray) { - return map $_->[1], grep lc($_->[0]) eq $key, @$directive; - } else { - return grep lc($_->[0]) eq $key, @$directive; - } -} - -=item $directory = find_directory ( $directive ) - -Extract the destination directory name from the parsed DIRECTIVE arrayref. -An exception is thrown if DIRECTIVE does not contain exactly one -"directory" element or if the value of that element is not acceptable. - -The value returned from this procedure is untainted. - -=cut - -sub find_directory { - my $directive = shift; - - my @values = find_directive_elements($directive, 'directory'); - - die "Only one directory directive is allowed per directive file." - if scalar @values > 1; - die "no directory directive specified" - unless @values; - die "invalid directory element with no value" - unless $values[0]; - - die "invalid directory $values[0]" - unless $values[0] =~ m/^($RE_filename_relative)$/; - - return $1; -} - -=item $package = find_package ( $directive ) - -Extract the package name from the parsed DIRECTIVE arrayref. An exception -is thrown if DIRECTIVE does not contain exactly one "directory" element or -if the value of that element is not a relative file name. - -The value returned from this procedure is untainted. - -=cut - -sub find_package { - # The package name is the first directory named in the directory element. - my @dirs = File::Spec::Unix->splitdir(find_directory(@_)); - return $dirs[0]; -} - =back -- 2.25.1