summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSADAHIRO Tomoyuki <BQW10602@nifty.com>2005-05-27 08:46:35 +0900
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-26 15:13:53 +0000
commit5b5a256ab100c58f58aab1b20dc1f7777b745fd1 (patch)
tree4602e65df8002f8cb6617f8b7bd08100e62636ef /lib
parent7423f6db106ad471398838e82e73b22d8c1e166e (diff)
downloadperl-5b5a256ab100c58f58aab1b20dc1f7777b745fd1.tar.gz
bytes.pm doesn't check undefined subroutine calling
Message-Id: <20050526234321.92F1.BQW10602@nifty.com> p4raw-id: //depot/perl@24585
Diffstat (limited to 'lib')
-rw-r--r--lib/bytes.pm6
-rw-r--r--lib/bytes.t8
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/bytes.pm b/lib/bytes.pm
index 9a04491daf..a8222794dd 100644
--- a/lib/bytes.pm
+++ b/lib/bytes.pm
@@ -1,6 +1,6 @@
package bytes;
-our $VERSION = '1.01';
+our $VERSION = '1.02';
$bytes::hint_bits = 0x00000008;
@@ -14,7 +14,9 @@ sub unimport {
sub AUTOLOAD {
require "bytes_heavy.pl";
- goto &$AUTOLOAD;
+ goto &$AUTOLOAD if defined &$AUTOLOAD;
+ require Carp;
+ Carp::croak("Undefined subroutine $AUTOLOAD called");
}
sub length ($);
diff --git a/lib/bytes.t b/lib/bytes.t
index 6b66a554b2..ea1b9f629b 100644
--- a/lib/bytes.t
+++ b/lib/bytes.t
@@ -4,7 +4,7 @@ BEGIN {
require './test.pl';
}
-plan tests => 19;
+plan tests => 20;
my $a = chr(0x100);
@@ -46,3 +46,9 @@ my $c = chr(0x100);
is(bytes::index($c, "\x80"), 1, "bytes::index under use bytes looks at bytes");
is(bytes::rindex($c, "\xc4"), 0, "bytes::rindex under use bytes looks at bytes");
}
+
+{
+ fresh_perl_like ('use bytes; bytes::moo()',
+ qr/Undefined subroutine bytes::moo/, {stderr=>1},
+ "Check Carp is loaded for AUTOLOADing errors")
+}