1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateprint "1..14\n"; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate$SIG{__DIE__} = sub { print ref($_[0]) ? ("ok ",$_[0]->[0]++,"\n") : @_ } ; 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gate$err = "#[\000]\nok 1\n"; 8*0Sstevel@tonic-gateeval { 9*0Sstevel@tonic-gate die $err; 10*0Sstevel@tonic-gate}; 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gateprint "not " unless $@ eq $err; 13*0Sstevel@tonic-gateprint "ok 2\n"; 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate$x = [3]; 16*0Sstevel@tonic-gateeval { die $x; }; 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gateprint "not " unless $x->[0] == 4; 19*0Sstevel@tonic-gateprint "ok 4\n"; 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gateeval { 22*0Sstevel@tonic-gate eval { 23*0Sstevel@tonic-gate die [ 5 ]; 24*0Sstevel@tonic-gate }; 25*0Sstevel@tonic-gate die if $@; 26*0Sstevel@tonic-gate}; 27*0Sstevel@tonic-gate 28*0Sstevel@tonic-gateeval { 29*0Sstevel@tonic-gate eval { 30*0Sstevel@tonic-gate die bless [ 7 ], "Error"; 31*0Sstevel@tonic-gate }; 32*0Sstevel@tonic-gate die if $@; 33*0Sstevel@tonic-gate}; 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gateprint "not " unless ref($@) eq "Out"; 36*0Sstevel@tonic-gateprint "ok 10\n"; 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate{ 39*0Sstevel@tonic-gate package Error; 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate sub PROPAGATE { 42*0Sstevel@tonic-gate print "ok ",$_[0]->[0]++,"\n"; 43*0Sstevel@tonic-gate bless [$_[0]->[0]], "Out"; 44*0Sstevel@tonic-gate } 45*0Sstevel@tonic-gate} 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate{ 48*0Sstevel@tonic-gate # die/warn and utf8 49*0Sstevel@tonic-gate use utf8; 50*0Sstevel@tonic-gate local $SIG{__DIE__}; 51*0Sstevel@tonic-gate my $msg = "ce ºtii tu, bã ?\n"; 52*0Sstevel@tonic-gate eval { die $msg }; print "not " unless $@ eq $msg; 53*0Sstevel@tonic-gate print "ok 11\n"; 54*0Sstevel@tonic-gate our $err; 55*0Sstevel@tonic-gate local $SIG{__WARN__} = $SIG{__DIE__} = sub { $err = shift }; 56*0Sstevel@tonic-gate eval { die $msg }; print "not " unless $err eq $msg; 57*0Sstevel@tonic-gate print "ok 12\n"; 58*0Sstevel@tonic-gate eval { warn $msg }; print "not " unless $err eq $msg; 59*0Sstevel@tonic-gate print "ok 13\n"; 60*0Sstevel@tonic-gate eval qq/ use strict; \$\x{3b1} /; 61*0Sstevel@tonic-gate print "not " unless $@ =~ /Global symbol "\$\x{3b1}"/; 62*0Sstevel@tonic-gate print "ok 14\n"; 63*0Sstevel@tonic-gate} 64