Fix a couple of typos in overloading.pm docs
[p5sagit/p5-mst-13.2.git] / lib / SelfLoader / t / 02SelfLoader-buggy.t
CommitLineData
cca8f13b 1BEGIN {
2 if( $ENV{PERL_CORE} ) {
3 chdir 't' if -d 't';
4 @INC = '../lib';
5 }
6}
7
8use SelfLoader;
4e3c68f2 9print "1..1\n";
cca8f13b 10
11# this script checks that errors on self-loaded
12# subroutines that affect $@ are reported
13
14eval { buggy(); };
15unless ($@ =~ /^syntax error/) {
16 print "not ";
17}
18print "ok 1 - syntax errors are reported\n";
19
20__END__
21
22sub buggy
23{
24 +>*;
25}
26
27
a37cecd0 28# RT 40216
29#
30# by Bo Lindbergh <blgl@hagernas.com>, at Aug 22, 2006 5:42 PM
31#
32# In the example below, there's a syntax error in the selfloaded
33# code for main::buggy. When the eval fails, SelfLoader::AUTOLOAD
34# tries to report this with "croak $@;". Unfortunately,
35# SelfLoader::croak does "require Carp;" without protecting $@,
36# which gets clobbered. The program then dies with the
37# uninformative message " at ./example line 3".
38#
39# #! /usr/local/bin/perl
40# use SelfLoader;
41# buggy();
42# __END__
43# sub buggy
44# {
45# +>*;
46# }