From 72b5445bd8dae616be2d969c596f57ff003832e2 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Thu, 9 Jul 1998 08:35:39 +0000 Subject: [PATCH] merge changes from maintbranch (1354, and relevant part of 1356); all maintenance changes upto 1356 merged p4raw-id: //depot/perl@1397 --- pod/perldiag.pod | 12 +++++++++++- pp_hot.c | 4 +++- t/op/misc.t | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index f2415cc..a0505e4 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -477,7 +477,17 @@ an object reference until it has been blessed. See L. (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an expression that returns -neither an object reference nor a package name. (Perhaps it's null?) +a defined value which is neither an object reference nor a package name. +Something like this will reproduce the error: + + $BADREF = 42; + process $BADREF 1,2,3; + $BADREF->process(1,2,3); + +=item Can't call method "%s" on an undefined value + +(F) You used the syntax of a method call, but the slot filled by the +object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; diff --git a/pp_hot.c b/pp_hot.c index fa6c5a5..dc8935b 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2447,7 +2447,9 @@ PP(pp_method) !(ob=(SV*)GvIO(iogv))) { if (!packname || !isIDFIRST(*packname)) - DIE("Can't call method \"%s\" without a package or object reference", name); + DIE("Can't call method \"%s\" %s", name, + SvOK(sv)? "without a package or object reference" + : "on an undefined value"); stash = gv_stashpvn(packname, packlen, TRUE); goto fetch; } diff --git a/t/op/misc.t b/t/op/misc.t index 25f566e..d544df4 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -61,7 +61,7 @@ EXPECT ######## $foo=undef; $foo->go; EXPECT -Can't call method "go" without a package or object reference at - line 1. +Can't call method "go" on an undefined value at - line 1. ######## BEGIN { -- 2.7.4