From 36e0116c3e823057599b76fcb84a9e2be5c3a6d2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 20 Jul 2010 10:27:07 +0000 Subject: (if_, if__) make easier to debug (#60153) --- NEWS | 2 ++ lib/MDK/Common/Func.pm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4274dad..c16ff9b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- if_, if__: make easier to debug (#60153) + Version 1.2.25 - 2 June 2010, by Pascal Terjan - preserve sockets and pipes in cp_af diff --git a/lib/MDK/Common/Func.pm b/lib/MDK/Common/Func.pm index b78ebc4..07b308f 100644 --- a/lib/MDK/Common/Func.pm +++ b/lib/MDK/Common/Func.pm @@ -183,13 +183,13 @@ sub may_apply { $_[0] ? $_[0]->($_[1]) : (@_ > 2 ? $_[2] : $_[1]) } sub if_($@) { my $b = shift; $b or return (); - wantarray() || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller())); + wantarray() || @_ <= 1 or die("if_ called in scalar context with more than one argument :\nargs=" . join(", ", @_) . "\ncaller=" . join(":", caller())); wantarray() ? @_ : $_[0]; } sub if__($@) { my $b = shift; defined $b or return (); - wantarray() || @_ <= 1 or die("if__ called in scalar context with more than one argument " . join(":", caller())); + wantarray() || @_ <= 1 or die("if__ called in scalar context with more than one argument :\nargs=" . join(", ", @_) . "\ncaller=" . join(":", caller())); wantarray() ? @_ : $_[0]; } -- cgit v1.2.1