From fa05828b2d1402b86e197102182cb0529aeb78f9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 26 Feb 2001 12:04:45 +0000 Subject: (if_): fix for use in scalar context --- perl-install/common.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'perl-install/common.pm') diff --git a/perl-install/common.pm b/perl-install/common.pm index 3bf3c7e0f..ef141fe68 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -140,7 +140,9 @@ sub may_apply { $_[0] ? $_[0]->($_[1]) : (@_ > 2 ? $_[2] : $_[1]) } sub if_($@) { my $b = shift; - $b ? @_ : (); + $b or return (); + wantarray || @_ <= 1 or die "if_ called in scalar context with more than one argument"; + wantarray ? @_ : $_[0]; } sub arch() { -- cgit v1.2.1