From 2ec4a4328cdfee5ae2a0842ca775a9725415d0ab Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Wed, 7 Aug 2013 19:21:36 -0700 Subject: [PATCH] Update OptionParser in all tools. --- bin/pt-agent | 12 +++++++++++- bin/pt-align | 12 +++++++++++- bin/pt-config-diff | 12 +++++++++++- bin/pt-deadlock-logger | 12 +++++++++++- bin/pt-diskstats | 12 +++++++++++- bin/pt-duplicate-key-checker | 12 +++++++++++- bin/pt-fifo-split | 12 +++++++++++- bin/pt-find | 12 +++++++++++- bin/pt-fingerprint | 12 +++++++++++- bin/pt-fk-error-logger | 12 +++++++++++- bin/pt-heartbeat | 12 +++++++++++- bin/pt-index-usage | 12 +++++++++++- bin/pt-kill | 12 +++++++++++- bin/pt-online-schema-change | 12 +++++++++++- bin/pt-query-digest | 12 +++++++++++- bin/pt-show-grants | 12 +++++++++++- bin/pt-slave-delay | 12 +++++++++++- bin/pt-slave-find | 12 +++++++++++- bin/pt-slave-restart | 12 +++++++++++- bin/pt-table-checksum | 12 +++++++++++- bin/pt-table-sync | 12 +++++++++++- bin/pt-table-usage | 12 +++++++++++- bin/pt-upgrade | 12 +++++++++++- bin/pt-variable-advisor | 12 +++++++++++- bin/pt-visual-explain | 12 +++++++++++- 25 files changed, 275 insertions(+), 25 deletions(-) diff --git a/bin/pt-agent b/bin/pt-agent index 79ec9ac3..21cc4c4f 100755 --- a/bin/pt-agent +++ b/bin/pt-agent @@ -2963,11 +2963,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-align b/bin/pt-align index 2bd4fbca..aab581cd 100755 --- a/bin/pt-align +++ b/bin/pt-align @@ -431,11 +431,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-config-diff b/bin/pt-config-diff index 1cd34aee..0e57f60f 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -1158,11 +1158,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index b2b4c83d..557afa2f 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -508,11 +508,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-diskstats b/bin/pt-diskstats index ab6aed99..c7db673a 100755 --- a/bin/pt-diskstats +++ b/bin/pt-diskstats @@ -504,11 +504,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index aedaf844..1de06f8e 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -1490,11 +1490,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-fifo-split b/bin/pt-fifo-split index 3b6fb6b7..8eb9351c 100755 --- a/bin/pt-fifo-split +++ b/bin/pt-fifo-split @@ -432,11 +432,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-find b/bin/pt-find index 1443b1ee..54bfaebd 100755 --- a/bin/pt-find +++ b/bin/pt-find @@ -924,11 +924,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-fingerprint b/bin/pt-fingerprint index 5029873b..c9ec1f9f 100755 --- a/bin/pt-fingerprint +++ b/bin/pt-fingerprint @@ -433,11 +433,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-fk-error-logger b/bin/pt-fk-error-logger index 240912b9..1bcec340 100755 --- a/bin/pt-fk-error-logger +++ b/bin/pt-fk-error-logger @@ -503,11 +503,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-heartbeat b/bin/pt-heartbeat index 4c120194..b49e2cd0 100755 --- a/bin/pt-heartbeat +++ b/bin/pt-heartbeat @@ -1240,11 +1240,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-index-usage b/bin/pt-index-usage index c6c83819..8e809598 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -1085,11 +1085,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-kill b/bin/pt-kill index 26535df0..92318a76 100755 --- a/bin/pt-kill +++ b/bin/pt-kill @@ -513,11 +513,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index 023802af..bdb2edc0 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -520,11 +520,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 74974aee..5b63cdec 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -1753,11 +1753,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-show-grants b/bin/pt-show-grants index 11f00745..b3f95725 100755 --- a/bin/pt-show-grants +++ b/bin/pt-show-grants @@ -433,11 +433,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay index 513f539b..83e31ea4 100755 --- a/bin/pt-slave-delay +++ b/bin/pt-slave-delay @@ -506,11 +506,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-slave-find b/bin/pt-slave-find index 749ac619..6789f440 100755 --- a/bin/pt-slave-find +++ b/bin/pt-slave-find @@ -441,11 +441,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-slave-restart b/bin/pt-slave-restart index bce27ca5..58594bfd 100755 --- a/bin/pt-slave-restart +++ b/bin/pt-slave-restart @@ -658,11 +658,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index c18110b1..3d292e89 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -2187,11 +2187,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-table-sync b/bin/pt-table-sync index d807e184..e18fb6e1 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -521,11 +521,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-table-usage b/bin/pt-table-usage index 45781f80..6afba58e 100755 --- a/bin/pt-table-usage +++ b/bin/pt-table-usage @@ -870,11 +870,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 617ef041..49f86da1 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -1750,11 +1750,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-variable-advisor b/bin/pt-variable-advisor index cd9d601f..c2a6b985 100755 --- a/bin/pt-variable-advisor +++ b/bin/pt-variable-advisor @@ -510,11 +510,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; } diff --git a/bin/pt-visual-explain b/bin/pt-visual-explain index 3bda0e20..716b4052 100755 --- a/bin/pt-visual-explain +++ b/bin/pt-visual-explain @@ -1107,11 +1107,21 @@ sub _set_option { my $long = exists $self->{opts}->{$opt} ? $opt : exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt} : die "Getopt::Long gave a nonexistent option: $opt"; - $opt = $self->{opts}->{$long}; if ( $opt->{is_cumulative} ) { $opt->{value}++; } + elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) { + my $next_opt = $1; + if ( exists $self->{opts}->{$next_opt} + || exists $self->{short_opts}->{$next_opt} ) { + $self->save_error("--$long requires a string value"); + return; + } + else { + $opt->{value} = $val; + } + } else { $opt->{value} = $val; }