From 4498a7519cc524cb875be9ce1d6a4bda5940beeb Mon Sep 17 00:00:00 2001 From: Paul Marquess Date: Fri, 1 Sep 2000 14:43:15 +0100 Subject: RE: [PATCH lib/overload.pm] Sanaty checking of arguments to overload::constant Message-ID: <001001c01412$32c7dde0$a20a140a@bfs.phone.com> p4raw-id: //depot/perl@6970 --- lib/overload.pm | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/overload.pm b/lib/overload.pm index cce5df7852..b9c9ce74b7 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -132,25 +132,18 @@ sub constant { # Arguments: what, sub while (@_) { if (@_ == 1) { - if (warnings::enabled) { - require Carp; - Carp::carp ("Odd number of arguments for overload::constant"); - } + warnings::warnif ("Odd number of arguments for overload::constant"); last; } elsif (!exists $constants {$_ [0]}) { - if (warnings::enabled) { - require Carp; - Carp::carp ("`$_[0]' is not an overloadable type"); - } + warnings::warnif ("`$_[0]' is not an overloadable type"); } elsif (!ref $_ [1] || "$_[1]" !~ /CODE\(0x[\da-f]+\)$/) { # Can't use C above as code references can be # blessed, and C would return the package the ref is blessed into. if (warnings::enabled) { - require Carp; $_ [1] = "undef" unless defined $_ [1]; - Carp::carp ("`$_[1]' is not a code reference"); + warnings::warn ("`$_[1]' is not a code reference"); } } else { -- cgit v1.2.1