summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-08-31 15:20:56 +0200
committerNicholas Clark <nick@ccl4.org>2011-09-01 21:54:13 +0200
commit11e7c26f941847c62a5adb54686102ec250a8dad (patch)
treed04abeb09e0c5c6223f9e593bee5d9137c198b79 /ext
parent8fe37eeda0ab69220877c0b1af801830a88f0944 (diff)
downloadperl-11e7c26f941847c62a5adb54686102ec250a8dad.tar.gz
In POSIX, improve the diagnostic for the "use $method" instead.
In the error message, name the POSIX function that was called, as well as the suggested replacement method. This rephrasing was in the patch supplied by Aristotle Pagaltzis, but I have retained the existing POSIX use of :: when describing the method, because given two less than great choices, I'm inclined to favour retaining the status quo and one change over two changes.
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/lib/POSIX.pm2
-rw-r--r--ext/POSIX/t/unimplemented.t3
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm
index 7899922aef..c850eaa6c3 100644
--- a/ext/POSIX/lib/POSIX.pm
+++ b/ext/POSIX/lib/POSIX.pm
@@ -131,7 +131,7 @@ sub AUTOLOAD {
croak "Unimplemented: POSIX::$func() is C-specific, stopped"
unless defined $how;
croak "Unimplemented: POSIX::$func() is $$how" if ref $how;
- croak "Use method $how() instead" if $how =~ /::/;
+ croak "Use method $how() instead of POSIX::$func()" if $how =~ /::/;
croak "Unimplemented: POSIX::$func() is C-specific, use $how instead";
}
diff --git a/ext/POSIX/t/unimplemented.t b/ext/POSIX/t/unimplemented.t
index 54fc648489..1e38af7d4a 100644
--- a/ext/POSIX/t/unimplemented.t
+++ b/ext/POSIX/t/unimplemented.t
@@ -89,7 +89,8 @@ foreach ([atexit => 'C-specific, use END {} instead'],
[vsprintf => 'C-specific, stopped'],
) {
my ($func, $action) = @$_;
- my $expect = ref $action ? qr/Use method $$action\(\) instead at \(eval/
+ my $expect = ref $action
+ ? qr/Use method $$action\(\) instead of POSIX::$func\(\) at \(eval/
: qr/Unimplemented: POSIX::$func\(\) is \Q$action\E at \(eval/;
is(eval "POSIX::$func(); 1", undef, "POSIX::$func fails as expected");
like($@, $expect, "POSIX::$func gives expected error message");