summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2012-07-09 13:37:39 +0000
committerespie <espie@openbsd.org>2012-07-09 13:37:39 +0000
commit0fa141ab9e37bda30bf1d5ac0c8b1c4560bc82c2 (patch)
tree7b842ba19a791f4b5b3c3fc6a5fdd911a144ea43
parentRevert previous. (diff)
downloadwireguard-openbsd-0fa141ab9e37bda30bf1d5ac0c8b1c4560bc82c2.tar.xz
wireguard-openbsd-0fa141ab9e37bda30bf1d5ac0c8b1c4560bc82c2.zip
tweak auto-accessor for arrays to be more useful
-rw-r--r--usr.bin/libtool/LT/Getopt.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/libtool/LT/Getopt.pm b/usr.bin/libtool/LT/Getopt.pm
index 047df32f062..5302811cd8c 100644
--- a/usr.bin/libtool/LT/Getopt.pm
+++ b/usr.bin/libtool/LT/Getopt.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Getopt.pm,v 1.5 2012/07/08 18:28:34 espie Exp $
+# $OpenBSD: Getopt.pm,v 1.6 2012/07/09 13:37:39 espie Exp $
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
#
@@ -167,7 +167,11 @@ sub add_option_accessor
my $actual = $isarray ?
sub {
my $self = shift;
- return @{$self->{opt}{$option}};
+ if (wantarray) {
+ return @{$self->{opt}{$option}};
+ } else {
+ return scalar @{$self->{opt}{$option}};
+ }
} : sub {
my $self = shift;
return $self->{opt}{$option};