1#!perl -w 2 3# Can't use Test::Simple/More, they depend on Exporter. 4my $test; 5sub ok ($;$) { 6 my($ok, $name) = @_; 7 8 # You have to do it this way or VMS will get confused. 9 printf "%sok %d%s\n", ($ok ? '' : 'not '), $test, 10 (defined $name ? " - $name" : ''); 11 12 printf "# Failed test at line %d\n", (caller)[2] unless $ok; 13 14 $test++; 15 return $ok; 16} 17 18 19BEGIN { 20 $test = 1; 21 print "1..2\n"; 22 require Exporter; 23 ok( 1, 'Exporter compiled' ); 24} 25 26package Foo; 27Exporter->import("import"); 28our @EXPORT_OK = qw/bar/; 29 30 31package main; 32 33{ # [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers 34 my @warn; 35 36 local $SIG{__WARN__} = sub { push @warn, join "", @_ }; 37 eval { Foo->import(":quux") }; 38 ok(grep(/"quux" is not defined/, @warn), "warnings captured"); 39} 40 41