1#!perl -w 2 3BEGIN { 4 if ($ENV{'PERL_CORE'}){ 5 chdir 't' if -d 't'; 6 @INC = '../lib'; 7 } 8} 9 10BEGIN { 11 eval { 12 require warnings; 13 }; 14 if ($@) { 15 print "1..0\n"; 16 print $@; 17 exit; 18 } 19} 20 21use strict; 22use MIME::Base64 qw(decode_base64); 23 24print "1..1\n"; 25 26use warnings; 27 28my @warn; 29$SIG{__WARN__} = sub { push(@warn, @_) }; 30 31warn; 32my $a; 33$a = decode_base64("aa"); 34$a = decode_base64("a==="); 35warn; 36$a = do { 37 no warnings; 38 decode_base64("aa"); 39}; 40$a = do { 41 no warnings; 42 decode_base64("a==="); 43}; 44warn; 45$a = do { 46 local $^W; 47 decode_base64("aa"); 48}; 49$a = do { 50 local $^W; 51 decode_base64("a==="); 52}; 53warn; 54 55if ($^O eq 'MSWin32') { 56 for (@warn) { 57 s|\\|/|g; 58 } 59} 60 61for (@warn) { 62 print "# $_"; 63} 64 65print "not " unless join("", @warn) eq <<"EOT"; print "ok 1\n"; 66Warning: something's wrong at $0 line 31. 67Premature end of base64 data at $0 line 33. 68Premature padding of base64 data at $0 line 34. 69Warning: something's wrong at $0 line 35. 70Premature end of base64 data at $0 line 38. 71Premature padding of base64 data at $0 line 42. 72Warning: something's wrong at $0 line 44. 73Warning: something's wrong at $0 line 53. 74EOT 75