diff options
-rw-r--r-- | pod/perldiag.pod | 12 | ||||
-rw-r--r-- | pp_hot.c | 4 | ||||
-rwxr-xr-x | t/op/misc.t | 2 |
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; @@ -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 { |