diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Getopt.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Getopt.pm | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Getopt.pm b/usr.sbin/pkg_add/OpenBSD/Getopt.pm index 98713830664..eedb555df17 100644 --- a/usr.sbin/pkg_add/OpenBSD/Getopt.pm +++ b/usr.sbin/pkg_add/OpenBSD/Getopt.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Getopt.pm,v 1.15 2023/05/21 13:44:21 espie Exp $ +# $OpenBSD: Getopt.pm,v 1.16 2023/06/13 09:07:17 espie Exp $ # # Copyright (c) 2006 Marc Espie <espie@openbsd.org> # @@ -18,8 +18,7 @@ # This is inspired by Getopt::Std, except for the ability to invoke subs # on options. -use strict; -use warnings; +use v5.36; package OpenBSD::Getopt; require Exporter; @@ -27,10 +26,8 @@ require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(getopts); -sub handle_option +sub handle_option($opt, $hash, @params) { - my ($opt, $hash, @params) = @_; - if (defined $hash->{$opt} and ref($hash->{$opt}) eq 'CODE') { &{$hash->{$opt}}(@params); } else { @@ -48,10 +45,8 @@ sub handle_option } } -sub getopts +sub getopts($args, $hash) { - my ($args, $hash) = @_; - $hash = {} unless defined $hash; local @EXPORT; |