Fix a couple of typos in overloading.pm docs
[p5sagit/p5-mst-13.2.git] / lib / SelfLoader / t / 02SelfLoader-buggy.t
1 BEGIN {
2     if( $ENV{PERL_CORE} ) {
3         chdir 't' if -d 't';
4         @INC = '../lib';
5     }
6 }
7
8 use SelfLoader;
9 print "1..1\n";
10
11 # this script checks that errors on self-loaded
12 # subroutines that affect $@ are reported
13
14 eval { buggy(); };
15 unless ($@ =~ /^syntax error/) {
16     print "not ";
17 }
18 print "ok 1 - syntax errors are reported\n";
19
20 __END__
21
22 sub buggy
23 {
24     +>*;
25 }
26
27
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 # }