summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pod/perldiag.pod12
-rw-r--r--pp_hot.c4
-rwxr-xr-xt/op/misc.t2
3 files changed, 15 insertions, 3 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index f2415cc444..a0505e4bba 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -477,7 +477,17 @@ an object reference until it has been blessed. See L<perlobj>.
(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 fa6c5a58d1..dc8935beb9 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 25f566e19b..d544df4915 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
{