Skip to content
Snippets Groups Projects
Commit a9dbfd65 authored by Dan Sheppard's avatar Dan Sheppard
Browse files

Allow pass_through in GetOpt::Long some circumstances.

parent 0848c2b8
No related branches found
No related tags found
No related merge requests found
...@@ -194,6 +194,9 @@ sub parse_common_options { ...@@ -194,6 +194,9 @@ sub parse_common_options {
Example : $support->parse_extra_options('string_opt=s', 'numeric_opt=n'); Example : $support->parse_extra_options('string_opt=s', 'numeric_opt=n');
Description : Parse extra commandline options by passing them on to Description : Parse extra commandline options by passing them on to
Getopt::Long and storing parameters in $self->param('name). Getopt::Long and storing parameters in $self->param('name).
If the last option is '...' then unknown options are kept
in @ARGV for future calls to this method. Without '...'
then it is an error to have further options.
Return type : true on success Return type : true on success
Exceptions : none (caugth by $self->error) Exceptions : none (caugth by $self->error)
Caller : general Caller : general
...@@ -202,7 +205,12 @@ sub parse_common_options { ...@@ -202,7 +205,12 @@ sub parse_common_options {
sub parse_extra_options { sub parse_extra_options {
my ($self, @params) = @_; my ($self, @params) = @_;
Getopt::Long::Configure("no_pass_through"); if(@params and $params[-1] eq "...") {
pop @params;
Getopt::Long::Configure("pass_through");
} else {
Getopt::Long::Configure("no_pass_through");
}
eval { eval {
# catch warnings to pass to $self->error # catch warnings to pass to $self->error
local $SIG{__WARN__} = sub { die @_; }; local $SIG{__WARN__} = sub { die @_; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment