summaryrefslogtreecommitdiff
path: root/Dh_Getopt.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Dh_Getopt.pm')
-rw-r--r--Dh_Getopt.pm13
1 files changed, 13 insertions, 0 deletions
diff --git a/Dh_Getopt.pm b/Dh_Getopt.pm
index 0eec704d..5084d6f0 100644
--- a/Dh_Getopt.pm
+++ b/Dh_Getopt.pm
@@ -50,6 +50,11 @@ sub AddExclude { my($option,$value)=@_;
push @{$options{EXCLUDE}},$value;
}
+# This collects non-options values.
+sub NonOption {
+ push @{$options{ARGV}}, @_;
+}
+
# Parse options and return a hash of the values.
sub parseopts {
undef %options;
@@ -122,6 +127,8 @@ sub parseopts {
"number=s" => \$options{number},
"flavor=s" => \$options{flavor},
+
+ "<>" => \&NonOption,
);
if (!$ret) {
@@ -168,6 +175,12 @@ sub parseopts {
error("I have no package to build");
}
+ # Anything left in @ARGV is options that appeared after a --
+ # These options are added to U_PARAMS, while the non-option
+ # values we collected replace them in @ARGV;
+ $options{U_PARAMS}.=join(' ', @ARGV);
+ @ARGV=@{$options{ARGV}} if exists $options{ARGV};
+
return %options;
}