summaryrefslogtreecommitdiff
path: root/lib/overload.pm
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2000-09-01 14:43:15 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-09-01 13:55:10 +0000
commit4498a7519cc524cb875be9ce1d6a4bda5940beeb (patch)
treeae3ae9846741cdb1c44e4f5a9a9cd79d243d451a /lib/overload.pm
parent6b82e2f59e3c46c3c35c70f18f42e8c715a2cb5e (diff)
downloadperl-4498a7519cc524cb875be9ce1d6a4bda5940beeb.tar.gz
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
Diffstat (limited to 'lib/overload.pm')
-rw-r--r--lib/overload.pm13
1 files changed, 3 insertions, 10 deletions
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<ref $_[1] eq "CODE"> above as code references can be
# blessed, and C<ref> 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 {