diff --git a/staticgen.pl b/staticgen.pl index d4e0333..da1f71a 100755 --- a/staticgen.pl +++ b/staticgen.pl @@ -61,21 +61,24 @@ sub HandleArgs if (defined $opt->{sopt}) { - if (grep { $_ eq $opt->{sopt} } @soptlist) + if (grep { $_ eq $opt->{sopt} // () } @soptlist) { die "Option -$opt->{sopt} cannot be in a list as it requires an argument!\n" if $opt->{arg} eq "required"; $opt->{handler}(); } - elsif (defined $+{sopt} and $+{sopt} // "" eq $opt->{sopt}) + # will make these look better later + elsif (defined $+{sopt} and defined $+{sopt} + and $+{sopt} eq $opt->{sopt}) { $optarg = $+{optarg} // (); $opt->{handler}($optarg); } } - if (defined $opt->{lopt} and $+{lopt} // "" eq $opt->{lopt}) + if (defined $opt->{lopt} and defined $+{lopt} + and $+{lopt} eq $opt->{lopt}) { $optarg = $+{optarg} // (); $opt->{handler}($optarg);